This project is an example of architecture using new technologies and best practices.
The goal is to learn and share knowledge and use it as reference for new projects.
- Clean Architecture
- Clean Code
- SOLID Principles
- KISS Principle
- DRY Principle
- Fail Fast Principle
- Common Closure Principle
- Common Reuse Principle
- Acyclic Dependencies Principle
- Mediator Pattern
- Result Pattern
- Folder-by-Feature Structure
- Separation of Concerns
- Simple and evolutionary architecture.
- Standardized and centralized flow for validation, log, security, return, etc.
- Avoid cyclical references.
- Avoid unnecessary dependency injection.
- Segregation by feature instead of technical type.
- Single responsibility for each request and response.
- Simplicity of unit testing.
Command Line
- Open directory source\Web\Frontend in command line and execute npm run restore.
- Open directory source\Web in command line and execute dotnet run.
- Open https://localhost:8090.
Visual Studio Code
- Open directory source\Web\Frontend in command line and execute npm run restore.
- Open source directory in Visual Studio Code.
- Press F5.
Visual Studio
- Open directory source\Web\Frontend in command line and execute npm run restore.
- Open source\Architecture.sln in Visual Studio.
- Set Architecture.Web as startup project.
- Press F5.
Docker
- Execute docker compose up --detach --build --force-recreate --remove-orphans.
- Open http://localhost:8090.
Source: https://github.com/rafaelfgx/DotNetCore
Published: https://www.nuget.org/profiles/rafaelfgx
Web: Frontend and Backend.
Application: Flow control.
Domain: Business rules and domain logic.
Model: Data transfer objects.
Database: Data persistence.
It is the interface between frontend and backend and has logic that does not belong in components.
It validates if a route can be activated.
It provides a hook for centralized exception handling.
It intercepts and handles an HttpRequest or HttpResponse.
It has no any logic, business rules or dependencies other than mediator.
It has only business flow, not business rules.
It has properties representing the request.
It has rules for validating the request.
It has properties representing the response.
It is responsible for the business flow and processing a request to return a response.
It call factories, repositories, unit of work, services or mediator, but it has no business rules.
It creates a complex object.
Any change to object affects compile time rather than runtime.
It has no any references to any layer.
It has aggregates, entities, value objects and services.
It defines a consistency boundary around one or more entities.
The purpose is to model transactional invariants.
One entity in an aggregate is the root, any other entities in the aggregate are children of the root.
It has unique identity. Identity may span multiple bounded contexts and may endure beyond the lifetime.
Changing properties is only allowed through internal business methods in the entity, not through direct access to the properties.
It has no identity and it is immutable.
It is defined only by the values of its properties.
To update a value object, you must create a new instance to replace the old one.
It can have methods that encapsulate domain logic, but these methods must have no side effects on the state.
It performs domain operations and business rules.
It is stateless and has no operations that are not a part of an entity or value object.
It has properties to transport and return data.
It encapsulates data persistence.
It configures the connection and represents the database.
It configures the entity and its properties in the database.
It inherits from the generic repository and only implements specific methods.