Go DDD Starter Template
A production-ready Go project template that follows Domain-Driven Design (DDD) principles to create clean, maintainable, and scalable applications.
Using This Template
- Click the "Use this template" button at the top of this repository
- Name your new repository and create it
- Clone your new repository locally
- Update the following files with your project details:
go.mod
: Change the module name to your project's module path
.env-dev
: Configure with your local development settings
README.md
: Update with your project-specific information
Features
- 🪟 Domain-Driven Design architecture
- 🔒 Clean separation of concerns
- 🛠 Built-in development tools (hot reload, testing)
- 📦 Docker support for local development
- 🗄 PostgreSQL integration ready
- ⚡️ Modern Go practices and patterns
- ✨ MDC Files for AI agents
Development Workflow
Prerequisites
- Mise
- Docker and Docker Compose
- Make
Initial Setup
- Create your repository from this template
- Clone your new repository
- Copy the environment file:
cp .env-dev .env
- Configure your environment variables in
.env
- Install development tools:
make setup
- Compile the project:
make compile
Running Dependencies
- Start the database:
docker-compose up -d
- Load environment variables:
set -a && source .env && set +a
- Run migrations:
make migration/up
Development
Hot Reload
For development convenience, we use Air for hot reloading:
air
Testing
Run the test suite with:
make test
API Documentation
The API is documented using OpenAPI 3.0. You can find the specification in openapi.yaml
.
To view the interactive API documentation:
- Start the service
- Visit
/api/v1/docs
endpoint
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.