Giter VIP home page Giter VIP logo

rafaelfgx / architecture Goto Github PK

View Code? Open in Web Editor NEW
3.1K 267.0 787.0 37 KB

.NET 8, Angular 17, 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.

License: MIT License

C# 50.84% TypeScript 37.16% HTML 10.52% SCSS 1.48%
architecture solid clean-code dotnet dot-net csharp c-charp aspnetcore aspnet-core angular

architecture's Introduction

ARCHITECTURE

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.

PRINCIPLES and PATTERNS

  • 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

BENEFITS

  • 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.

TECHNOLOGIES

RUN

Command Line

Prerequisites

Steps

  1. Open directory source\Web\Frontend in command line and execute npm i.
  2. Open directory source\Web in command line and execute dotnet run.
  3. Open https://localhost:8090.
Visual Studio Code

Prerequisites

Steps

  1. Open directory source\Web\Frontend in command line and execute npm i.
  2. Open source directory in Visual Studio Code.
  3. Press F5.
Visual Studio

Prerequisites

Steps

  1. Open directory source\Web\Frontend in command line and execute npm i.
  2. Open source\Architecture.sln in Visual Studio.
  3. Set Architecture.Web as startup project.
  4. Press F5.
Docker

Prerequisites

Steps

  1. Execute docker compose up --build -d in docker directory.
  2. Open http://localhost:8090.

PACKAGES

Source: https://github.com/rafaelfgx/DotNetCore

Published: https://www.nuget.org/profiles/rafaelfgx

LAYERS

Web: Frontend and Backend.

Application: Flow control.

Domain: Business rules and domain logic.

Model: Data transfer objects.

Database: Data persistence.

WEB

FRONTEND

Service

It is the interface between frontend and backend and has logic that does not belong in components.

Guard

It validates if a route can be activated.

ErrorHandler

It provides a hook for centralized exception handling.

HttpInterceptor

It intercepts and handles an HttpRequest or HttpResponse.

BACKEND

Controller

It has no any logic, business rules or dependencies other than mediator.

APPLICATION

It has only business flow, not business rules.

Request

It has properties representing the request.

Request Validator

It has rules for validating the request.

Response

It has properties representing the response.

Handler

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.

Factory

It creates a complex object.

Any change to object affects compile time rather than runtime.

DOMAIN

It has no any references to any layer.

It has aggregates, entities, value objects and services.

Aggregate

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.

Entity

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.

Value Object

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.

Services

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.

MODEL

It has properties to transport and return data.

DATABASE

It encapsulates data persistence.

Context

It configures the connection and represents the database.

Entity Configuration

It configures the entity and its properties in the database.

Repository

It inherits from the generic repository and only implements specific methods.

architecture's People

Contributors

rafaelfgx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.