This project contains a Go Restful API that helps users manage their diet plans. The diet plan is generated by an AI.
git clone https://github.com/christian-gama/nutrai-api.git
The command to initialize the project will automatically create the environment files if they don't exist and also make the git hooks and scripts executable.
make init
If you opt to run the project locally, without docker, it will start the Postgres image regardless and use it automatically. Both production and development modes does not run migrations automatically. Please refer to the migration section to learn more.
The development mode will run the application using air. It will watch for any changes in the project and automatically reload if necessary.
make dev
OR
make docker-dev
The production mode will build the project and run the binary that was built. It will also use the production environment variables.
make prod
OR
make docker-prod
There are a few commands related to migrations. You can use: up
, down
, drop
, reset
, version
and step
. Each option is documented and explained in the makefile. Migrations never run automatically, you must explicitly run it.
Tests that contains database connection will automatically migrate the database schema before running the tests.
make test
make test-unit
make test-integration
The Makefile contains all the commands needed to run the project, tests and build the docker image. Please read the Makefile for more details.
You can use the help command to see all the available targets with a short description. You can read the Makefile for more details about each target and how to use them.
make help