Repolode
evrone

evrone/go-clean-template

A Clean Architecture project template for Go services, showing how to structure code across REST, gRPC, AMQP RPC and NATS RPC transports.

Stars
7,708
Forks
665
Open issues
3
Last commit
11 days ago

What is it?

go-clean-template is a starting point for Go microservices that follows Clean Architecture principles. It separates business logic from infrastructure such as databases, web frameworks and message brokers, so the core use cases depend only on interfaces and the standard library. The project is intended to keep a service organized as it grows.

The template ships with three example domains: user authentication with JWT, task management with status transitions, and text translation with history tracking. Each domain is exposed over four transports: a Fiber-based REST API, gRPC, and RPC over RabbitMQ (AMQP) and NATS. Dependency injection is done through New constructors, and the repository includes Docker Compose setup for Postgres, RabbitMQ, NATS and Jaeger.

The project also covers observability with OpenTelemetry tracing that propagates context across all four transports, along with Prometheus metrics, Swagger documentation, integration tests and database migrations.

Key features

  • 01Clean Architecture layering with dependency injection via New constructors
  • 02REST API built on Fiber, with Swagger docs generated by swag
  • 03gRPC services defined with protobuf
  • 04RPC servers over RabbitMQ (AMQP) and NATS request-reply
  • 05OpenTelemetry tracing and Prometheus metrics
  • 06Docker Compose stack with Postgres, RabbitMQ, NATS and Jaeger

Use cases

  • Bootstrapping a new Go microservice with a consistent project layout
  • Learning how to separate business logic from transport and storage in Go
  • Building a service that must expose the same logic over REST, gRPC and message queues

Quick start

  1. 1

    Start Postgres, RabbitMQ and NATS with Docker Compose

    make compose-up
  2. 2

    Run the app with migrations

    make run

Things to know

  • Local development needs Docker Compose to run Postgres, RabbitMQ and NATS.

Topics

FAQ

What is go-clean-template?
A Clean Architecture project template for Go services, showing how to structure code across REST, gRPC, AMQP RPC and NATS RPC transports. go-clean-template is a starting point for Go microservices that follows Clean Architecture principles. It separates business logic from infrastructure such as databases, web frameworks and message brokers, so the core use cases depend only on interfaces and the standard library. The project is intended to keep a service organized as it grows.
Is go-clean-template free to use? What license does it have?
go-clean-template is open source under the MIT license. Check the license terms before using it in commercial products.
Is go-clean-template still maintained?
Actively maintained. The last commit to go-clean-template was on Oct 11, 2026.
What can I use go-clean-template for?
Bootstrapping a new Go microservice with a consistent project layout Learning how to separate business logic from transport and storage in Go Building a service that must expose the same logic over REST, gRPC and message queues
How do I install go-clean-template?
Start Postgres, RabbitMQ and NATS with Docker Compose: make compose-up Run the app with migrations: make run
Where can I get go-clean-template?
The source code and installation instructions are on GitHub: https://github.com/evrone/go-clean-template

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects