Giter VIP home page Giter VIP logo

clean-architecture's Introduction

Clean Architecture Web API - ASP.NET Core

This project is an example of implementing Clean Architecture in a Web API using ASP.NET Core. It is a starting point for building ASP.NET Core Web API applications following Clean Architecture principles. It aims to provide a well-defined project structure that separates concerns into different layers, making the application easier to manage, develop, and test.

Give it a Star !!!⭐

If you find this project useful helpful as a starting template in implementing Clean Architecture in ASP.NET Core, please give it a star, on GitHub to help others developers discover it! Thanks

Table of Contents#

-Introduction to Clean Architecture

Introduction to Clean Architecture

Clean Architecture is a software design philosophy that separates the elements of a project into ringed levels, promoting the independence of system components. This approach ensures that the system is easy to maintain and evolve, particularly in complex applications with extensive business rules.

At the heart of Clean Architecture is the principle of dependency inversion. Dependencies flow from the outer layers (mechanisms such as UI, frameworks, and tools) towards the inner layers (policies like Entities and Use Cases), ensuring that the core business logic remains independent of external frameworks and technology. This separation of concerns makes the system more flexible and adaptable to changes in technology or business requirements.

Features

  • Clean Architecture based on Domain-Driven Design principles
  • Use of Entity Framework Core for data access
  • Swagger/OpenAPI for API documentation
  • Unit and Integration Tests

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them:

Before you begin, ensure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/ulomaramma/clean-architecture.git
    
  2. Navigate to the project directory:

    cd clean-architecture
    
  3. Install dependencies:

    dotnet restore
  4. Update the database connection string in appsettings.json within the Presentation Layer project.

  5. Apply the migrations to your database:

    dotnet ef database update
  6. Run the Application

    dotnet run
    

Architecture Overview

Clean Architecture is centered around the Domain and Application layers, promoting loose coupling and separation of concerns. This project is structured as follows:

Domain Layer: Contains all entities, enums, exceptions, interfaces, types, and logic specific to the domain problem this project is solving.

Application Layer: Houses the application logic and defines the interfaces that are implemented by the outside layers. Depends on the domain layer but has no dependencies on any other layer or project.

Infrastructure Layer: Implements external concerns such as database access, file system access, network calls, etc.

Presentation Layer: In this case, the ASP.NET Core Web API, responsible for delivering HTTP responses to the client, parsing requests, and handing them off to the application layer for processing.

Overview of the Project Structure is shown below

image

Usage

After running the application, navigate to http://localhost:Port/swagger to see the API documentation and test the endpoints.

How to Contribute

We welcome contributions! If you'd like to improve the guide, add examples, or correct any mistakes, please feel free to fork the repository and submit a pull request.

Fork the repository.

  1. Create a new branch for your feature (git checkout -b feature/NewFeature).
  2. Commit your changes (git commit -am 'Add some NewFeature').
  3. Push to the branch (git push origin feature/NewFeature).
  4. Open a Pull Request

Thank you for checking out this guide. Don't forget to star the project if it helped you!

clean-architecture's People

Contributors

ulomaramma 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

Watchers

 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.