# bxcodec/go-clean-arch

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/bxcodec-go-clean-arch).**

10,118 stars · 1,307 forks · Go · MIT

## Links

- GitHub: https://github.com/bxcodec/go-clean-arch
- awesome-repositories: https://awesome-repositories.com/repository/bxcodec-go-clean-arch.md

## Topics

`architecture` `article` `clean-architecture` `database` `go` `golang` `mysql` `sql`

## Description

This project is a boilerplate and template for Go applications implementing Clean Architecture. It provides a standardized project structure designed to organize code into decoupled layers, ensuring that core business logic remains independent of databases, frameworks, and user interfaces.

The implementation focuses on a domain-driven design that utilizes dependency injection and the repository pattern to abstract data storage. It enforces architectural boundaries through internal package encapsulation and layer-based dependency inversion.

The project includes a development toolchain that automates the software lifecycle. This covers a variety of capabilities, including static analysis integration, parallelized test execution with mock dependency generation, and live application reloading.

Deployment and environment management are handled through containerization, using multi-stage builds for minimal production images and orchestration for managing multi-container environments.

## Tags

### Software Engineering & Architecture

- [Clean Architecture Implementations](https://awesome-repositories.com/f/software-engineering-architecture/go-microservices-architectures/clean-architecture-implementations.md) — Provides a standardized implementation of clean architecture for decoupling business logic in Go applications.
- [Dependency Inversion Patterns](https://awesome-repositories.com/f/software-engineering-architecture/project-management-governance/dependency-boundary-enforcers/dependency-inversion-patterns.md) — Implements a Clean Architecture where high-level business logic depends on abstractions rather than concrete infrastructure.
- [Clean Architecture Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/clean-architecture-frameworks.md) — Provides a foundational template that enforces the separation of business logic from infrastructure and presentation layers.
- [Internal Package Encapsulation](https://awesome-repositories.com/f/software-engineering-architecture/module-encapsulation-patterns/logic-encapsulation-interfaces/internal-package-encapsulation.md) — Implements internal package restrictions to ensure implementation details remain hidden from external consumers. ([source](https://github.com/bxcodec/go-clean-arch/tree/master/internal))
- [Package Visibility Restrictions](https://awesome-repositories.com/f/software-engineering-architecture/naming-conventions/reserved-names/access-restrictions/package-visibility-restrictions.md) — Enforces architectural boundaries by restricting external access to internal implementation packages.
- [Storage Abstraction Layers](https://awesome-repositories.com/f/software-engineering-architecture/storage-abstraction-layers.md) — Decouples application logic from storage backends using interface-driven abstraction layers. ([source](https://github.com/bxcodec/go-clean-arch/blob/master/README.md))

### Part of an Awesome List

- [Go and Ruby Boilerplates](https://awesome-repositories.com/f/awesome-lists/devtools/go-and-ruby-boilerplates.md) — Provides a comprehensive starter kit for building Go services with dependency injection and domain-driven design.
- [Project Scaffolding](https://awesome-repositories.com/f/awesome-lists/devtools/project-scaffolding.md) — Implementation of clean architecture patterns.

### Data & Databases

- [Repository Patterns](https://awesome-repositories.com/f/data-databases/backend-data-access-layers/repository-patterns.md) — Decouples domain logic from specific data storage implementations through the repository pattern.

### Testing & Quality Assurance

- [Dependency Mocking](https://awesome-repositories.com/f/testing-quality-assurance/dependency-mocking.md) — Uses simulated implementations of external dependencies to verify business logic in isolation.
- [Business Logic Isolation](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-isolation/logic-isolation-utilities/business-logic-isolation.md) — Separates application business logic from the user interface and external drivers to enable independent testing. ([source](https://github.com/bxcodec/go-clean-arch/tree/master/app))
- [Static Analysis](https://awesome-repositories.com/f/testing-quality-assurance/code-quality-review/static-analysis.md) — Integrates static analysis linters to identify bugs and maintain consistent coding standards. ([source](https://github.com/bxcodec/go-clean-arch/blob/master/Makefile))
- [Service Isolation Utilities](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-isolation/service-isolation-utilities.md) — Provides utilities to verify service behavior independently of external databases or third-party APIs.
- [Go Testing Frameworks](https://awesome-repositories.com/f/testing-quality-assurance/go-testing-frameworks.md) — Implements a testing setup utilizing mock dependencies to verify business logic in isolation.
- [Isolated Functionality Testing](https://awesome-repositories.com/f/testing-quality-assurance/isolated-functionality-testing.md) — Verifies core application behavior in isolated environments without requiring active database or server connections. ([source](https://github.com/bxcodec/go-clean-arch/tree/v2))
- [Parallel Test Execution](https://awesome-repositories.com/f/testing-quality-assurance/parallel-test-execution.md) — Executes test suites using parallelization and provides detailed coverage reporting. ([source](https://github.com/bxcodec/go-clean-arch/blob/master/Makefile))
- [Unit Testing](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/unit/unit-testing.md) — Verifies the smallest testable parts of the application in isolation using mock objects. ([source](https://github.com/bxcodec/go-clean-arch/blob/master/README.md))

### DevOps & Infrastructure

- [Production Builds](https://awesome-repositories.com/f/devops-infrastructure/cicd-pipeline-automation/core-build-engines/build-tooling/build-pipeline-extensions/production-build-apis/production-builds.md) — Builds optimized, production-ready container images from configuration files. ([source](https://github.com/bxcodec/go-clean-arch/blob/master/Makefile))
- [Multi-Stage Container Builds](https://awesome-repositories.com/f/devops-infrastructure/container-build-stages/multi-stage-container-builds.md) — Uses multi-stage Docker builds to separate the build environment from the minimal runtime image.
- [Containerized Application Deployments](https://awesome-repositories.com/f/devops-infrastructure/containerized-application-deployments.md) — Packages Go applications into lightweight production images with orchestrated infrastructure dependencies.

### Programming Languages & Runtimes

- [Go Development Workflows](https://awesome-repositories.com/f/programming-languages-runtimes/go-development-workflows.md) — Implements a development lifecycle optimized for Go with automated reloading and static analysis.
