Skip to content

abdorrahmani/golang-clean-architectures-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang GIN MongoDB Clean Architectures

Go Gin MongoDB License Website Stars

Overview

This repository is a collection of Clean Architecture examples implemented in Golang with Gin framework and MongoDB as the database. It demonstrates different architectural patterns to build scalable, maintainable, and testable applications.

Included Architectures:

  • Feature-Based Architecture
  • Hexagonal Architecture
  • Domain-Driven Design (DDD)
  • Other modern architecture patterns

Features

  • Clean and modular code structure
  • Separation of concerns with layers
  • Example implementations for each architecture
  • Dependency injection and inversion
  • Testable components
  • Optimized for scalability and maintainability

Table of Contents


Installation

git clone https://github.com/abdorrahmani/golang-clean-architectures-mongo.git
cd golang-clean-architectures-mongo
go mod tidy

Usage

  1. Choose the architecture you want to explore from the examples folder.
  2. Navigate to the respective folder.
  3. Run the application:
go run main.go

Architectures

Feature-Based Architecture

Feature-Based

A simple yet effective way to organize code by features. Each feature has its own folder containing its controllers, services, and repository.

Hexagonal Architecture

Hexagonal

Also known as "Ports and Adapters," this architecture emphasizes decoupling the core application logic from external dependencies.

Domain-Driven Design (DDD) Architecture

DDD

A more advanced architectural style focused on modeling the business domain and its logic in a way that closely aligns with real-world processes.


Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature.
  3. Commit your changes and create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Connect

GitHub followers