Code Monkey home page Code Monkey logo

go-service-boilerplate-ca's Introduction

Getting started

To run this app, execute docker-compose -f ./deploy/dev/docker-compose.dev.yaml up -d

Then run the cmd/service entrypoint.

Service Modules

Application

The UseCases and their implementations are placed here. For example, /auth/login/login.go.

Paths are built following the Screaming Architecture.

Domain

This layer encapsulates the Entity, VO, Aggregate Root, and Domain Service Logic. It provides the definition of the Repository (Gateway/Provider) interfaces.

Infrastructure

This layer contains the implementation of the repositories from the domain (using Postgres in this example), as well as crosscutting (shared) client packages.

Interface

This is the delivery layer that can include Message Broker consumers, gRPC, GraphQL servers, etc.

Core

This includes base definitions such as domain errors, usecase or entity base, validation utils, shared DTOs (pagination parameters/results), constants, and interfaces for cross-module dependencies (such as logger, cryptography, config properties, etc).

Infrastructure interface matching

The Go way usually tells us to define the dependency interface above the unit constructor and mocking in each module which depends on it. It causes code duplication and inconsistency.

Since the repository interfaces are defined once in the domain layer, the problem is solved.

The infrastructure implementation constructor signature must define the return type as the domain repository interface. This ensures that the code will not compile if there are changes in the domain interface signatures, and it clearly indicates the location of the implementation of the domain interface. This approach makes it easier for new code contributors to get started and reduces the time required to understand the architecture.

go-service-boilerplate-ca's People

Contributors

fallenmanrisesup avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.