This repository demonstrates a modular monolith architecture using Go. It is designed to showcase how large-scale applications can be structured into well-defined modules.
- Modular Design: Organize complex applications into separate modules.
- Clean Architecture: Maintain a clear separation between domain, application, and infrastructure layers.
- Technology Stack:
- Go (Golang)
- MySQL as the database
- SQLX for database interactions
- Inter-module Communication:
- Modules communicate using gRPC.
- The main interface utilizes a REST API built with GIN.
- User Module: Contains functionalities related to user management, along with its own infrastructure and domain logic.
- Clone the repository.
- Install the required dependencies.
- Generate Protocol Buffers:
- Use buf to generate the proto files:
cd proto buf generate
- Use buf to generate the proto files:
- Run Docker Compose:
- Start the necessary services:
docker-compose up
- Start the necessary services:
- Run the Application:
- Start the API server:
go run cmd/api/main.go
- Start the API server:
For more details on setup and usage, please refer to the corresponding module documentation.
The migration tool uses golang-migrate/migrate
docker run -v $PWD/schema/migrations{{ target }}:/migrations migrate/migrate create -ext sql -dir /migrations -seq foobardocker run -v $PWD/schema/migrations/{{ target }}:/migrations --network host migrate/migrate \
-path=/migrations -database "mysql://root@tcp(localhost:3306)/{{ target }}" up