evrone/go-clean-template sits at 7.7k stars on GitHub, written primarily in Go. Clean Architecture template for Golang services
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Distributed tracing is provided by OpenTelemetry. Spans are exported over OTLP/gRPC to a
collector — Jaeger in the docker stack.
Context propagation — W3C traceparent + baggage, so a single trace spans all four transports. REST uses
the otelfiber middleware, gRPC uses the
otelgrpc stats handler, and AMQP RPC / NATS RPC carry the
trace context in message headers via custom carriers (pkg/rabbitmq/rmq_rpc/otel_carrier.go,
pkg/nats/nats_rpc/otel_carrier.go).
Instrumented layers — use cases and repositories are wrapped in tracing decorators (*/tracing.go), so a trace
shows the full path: controller → usecase → repo / webapi.
No-op when disabled — with TRACING_ENABLED=false a no-op tracer provider is installed, so instrumentation runs
unconditionally with zero overhead.
Sampling — TRACING_SAMPLE_RATE is a parent-based ratio. Use 1.0 locally; lower it (0.1 / 0.01) in
production.
Internal routes (/healthz, /metrics, /swagger) are excluded from tracing — only the versioned API groups are
instrumented.
Configuration (see .env.example):
Variable
Default
Description
TRACING_ENABLED
false
Enable OpenTelemetry tracing
TRACING_OTLP_ENDPOINT
localhost:4317
OTLP/gRPC collector endpoint
TRACING_OTLP_INSECURE
true
Disable TLS for the OTLP exporter
TRACING_SAMPLE_RATE
0.1
Parent-based sampling ratio
Project structure
cmd/app/main.go
Configuration and logger initialization. Then the main function "continues" in
internal/app/app.go.
config
The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy
to change between deploys without changing any code; unlike config files, there is little chance of them being checked
into the code repo accidentally; and unlike custom config files, or other config mechanisms such as Java System
Properties, they are a language- and OS-agnostic standard.
Config: config.go
Example: .env.example
docker-compose.yml uses env variables to configure services.
docs
Swagger documentation. Auto-generated by swag library.
You don't need to correct anything by yourself.
docs/proto
Protobuf files. They are used to generate Go code for gRPC services.
The proto files are also used to generate documentation for gRPC services.
You don't need to correct anything by yourself.
integration-test
Integration tests.
They are launched as a separate container, next to the application container.
internal/app
There is always one Run function in the app.go file, which "continues" the main function.
This is where all the main objects are created.
Dependency injection occurs through the "New ..." constructors (see Dependency Injection).
This technique allows us to layer the application using the Dependency Injection principle.
This makes the business logic independent from other layers.
Next, we start the server and wait for signals in select for graceful completion.
If app.go starts to grow, you can split it into multiple files.
For a large number of injections, wire can be used.
The migrate.go file is used for database auto migrations.
It is included if an argument with the migrate tag is specified.
For example:
go run -tags migrate ./cmd/app
internal/controller
Server handler layer (MVC controllers). The template shows 4 servers:
AMQP RPC (based on RabbitMQ as transport)
NATS RPC (based on NATS as transport)
gRPC (gRPC framework based on protobuf)
REST API (Fiber framework)
Server routers are written in the same style:
Handlers are grouped by area of application (by a common basis)
For each group, its own router structure is created, the methods of which process paths
The structure of the business logic is injected into the router structure, which will be called by the handlers
internal/controller/amqp_rpc
Simple RPC versioning.
For v2, we will need to add the amqp_rpc/v2 folder with the same content.
And in the file internal/controller/amqp_rpc/router.go add the line:
Simple gRPC versioning.
For v2, we will need to add the grpc/v2 folder with the same content.
Also add the v2 folder to the proto files in docs/proto.
And in the file internal/controller/grpc/router.go add the line:
Simple RPC versioning.
For v2, we will need to add the nats_rpc/v2 folder with the same content.
And in the file internal/controller/nats_rpc/router.go add the line:
Simple REST versioning.
For v2, we will need to add the restapi/v2 folder with the same content.
And in the file internal/controller/restapi/router.go add the line:
Instead of Fiber, you can use any other http framework.
In router.go and above the handler methods, there are comments for generating swagger documentation
using swag.
internal/entity
Entities of business logic (models) can be used in any layer.
There can also be methods, for example, for validation.
internal/usecase
Business logic.
Methods are grouped by area of application (on a common basis)
Each group has its own structure
One file - one structure
Repositories, webapi, rpc, and other business logic structures are injected into business logic structures
(see Dependency Injection).
internal/repo/persistent
A repository is an abstract storage (database) that business logic works with.
internal/repo/webapi
It is an abstract web API that business logic works with.
For example, it could be another microservice that business logic accesses via the REST API.
The package name changes depending on the purpose.
pkg/rabbitmq
RabbitMQ RPC pattern:
There is no routing inside RabbitMQ
Exchange fanout is used, to which 1 exclusive queue is bound, this is the most productive config
Reconnect on the loss of connection
pkg/tracing
OpenTelemetry setup: configures a global TracerProvider with an OTLP/gRPC exporter and W3C trace-context + baggage
propagators. When tracing is disabled, a no-op provider is installed so instrumentation code runs unconditionally.
See Observability.
Dependency Injection
In order to remove the dependence of business logic on external packages, dependency injection is used.
For example, through the New constructor, we inject the dependency into the structure of the business logic.
This makes the business logic independent (and portable).
We can override the implementation of the interface without making changes to the usecase package.
It will also allow us to do auto-generation of mocks (for example with go.uber.org/mock) and
easily write unit tests.
We are not tied to specific implementations in order to always be able to change one component to another.
If the new component implements the interface, nothing needs to be changed in the business logic.
Clean Architecture
Key idea
Programmers realize the optimal architecture for an application after most of the code has been written.
A good architecture allows decisions to be delayed to as late as possible.
The main principle
Dependency Inversion (the same one from SOLID) is the principle of dependency injection.
The direction of dependencies goes from the outer layer to the inner layer.
Due to this, business logic and entities remain independent from other parts of the system.
So, the application is divided into 2 layers, internal and external:
Business logic (Go standard library).
Tools (databases, servers, message brokers, any other packages and frameworks).
The inner layer with business logic should be clean. It should:
Not have package imports from the outer layer.
Use only the capabilities of the standard library.
Make calls to the outer layer through the interface (!).
The business logic doesn't know anything about Postgres or a specific web API.
Business logic has an interface for working with an abstract database or abstract web API.
The outer layer has other limitations:
All components of this layer are unaware of each other's existence. How to call another from one tool? Not directly,
only through the inner layer of business logic.
All calls to the inner layer are made through the interface (!).
Data is transferred in a format that is convenient for business logic (internal/entity).
For example, you need to access the database from HTTP (controller).
Both HTTP and database are in the outer layer, which means they know nothing about each other.
The communication between them is carried out through usecase (business logic):
Entities are structures that business logic operates on.
They are located in the internal/entity folder.
In MVC terms, entities are models.
Use Cases is business logic located in internal/usecase.
The layer with which business logic directly interacts is usually called the infrastructure layer.
These can be repositories internal/repo/persistent, external webapi internal/repo/webapi, any pkg, and other
microservices.
In the template, the infrastructure packages are located inside internal/repo.
You can choose how to call the entry points as you wish. The options are:
controller (in our case)
delivery
transport
gateways
entrypoints
primary
input
Additional layers
The classic version
of Clean Architecture was designed for
building large monolithic applications and has 4 layers.
In the original version, the outer layer is divided into two more, which also have an inversion of dependencies
to each other (directed inward) and communicate through interfaces.
The inner layer is also divided into two (with separation of interfaces), in the case of complex logic.
Complex tools can be divided into additional layers.
However, you should add layers only if really necessary.
Alternative approaches
In addition to Clean architecture, Onion architecture and Hexagonal (Ports and adapters) are similar to it.
Both are based on the principle of Dependency Inversion.
Ports and adapters are very close to Clean Architecture, the differences are mainly in terminology.
Does evrone/go-clean-template have a project website?
No homepage URL was recorded for evrone/go-clean-template in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How active is development on evrone/go-clean-template?
The most recent commit recorded on evrone/go-clean-template was 6 days ago, based on the GitHub push timestamp. The repository has 672 forks — one of the better signals of community interest.
How many stars does evrone/go-clean-template have?
evrone/go-clean-template has 7.7k GitHub stars — refresh the page for the live number, or check github.com/evrone/go-clean-template. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is evrone/go-clean-template open source?
Yes — evrone/go-clean-template ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/evrone/go-clean-template.
What else is in the Backend space?
evrone/go-clean-template is tracked by TopGit under the Backend category, alongside 7 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What topics is evrone/go-clean-template associated with?
GitHub's repository topics for evrone/go-clean-template: "clean-architecture", "dependency-injection", "example", "go", "golang", "microservices", "template". TopGit's editorial category is Backend.
Where do I read more about evrone/go-clean-template?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/evrone/go-clean-template is the definitive source.
Read full README in the tab above.
Want a second opinion on go-clean-template?
Ask an AI that can read this page — one click and you get its take on go-clean-template.