https://github.com/tty47/go-ddd
DDD structure for Go projects
https://github.com/tty47/go-ddd
Last synced: about 2 months ago
JSON representation
DDD structure for Go projects
- Host: GitHub
- URL: https://github.com/tty47/go-ddd
- Owner: tty47
- Created: 2020-11-06T23:35:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-04T12:42:46.000Z (10 months ago)
- Last Synced: 2025-02-14T10:43:46.587Z (3 months ago)
- Language: Go
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## DDD
### Domain Layer
We will consider the domain first.
The domain has several patterns. Some of which are:
*Entity*, *Value*, *Repository*, *Service*, and so on.
- Defined the API business logic in our domain.
- Currently we are going to use Entity and Repository#### Entity
Here we define the Schema of things, the models
#### Repository
The repository defines a collection of methods that the infrastructure implements.
The methods are defined in an interface. These methods will later be implemented in the infrastructure layer.---
### Infrastructure Layer
This layer implements the methods defined in the repository.
The methods interact with the database or a third-party API.
This article will only consider database interaction.---
### Application Layer
The application connects the domain and the interfaces layers.
- P.e: The UserApp struct has the UserRepository interface, which made it possible to call the user repository methods.---
### Interfaces Layer
The interfaces is the layer that handles HTTP requests and responses.
This is where we get incoming requests for authentication, user-related stuff, and food-related stuff.
We can also create middleware in that side.---