This project has the following prerequisites:
- Golang v1.21.4
- Gorm as ORM
- PostgreSQL as the database
- JWT for token generation
- Migrate as the engine for database migration
- Gin Gonic for REST HTTP
- Redis for storing session login tokens
- sync go modules
go mod tidy
- download and install golang-migrate -> https://github.com/golang-migrate/migrate/tree/master/cmd/migrate
- migrate up
migrate -source "file://migrations/pgsql" -database "postgres://username:pwd@localhost:5432/your_db?sslmode=disable&search_path=apps" up
- create new migration (if needed)
migrate create -ext sql -dir migrations/pgsql create_my_table
- apps -> execute file
sh main.sh
- migration & seeder -> execute file
sh migration.sh
- using docker-compose
docker-compose up -d
- if using docker the migration should execute inside the container
docker ps docker exec -it CONTAINER-ID bash cd cmd/migration go run main.go