A production-ready Go project skeleton for building microservices, designed with Clean Architecture, Docker support, and cloud-native practices.
- Clean Architecture: Separated layers (domain, repositories, services, controllers).
- Docker Integration: Pre-configured
Dockerfileanddocker-compose.yml. - Kafka Event Streaming: Example producer/consumer setup.
- GCP Support: Cloud SQL, Pub/Sub, and Storage helpers.
- Authentication: JWT middleware with role-based access.
- CI/CD: Jenkins pipeline example for automated testing and deployment.
- Go 1.21+
- Docker
- Apache Kafka (local or cloud instance)
-
Clone the repository:
git clone git@github.com:abdul23lm/go-microservice-skeleton.git [your-service]
-
Navigate to the project directory:
cd [your-service]
- cmd/: Main application entrypoints.
- config/: Environment configurations.
- controllers/: HTTP/gRPC handlers.
- domain/: Core business models and interfaces.
- repositories/: Database/ORM layer (e.g., PostgreSQL, Firestore).
- services/: Business logic layer.
- routes/: API endpoint definitions.
- middlewares/: Authentication, logging, etc.
- common/: Shared utilities (logging, errors).
- clients/: Third-party API clients (e.g., Stripe, GCP).
- Dockerfile: Container configuration.
- docker-compose.yml: Local development stack.
- Makefile: Build/test shortcuts.
Update .env in the config folder with your environment-specific values:
APP_PORT=8080
DB_URL=postgres://user:pass@host:port/dbname
KAFKA_BROKERS=localhost:9092To run the application locally with Docker:
docker-compose up --build