System Design

Identity Platform Architecture

Layered architecture with CQRS, domain-driven design, and comprehensive security patterns.

System Overview

Next.js 16

React 19

.NET 10 API

ASP.NET Core

Endpoints

MediatR

Domain

SQL Server

EF Core 10

Backend Architecture

1

Endpoints Layer

RESTful API endpoints organized by feature. Versioned routes (/api/v1.0/) with Swagger documentation.

2

CQRS Handlers

MediatR command and query handlers. Pipeline behaviors for logging, validation, and exception handling.

3

Domain Layer

Entity models with business logic. IAuditable and ISoftDeletable interfaces for cross-cutting concerns.

4

Persistence Layer

Entity Framework Core with ApplicationDbContext. Automatic audit field population and query filters.

5

Background Services

RefreshTokenCleanupService for expired token removal. WebhookDeliveryService for async event delivery.

6

Security Pipeline

Dual JWT signing (HS256/RS256) with JWKS endpoint, rate limiting, security headers, and Data Protection API.

Project Structure

# Rdn.Identity solution structure

rdn-identity/

src/

Rdn.Identity.Api/

Program.cs           # Application entry point

Server/Startup.cs     # Service configuration

Endpoints/            # Feature-based endpoints

appsettings.json      # Configuration

Rdn.Identity.Domain/

Entities/             # User, Customer, Role, etc.

Core/Persistence/     # ApplicationDbContext

Events/               # Domain events

Rdn.Identity.Api.Tests/

Integration/          # Full flow tests

Handlers/             # Unit tests

Rdn.Identity.Domain.Tests/

Entities/             # Entity behavior tests

rdn-identity-web/

app/                  # Next.js App Router

components/           # React components

lib/                  # API client, types

Frontend Architecture

(auth)

Public Routes

  • /login - User login
  • /register - Registration

(workspace)

Protected

  • /dashboard - User home
  • /profile - User profile

(admin)

Role-Protected

  • /admin/users - User mgmt
  • /admin/customers

API Client

lib/api.ts

  • JWT injection
  • HTTP-only cookies

Technology Stack

Backend

.NET 10
ASP.NET Core
EF Core 10.0
MediatR 14.0
FluentValidation 12.1
AutoMapper 16.0
Serilog 10.0
Autofac 9.0

Frontend

Next.js 16
React 19
TypeScript 5.9
Tailwind CSS 4
React Icons
App Router

Quick Start

1

Clone Repo

git clone github.com/...
2

Configure

Edit appsettings.json
3

Run API

dotnet run
4

Run Web

npm run dev