A starter template for building scalable, maintainable, and testable RESTful APIs in Go using the project layout.
- Layered architecture (domain, usecase, handle, repository)
- Dependency injection
- RESTful API structure
- Swagger/OpenAPI documentation
- Example modules and handlers
- Easy to extend and customize
- Go 1.18+
- Docker (optional, for running with containers)
Clone the repository:
git clone https://github.com/yourusername/golang-clean-arch-template.git
cd golang-clean-arch-templateInstall dependencies:
go mod tidygo run cmd/api/main.goOr with Docker:
docker-compose up --buildAccess the Swagger UI at:
http://localhost:5000/swagger/index.html
.
├── cmd/ # Application entrypoints
├── internal/ # Application code (domain, usecase, handle, repository)
├── pkg/ # Shared packages
├── docs/ # API documentation
├── Dockerfile
└── README.md
Contributions are welcome! Please open issues or submit pull requests.
This project is licensed under the MIT License.