finds.dev← search

// the find

amitshekhariitbhu/go-backend-clean-architecture

★ 6,056 · Go · Apache-2.0 · updated Feb 2026

A Go (Golang) Backend Clean Architecture project with Gin, MongoDB, JWT Authentication Middleware, Test, and Docker.

A Go project template implementing Clean Architecture with Gin, MongoDB, and JWT auth. It layers Router → Controller → Usecase → Repository → Domain with each concern in its own package. Aimed at developers who want a starting point for a Go API without making architectural decisions from scratch.

The layer separation is genuine — domain interfaces are defined in the domain package and implemented in repository/usecase, which makes swapping implementations testable without heroics. Mockery is wired up correctly and the generated mocks are checked in, so you can run tests immediately without a setup ritual. The refresh token flow is implemented properly with separate access/refresh tokens rather than the common mistake of just re-signing the same claim. Docker Compose setup is straightforward and the environment config via Viper is sensible.

MongoDB is baked in at every layer — the repository interfaces return mongo-specific types in places, so swapping to Postgres isn't just 'implement the interface'. The test coverage is shallow: one controller test, one repository test, one usecase test, all against a trivially simple task entity. There's no error handling strategy beyond returning error strings — no typed errors, no distinction between validation failures and infrastructure failures. The domain is anemic; it's mostly struct definitions with no business logic, which makes the usecase layer just thin CRUD wrappers around the repository.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →