awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
amitshekhariitbhu avatar

amitshekhariitbhu/go-backend-clean-architecture

0
View on GitHub↗
6,059 stars·660 forks·Go·Apache-2.0·12 viewsoutcomeschool.com/blog/go-backend-clean-architecture↗

Go Backend Clean Architecture

This is a Go backend template that structures a web service into domain, usecase, controller, and repository layers with strict dependency inversion. It provides a foundation for building maintainable and testable REST APIs by separating business logic from transport and data access concerns.

The project implements JWT-based authentication, issuing access and refresh tokens for user signup, login, and protected endpoint access. It uses the Gin HTTP framework to build a Docker-packaged REST API with public and private route groups, request validation, and middleware-based authentication. Dependencies are wired through explicit constructor calls at application startup without a dependency injection framework.

Data persistence is handled through a repository interface that abstracts MongoDB interactions behind a contract, enabling testable data access. The codebase supports mock-based layered testing, allowing verification of business logic and data access in isolation by substituting real dependencies with generated mock implementations. Configuration is loaded from a .env file and unmarshaled into a typed struct for runtime use.

Features

  • Go Clean Architecture Templates - Provides a foundational Go backend template with strict clean architecture layering for maintainable and testable REST APIs.
  • Registration and Profile Retrievals - Registers new users with email and password and returns profile data after JWT authentication.
  • Data Abstraction Layers - Abstracts database interactions behind an interface so usecases can operate without knowing storage details.
  • Domain Data Structure Declarations - Declares domain models and interface contracts that define the boundaries between architecture layers.
  • Repository Pattern Abstractions - Abstracts MongoDB interactions behind a repository interface for testable data access.
  • Access and Refresh Token Issuances - Generates short-lived access tokens and long-lived refresh tokens with separate signing secrets for user authentication.
  • JWT Authentications - Issues and validates signed JWT access and refresh tokens for user authentication.
  • Three-Layer Clean Architecture - Structures code into delivery, use-case, and repository layers with strict inward-only dependency rules.
  • Dependency Inversion Patterns - Separates code into domain, usecase, controller, and repository layers with strict dependency inversion.
  • Usecase Layer Executions - Implements a dedicated usecase layer that orchestrates business logic independently of transport and data access.
  • Gin-Based Frameworks - Ships a REST API built on the Gin HTTP framework with public and private routes.
  • Middleware-Based Endpoint Protections - Uses middleware to intercept requests and validate JWT tokens before granting access to protected API routes.
  • Authenticated Route Separations - Separates API routes into public and JWT-protected groups with middleware-based authentication.
  • User-Scoped Task CRUD - Implements create and list operations for tasks scoped to the authenticated user via JWT.
  • Request Validation - Validates incoming request payloads for required fields and correct types, returning 400 errors.
  • User-Scoped Task Management - Implements create and list operations for tasks scoped to the authenticated user via JWT.
  • MongoDB Repository Abstractions - Persists data through a repository interface that abstracts MongoDB interactions behind a contract for testable data access.
  • Interface Mock Generators - Generates mock implementations from Go interfaces to replace real dependencies in unit tests.
  • Refresh Token Rotation - Accepts a valid refresh token to issue a new access and refresh token pair without requiring re-login.
  • Identity Payload Extractions - Decodes validated JWT tokens to retrieve user ID and name for downstream request handling.
  • Isolated Layer Testing - Replaces real databases and repositories with generated mocks to verify each layer's behavior without external dependencies.
  • Dependency Mocking - Verifies business logic and data access in isolation using generated mock implementations.
  • Dependency-Mocked Unit Testers - Tests business logic and data access in isolation by substituting real dependencies with mocks.
  • Dependency Mocking - Substitutes real databases with generated mocks to verify controller, usecase, and repository behavior.
  • Use Case Tests with Mocked Dependencies - Tests use cases by injecting mocked repositories to verify business logic under success and error conditions.
  • User Profiles - Returns the authenticated user's name and email via a protected profile endpoint.

Star history

Star history chart for amitshekhariitbhu/go-backend-clean-architectureStar history chart for amitshekhariitbhu/go-backend-clean-architecture

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Curated searches featuring Go Backend Clean Architecture

Hand-picked collections where Go Backend Clean Architecture appears.
  • Clean Architecture and SOLID Principles
  • a software architecture for managing application layers

Open-source alternatives to Go Backend Clean Architecture

Similar open-source projects, ranked by how many features they share with Go Backend Clean Architecture.
  • threedotslabs/wild-workouts-go-ddd-exampleThreeDotsLabs avatar

    ThreeDotsLabs/wild-workouts-go-ddd-example

    6,348View on GitHub↗

    This project is a reference implementation of Domain-Driven Design, Clean Architecture, and Command Query Responsibility Segregation (CQRS) patterns using the Go programming language. It serves as a sample application to demonstrate how to decouple core domain rules from infrastructure and delivery mechanisms. The system is built as a gRPC microservices architecture, utilizing type-safe communication and service contracts. It implements an event-driven architecture to manage eventual consistency and asynchronous processing, specifically employing the Outbox pattern to ensure reliable messagin

    Goclean-architecturecqrsddd
    View on GitHub↗6,348
  • maitraysuthar/rest-api-nodejs-mongodbmaitraysuthar avatar

    maitraysuthar/rest-api-nodejs-mongodb

    1,185View on GitHub↗

    This backend starter template provides a modular structure for building REST APIs using Node.js, Express, and MongoDB. It includes predefined database models, schema-driven validation, and structured routing to facilitate the development of server-side applications. The application incorporates authentication and security features centered on user registration, login flows, and credential verification. Passwords are protected using cryptographic hashing, and access to protected endpoints is managed through signed token issuance and middleware-based route protection. Additional identity manage

    JavaScriptapiboilerplatees6
    View on GitHub↗1,185
  • jazzband/djangorestframework-simplejwtjazzband avatar

    jazzband/djangorestframework-simplejwt

    4,321View on GitHub↗

    This is a JSON Web Token authentication package for the Django REST Framework that manages stateless user identities. It serves as an authentication provider and token manager used to issue and validate signed tokens to maintain user sessions across multiple requests. The project implements a dual-token lifecycle, issuing short-lived access tokens and long-lived refresh tokens to balance security with session persistence. It features token rotation to prevent replay attacks and a blacklisting system to invalidate compromised credentials. Additionally, it supports sliding-window expiration to

    Python
    View on GitHub↗4,321
  • evrone/go-clean-templateevrone avatar

    evrone/go-clean-template

    7,601View on GitHub↗

    Clean Architecture template for Golang services

    Goclean-architecturedependency-injectionexample
    View on GitHub↗7,601
See all 30 alternatives to Go Backend Clean Architecture→

Frequently asked questions

What does amitshekhariitbhu/go-backend-clean-architecture do?

This is a Go backend template that structures a web service into domain, usecase, controller, and repository layers with strict dependency inversion. It provides a foundation for building maintainable and testable REST APIs by separating business logic from transport and data access concerns.

What are the main features of amitshekhariitbhu/go-backend-clean-architecture?

The main features of amitshekhariitbhu/go-backend-clean-architecture are: Go Clean Architecture Templates, Registration and Profile Retrievals, Data Abstraction Layers, Domain Data Structure Declarations, Repository Pattern Abstractions, Access and Refresh Token Issuances, JWT Authentications, Three-Layer Clean Architecture.

What are some open-source alternatives to amitshekhariitbhu/go-backend-clean-architecture?

Open-source alternatives to amitshekhariitbhu/go-backend-clean-architecture include: threedotslabs/wild-workouts-go-ddd-example — This project is a reference implementation of Domain-Driven Design, Clean Architecture, and Command Query… jazzband/djangorestframework-simplejwt — This is a JSON Web Token authentication package for the Django REST Framework that manages stateless user identities.… maitraysuthar/rest-api-nodejs-mongodb — This backend starter template provides a modular structure for building REST APIs using Node.js, Express, and MongoDB.… evrone/go-clean-template — Clean Architecture template for Golang services. santiq/bulletproof-nodejs — Implementation of a bulletproof node.js API 🛡️. xinliangnote/go-gin-api — go-gin-api is an API framework built on the Gin HTTP router that integrates common middleware and tools for rapid…