This is the backend for the Reciprocal project. It is a Go application built using the Standard Library.
- Install Go 1.23.1
- if you have a different version of Go installed, visit the Managing Go installations page to learn how to manage multiple versions of Go on your machine.
-
Install Docker desktop, make sure you have compose V2.*, available when you install Docker Desktop.
-
Install air to enable hot reloading of the application.
-
Install Packages
go mod download
- Run the setup script to create .env file and setup database, make sure you have docker running and
make
installed.
make setup
- Create the tables used to keep track of migrations
make migration-init
- if you do not have make installed, you can run the following command:
go run cmd/bun/main.go db init
- Run the application
make watch
- You can now access the application at
http://localhost:4000
- To create the tables used to keep track of migrations, run the following command:
make migration-init
go run cmd/bun/main.go db init
- To create a new migration, run the following command:
make create-migration
- You will be prompted to enter the name of the migration.
Enter migration name: <migration_name>
go run cmd/bun/main.go db create_sql <migration_name>
- To run migrations, run the following command:
make migrate
go run cmd/bun/main.go db migrate
- To rollback migrations, run the following command:
make rollback
go run cmd/bun/main.go db rollback
- To check the status of migrations, run the following command:
make status
go run cmd/bun/main.go db status