Skip to content

Web API solution template which is built on Clean Architecture using .Net Core for bookmark dashboard project

License

Notifications You must be signed in to change notification settings

es-hackathon/bookmark-dashboard-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Core Codacy Badge GitHub license

Bookmark Dashboard Web API


Logo

Bookmark Dashboard Web API

Web API solution template which is built on Clean Architecture using .Net Core for bookmark dashboard project!
Explore the docs »

Download · Report Bug · Request Feature

Table of Contents

About the Project

Web API solution template which is built on Clean Architecture using .Net Core for bookmark dashboard project!

Layer Dependencies

layer dependencies

(open on draw.io)

reference code project

Domain layer

Domain Layers (Core layer) is implemented in center and never depends on any other layer. Therefore, what we do is that we create interfaces to Persistence layer and these interfaces get implemented in the external layers. This is also known and DIP or Dependency Inversion Principle

Persistence layer

In Persistence layer where we implement reposistory design pattern. In our project, we have implement Entityframework which already implements a repository design pattern. DbContext will be UoW (Unit of Work) and each DbSet is the repository. This interacts with our database using dataproviders

Application layer

Application layer where we can implement business logic. For OLAP/OLTP process, we can implement CQRS design pattern. In our project, we have implemented CQRS design pattern on top of Mediator design pattern via MediatR libraries

In case you want to implement email feature logic, we define an IMailService in the Service Layer. Using DIP, it is easily possible to switch the implementations. This helps build scalable applications.

Infrastructure Layer

In this layer, we add our third party libraries like JWT Tokens Authentication or Serilog for logging, etc.

Cross cutting concern

In this layer, we add caching and other logic which will be common to all layer

Presentation Layer

This can be WebApi or UI.

Layer examples

layer examples

(open on draw.io)

Solution Structure

layer examples

DB design

DB design

How to Run

Update Configuration

Database

  • Update Connection Strings:

    Project Configuration File Configuration Key
    Bookmark.WebApi appsettings.json ConnectionStrings:BookmarkConn
    ConnectionStrings:IdentityConnection
    Bookmark.Web appsettings.json ConnectionStrings:BookmarkConn
  • Run Migration:

    • Option 1: Using dotnet cli:
      • Install dotnet-ef cli:
        dotnet tool install --global dotnet-ef --version="3.1"
        
      • Navigate to Bookmark.WebApi and run these commands:
        dotnet ef migrations add Initial-commit-Application --context ApplicationDbContext -o Migrations/Application
        dotnet ef migrations add Identity-commit --context IdentityContext -o Migrations/Identity
        dotnet ef database update --context ApplicationDbContext 
        dotnet ef database update --context IdentityContext 
        
    • Option 2: Using Package Manager Console:
      • Set Bookmark.WebApi as StartUp Project
      • Open Package Manager Console, select Bookmark.WebApi.Persistance as Default Project
      • Run these commands:
        PM> add-migration Initial-commit-Application -Context ApplicationDbContext -o Migrations/Application
        
        PM> update-database -Context ApplicationDbContext 
      • Open Package Manager Console, select Bookmark.WebApi.Infrastructure as Default Project
      • Run these commands:
        PM> add-migration Identity-commit -Context IdentityContext -o Migrations/Identity
        PM> update-database -Context IdentityContext 

Run or Debug the Solution

Application URLs:

Project Launch URL Server URL
API https://localhost:44396/OpenAPI/index.html https://bookmarkwebapi20200916112033.azurewebsites.net/OpenAPI/index.html
Health check https://localhost:44329/healthchecks-ui#/healthchecks https://bookmarkweb20200916110752.azurewebsites.net/healthchecks-ui#/healthchecks
React UI http://localhost:3000 https://bookmark-dashboard.web.app/

Technology stack

Architecture Pattern

Design Pattern

  • CQRS design pattern
  • Repository design pattern and UOW (Already implemented in EF Core, where DbSet acts as Repository and DbContext acts as UOW)
  • Mediator design pattern

Features

  • Web API
  • Entityframework Core - Code First
  • Dataseeding
  • Custom Exceptionn Handler
  • Automapper
  • Fluent validation
  • Serilog
  • Swagger UI
  • Healthcheck UI
  • InMemory caching
  • API Versioning
  • User Auditing (default config)
  • Enabling CORS
  • Mailkit (Mail service)
  • Miniprofiler

Testing

  • Unit testing via NUnit
  • Integration testing via NUnit

Authentication

  • OAuth2 (via auth0.org)
  • JWT Authentication

UI

  • MVC Core
  • React-redux
  • React widget
  • Kibana

Licence Used

[![MIT License][license-shield]][license-url]

See the contents of the LICENSE file for details

About

Web API solution template which is built on Clean Architecture using .Net Core for bookmark dashboard project

Resources

License

Stars

Watchers

Forks

Packages

No packages published