Code Monkey home page Code Monkey logo

ambereggapi's Introduction

AmberEggApi - .NET 8 Open API Template

This is a starting point (TEMPLATE) for Clean Architecture with .NET 8. Clean Architecture is just the latest in a series of names for the same loosely-coupled, dependency-inverted architecture. You will also find it named hexagonal, ports-and-adapters, or onion architecture.

Summary

This project AmberEggApi cover concepts about:

.Net Version

3rd Party NuGet Packages

  • Autofac
  • AutoMapper
  • FluentAssertions
  • NUnit
  • Swagger

Repository

  • Entity Framework + InMemory + Data Migration

Development Tools

  • Visual Studio Code
  • GIT Bash
  • GitHub(Repos, Actions)
  • MSSQL Server Management Studio
  • Swagger Editor

How to clone this project

cd\
mkdir repo
cd repo
git clone https://github.com/diegosmorf/AmberEggApi.git

Cloning the structure using your namespace

powershell .\clone-to-your-namespace.ps1 "Your.Namespace"
cd ..\Your.Namespace

Restore, Build and Test

dotnet restore
dotnet build
dotnet test
dotnet run --p AmberEggApi.WebApi

you can access this API via browser: http://localhost:5200/swagger

0 - Core

Api.Common.CQRS.Core is a basic set of interfaces for building a command and event driven CQRS application.

  • Commands are created and dispatched by the application,
  • They are received by command handlers which apply behaviors on the domain model
  • Which generates events
  • Collected by the command handler
  • Then published
  • Received by event handlers which update the read/query model
  • Consumed by the front end of the application via query services.

1 - Domain

Domain commands and handlers specifically affect the domain model's aggregate roots.

Some of the basic premises of CQRS are modeled by these interfaces either explicitly or in their documentation.

  • Commands and events should be immutable
  • The query model should be immutable, except from the event handlers responsible for updating them when triggered by events published from domain model changes
  • Domain commands and handlers should only affect a single aggregate root instance in the domain model - more complex operations should be handled by sagas

2 - Application Service

This project will expose domain features to external world (e.g.: API, Apps, Windows Services, Desktop apps) and it is responsible for business rules as well.

3 - Infrastructure

This project contains implementations of the interfaces defined in the inner layers of the solution. They may be dependent on external libraries or resources. Note that the implementations themselves are internal and should only be used for injection via their implemented interfaces.

4 - Entry Points

API project exposing business controllers.

5 - Tests

DomainTest: NUnit will test ApplicationService classes with no external dependencies. All Infrastructure dependencies must be mocked.

IntegrationTests:Longer running, more involved tests that test the integration of multiple components and external dependencies as Database/Email.

You shouldn't find:

  • Binaries committed to source control.
  • Unnecessary project or library references or third party frameworks.
  • Many "try" blocks - code defensively and throw exceptions if something is wrong.
  • Third party APIs exposed via public interfaces.

ambereggapi's People

Contributors

diegodocs avatar julioarruda avatar

Stargazers

 avatar Carlos Oliveira avatar Claudiney Queiroz avatar Jonas R. Denardi avatar Alexandre Castro avatar gerudaeta avatar  avatar Israel Santiago avatar  avatar Everton Miranda de Oliveira avatar Henrique Mauri avatar Rahul avatar Alex Sander Rodrigues Oliveira avatar Bruno Mendes avatar Allan Barros avatar Carlos Forti avatar Helamã Borges avatar Adilson Ribeiro avatar  avatar Lucas Gustavo Soares avatar  avatar Raphael Divetta Bronzo avatar Bruno Tinoco avatar Bruno Araujo avatar Eric Groppe Lepore Marques avatar

Watchers

James Cloos avatar  avatar Bruno Araujo 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.