In this exercise, I had to build a Golang service that manage Users and exposes them through a gPRC API.
- Go (version 1.22 or later)
- Docker (for containerization)
- Docker Compose (optional, for managing multi-container Docker applications)
- PostgreSQL (for local development)
- Goose (to run migration)
faceit-user-store-svc/
├── cmd
│ └── main.go - Define how the server/database/redis runs and start the gRPC server.
├── internal
│ ├── config - Contains all the config that the microservice needs.
│ ├── database - Contains all the migrations and the postgres logics.
│ ├── entities - Defines all the entities needed.
│ ├── handlers - Defines the HTTP server and all the handler methods.
│ └── service - Service layer; handlers call service methods, and service calls database methods.
├── pkg - Contains all the libraries used in different micro-services. These are non-product libraries.
└── contracts - Defines any communication between services, ensuring payload consistency and easier versioning.
Make sure you have goose installed on your computer
go install github.com/pressly/goose/v3/cmd/goose@latest
docker-compose.yml is already configured but feel free to update environments variables.
make run
postgresql://root:[email protected]/faceit-user-store-svc-db?tLSMode=0
make unit-test