This is users details service
- Golang
- PostgreSQL (Database)
- Docker
- Echo (HTTP Framework): https://github.com/labstack/echo
- GORM (ORM): https://github.com/go-gorm/gorm
- GoDotEnv (Configuration): https://github.com/joho/godotenv
- Go Playground Validator (Validation): https://github.com/go-playground/validator
- Swaggo (Swagger v2): https://github.com/swaggo/swag
- Air (Auto-reload development): https://github.com/air-verse/air
API Specs in docs
folder or you can run the project and access http://localhost:9090/api/docs/index.html
Installing swaggo cli
go install github.com/swaggo/swag/cmd/swag@latest
Generate docs
swag fmt
swag init --parseDependency --parseInternal -g cmd/api/main.go
- Clone the project
git clone https://github.com/tryoasnafi/users
- Setting .env
cd users
cp -p .env.example .env
- Install project dependencies
go get ./...
- Install Air (auto-reload) and run docker compose
go install github.com/air-verse/air@latest
make watch
If you don't have GNU Make, you can run
docker compose -f compose.dev.yaml up -d --build
Database migration using GORM Auto migrate, make sure to set .env
go run cmd/migration/main.go
go test ./...
Build users service image
make build
or run
docker build -f Dockerfile.production . -t user-service:latest