Skip to content

GOlang base repository with code gen to create a fast golang project based on hexagonal architeture

License

Notifications You must be signed in to change notification settings

not-empty/zord-microframework-golang

Repository files navigation

Zord Microframework

Build your mecha

GOlang base repository with code gen to create a fast golang project based on hexagonal architeture


Development

Remember to create your .env file based on .env.example

1. Using Docker Compose

Up mysql and zord project:

docker compose up

2. Using raw go build

You will need to build the http/main.go file:

go build -o server cmd/http/main.go

Then run the server

./server

3. Running from go file

go run cmd/http/main.go

Note: To run the local build as described in the second or third option, a MySQL server must be running. This is necessary for the application to interact with its database. The easiest way to set up a MySQL server locally is by using Docker. Below is a command to start a MySQL server container using Docker:

docker compose up mysql -d

This command will ensure that a MySQL server is running in the background, allowing you to execute the local build successfully.


Cli

build cli

to build cli into binary file run

go build -o cli cmd/cli/main.go

then you can run all cli commands with the binary file

./cli -h

if you`re developing something in the cli the best way is run it directly to all changes

go run cmd/cli/main.go

Cli Commands

create new domain (crud):

./cli create-domain {{domain}}

destroy domain:

./cli destroy-domain {{domain}}

migrate all domains:

./cli migrate

Obs: If you`re generating code inside docker container you need to change generated folder and file permissions to code out of docker container.

run the follow command to edit generated files:

sudo chown $USER:$USER -R .

if you have a group name different from username change the command accordingly


Run tests

Run all tests:

go test ./...

Verify code coverage:

// Generate coverage output
go test ./... -coverprofile=coverage.out

// Generate HTML file
go tool cover -html=coverage.out

Docs (WIP):

https://github.com/not-empty/zord-microframework-golang/wiki

Development

Want to contribute? Great!

The project using a simple code. Make a change in your file and be careful with your updates! Any new code will only be accepted with all validations.

Not Empty Foundation - Free codes, full minds

About

GOlang base repository with code gen to create a fast golang project based on hexagonal architeture

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages