Skip to content

mikemajesty/go-microservice-boilerplate-api

Repository files navigation

Golang boilerplate Microservice API

In this Golang boilerplate I used the main concepts of DDD, Clean Architecture, Ports and Adapters (Hexagonal Architecture).

Run

  • infra

     docker-compose up --build
    
  • run

    CompileDaemon -command="./go-microservice-boilerplate-api"
    

Test

  • run
    $ go test ./core/dog/use-case/__tests__/ ./core/cat/use-case/__test__/
    

CRUD features

  • List
    • mongo
      • search
      • pagination
      • sort
      • entity validation
    • postgres
      • search
      • pagination
      • sort
      • entity validation
  • Delete
    • mongo
      • Logical deletion
      • entity validation
    • postgres
      • Logical deletion
      • entity validation
  • Update
    • mongo
      • Update Partial entity
      • entity validation
    • postgres
      • Update Partial entity
      • entity validation
  • Create
    • mongo
      • entity validation
      • Not allow creating duplicates
    • postgres
      • entity validation

Architecture diagram

alt text

Architecture documentation

App Skeleton
.
├── core
│   ├── cat
│   │   ├── entity
│   │   │   └── cat.go
│   │   ├── repository
│   │   │   └── cat.go
│   │   └── use-case
│   │       ├── cat-create.go
│   │       ├── cat-delete.go
│   │       ├── cat-get-by-id.go
│   │       ├── cat-list.go
│   │       ├── cat-update.go
│   │       └── __test__
│   │           ├── cat-create_test.go
│   │           ├── cat-delete_test.go
│   │           ├── cat-get-by-id_test.go
│   │           ├── cat-list_test.go
│   │           └── cat-update_test.go
│   └── dog
│       ├── entity
│       │   └── dog.go
│       ├── repository
│       │   └── dog.go
│       └── use-case
│           ├── dog-create.go
│           ├── dog-delete.go
│           ├── dog-get-by-id.go
│           ├── dog-list.go
│           ├── dog-update.go
│           └── __tests__
│               ├── dog-create_test.go
│               ├── dog-delete_test.go
│               ├── dog-get-by-id_test.go
│               ├── dog-list_test.go
│               └── dog-update_test.go
├── docker-compose.yml
├── go.mod
├── go.sum
├── infra
│   ├── cache
│   │   ├── adapter.go
│   │   ├── memory
│   │   │   └── service.go
│   │   └── redis
│   │       └── service.go
│   ├── database
│   │   ├── adapter.go
│   │   ├── mongo
│   │   │   └── service.go
│   │   └── postgres
│   │       ├── migrations
│   │       │   └── create-cat-table.go
│   │       └── service.go
│   ├── logger
│   │   ├── adapter.go
│   │   └── service.go
│   ├── repository
│   │   ├── adapter.go
│   │   ├── mongo
│   │   │   └── repository.go
│   │   └── postgres
│   │       └── repository.go
│   └── secret
│       ├── adapter.go
│       └── service.go
├── main.go
├── modules
│   ├── cat
│   │   ├── adapter.go
│   │   ├── controller.go
│   │   ├── repository.go
│   │   ├── routes.go
│   │   └── validator.go
│   └── dog
│       ├── adapter.go
│       ├── controller.go
│       ├── repository.go
│       ├── routes.go
│       └── validator.go
├── observables
│   └── log-middlaware.go
├── README.md
├── textinho
└── utils
    ├── context.go
    ├── entity.go
    ├── exception.go
    ├── pagination.go
    ├── route.go
    ├── search.go
    ├── sort.go
    ├── type.go
    └── validator.go

The following is a list of all the people that have contributed Nestjs monorepo boilerplate. Thanks for your contributions!

mikemajesty

License

It is available under the MIT license. License

Releases

No releases published

Packages

No packages published