DEV Community

loading...

Micro service architecture in .NetCore

silentrobi profile image Mohammad Abu Musa RABIUL Updated on ・2 min read

In this project we are going to develop micro service based Blog web api. The project is divided into several micro services that are Identity Server, BlogApi, Notification Server and Api Gateway.

Project Overview

The backend server of the application has an Api Gateway receives and manages all the API calls from the client application and route them to appropriate micro services.

Identity micro service works for authorizing client (mobile/ web) application to access Blog Api through user authentication. The identity server uses OAuth 2.0 and OpenID protocol. I will discuss detail about identity server in separate post.

There is also a notification service that sends notification to user when any notification event is triggered by identity and blog api services. RabbitMq message broker is used to exchange these event messages to notification service. For an example, when a new user is being registered by Identity server then a new event message is generated and sent through RabbitMq message broker. Notification server receives that message and sends email notification to the newly created user's email account about successful registration into system.

Note: Current implementation only supports email notification event for identity server.

All the micro services here are running as docker containers.
The following diagram shows overall micro service architecture.

Alt Text

Backend Server Workflow

  1. The client (Web / mobile client) initiates an authentication request, api gateway redirects the request to identity server. Identity server authenticates the client and returns a login portal to client application. User then uses his/her login credentials. Identity server validates user credentials and authorize client application on behalf of user with access token. This access token will be used to access blog api.
  2. Client attaches access token to subsequent requests made to access blog api resource server through api gateway. The Blog Api server validates the access token and fulfill the request depending on client authorization rights.

The project is separated into 6 parts. You can reach each one of them from the links below.

  1. Blog Api
  2. Identity Server
  3. Notification Service
  4. Api Gateway
  5. Blog backend application (all in together)
  6. React Sample Client

Discussion (0)

Forem Open with the Forem app