Coder Social home page Coder Social logo

super-note-api's Introduction

.NET 8 REST API Project That Implements Clean Architecture and Domain-Driven Design.

Give a Star! ⭐

If the project has been useful to you, please give it a star. Thank you!

Description

SuperNote is the initial version of a note-taking app (such as OneNote or Notion). There is no front-end at this time. The project contains a few REST API endpoints:

image

Technologies & Libraries:

  1. ASP.NET Core 8.0
  2. Entity Framework Core 8
  3. FastEndpoints 5.22.0
  4. MediatR 12.2.0
  5. FluentResults 3.15
  6. Optional 4.0

Databases:

  1. PostgreSQL
  2. Entity Framework Core 8 In-Memory Database

How do I run the application?

  1. Check out source code from the repository.
  2. Run SuperNote.WebApi project.

You'll see Swagger.

By default, the project is configured to use the Entity Framework In Memory database. So the above two steps will be enough if you want to have a quick play around with the app.

If you want to use a real database, then

  1. Create empty database.
  2. Go to the appsettings.json file and set the connection string in the Sql:ConnectionString section.
  3. Run the migrations defined in the SuperNote.DataAccess project.
  4. Run SuperNote.WebApi project.

The application uses a PostgreSQL database, but it can be easily changed it in the DataAccessServices.cs file if needed.

Project Structure

The project implements a clean architecture. Here's its structure:

Screenshot 2024-02-06 193709

Now let's talk about each project separately.

SuperNote.Domain

The domain layer contains domain entities, domain events, repository interfaces, domain errors, and other core application logic.

SuperNote.Application (Use cases)

The application layer implements the SuperNote application use cases using Commands and Queries. It also implements event handlers for domain events.

In addition, the application layer is where abstractions for caching, messaging, authentication, email notifications, and so on are placed.

SuperNote.Infrastructure

Currently, the infrastructure layer contains a single project, which is DataAccess. This project implements repositories, migrations, and other things related to data access.

In addition, the infrastructure layer must implement the caching, messaging, authentication, email notification abstractions that are defined in the application layer.

SuperNote.WebApi (Presentation)

This is the entry point to the application. It implements a set of REST APIs that clients can use to interact with the application.

Key Patterns

REPR Design Pattern

REPR stands for Request, an Endpoint, and a Response. The pattern enforces the Single Responsibility Principle for your endpoints. The basic idea is that each request is handled by a separate class.

Result Pattern

There are two fundamental ways for handling invalid input in your domain: throw an exception or return an object indicating the error. The SuperNote application uses the second approach, returning a Result object from the domain and application layers. You can read about the reasons for choosing one or the other here, here or here.

super-note-api's People

Contributors

omarfut avatar sashamarfuttech avatar mucahitimre avatar

Stargazers

Andy avatar Bilawal Hussain avatar Jacek P avatar  avatar Kamil Łucyszyn avatar Hasan Türkmen avatar  avatar Mikael Jokela avatar  avatar  avatar louis avatar  avatar Anderson Fernandes do Nascimento avatar Patrick Couturier avatar  avatar Andriy Bezkorovayny avatar thomas gooch avatar  avatar Andras avatar Ivan Shevtsiv avatar Can Canbolat avatar  avatar  avatar Tuan Cao avatar Kilian Stallinger avatar Ebrahim Mansur avatar Alexander R Torrijos avatar  avatar zeeshan asghar avatar Rui avatar Anton Borodulin 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.