If the project has been useful to you, please give it a star. Thank you!
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:
Technologies & Libraries:
- ASP.NET Core 8.0
- Entity Framework Core 8
- FastEndpoints 5.22.0
- MediatR 12.2.0
- FluentResults 3.15
- Optional 4.0
Databases:
- Check out source code from the repository.
- 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
- Create empty database.
- Go to the appsettings.json file and set the connection string in the Sql:ConnectionString section.
- Run the migrations defined in the SuperNote.DataAccess project.
- Run SuperNote.WebApi project.
The application uses a PostgreSQL database, but it can be easily changed it in the DataAccessServices.cs file if needed.
The project implements a clean architecture. Here's its structure:
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.
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.
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.