-
Notifications
You must be signed in to change notification settings - Fork 537
Folder structure
This boilerplate uses a folder structure and logical architecture focused on separation of concerns based in Domain-driven design and Clean architecture. Instead of the classical controllers
/models
/services
folders, we now have layers inside the src
folder. Each of the folder layers is scoped by a namespace regarding the concern it is about (like user
, errors
, logging
and so on):
The application layer is responsible to mediate between your input interfaces and your business domain. In this layer we'll have the use cases of your application (created extending the Operation
class, there's more about it in the Patterns recommendations and operations section) and your application services (like a MailService
that communicates with a MailchimpService
from the infrastructure layer).
Here you'll define your business domain classes, functions and services that compose your domain model. All your business rules should be declared in this layer so the application layer can use it to compose your use cases.
This is the lowest of the layers. In the infra layer you'll have the communication with what is outside your application, like the database (check the repository pattern section on Patterns recommendations and operations), mail services and direct communication with frameworks.
This folder contains all the entry points for your application. From the beginning here's where your Express controllers will be (inside the interfaces/http
folder).