Adds reverse engineering docs and adds new aidlc feature for front-end development
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
# System Architecture
|
||||
|
||||
## System Overview
|
||||
|
||||
SlpModularCms is a modular, ASP.NET Core-based CMS platform. The backend is structured as a monolith-with-modules: a single API host (`SlpModularCms.Api`) that dynamically loads feature modules at startup. Each module is self-contained and registers its own services and HTTP middleware. Persistence is handled via Entity Framework Core with SQL Server. Authentication uses JWT Bearer tokens with refresh token rotation.
|
||||
|
||||
The frontend is a React SPA (to be built) that communicates with the API via REST/JSON. The example app (from ZIP) provides the design foundation: Vite + React Router v7 + shadcn/ui + Tailwind CSS v4 with primary color `#ac0000`.
|
||||
|
||||
## Architecture Diagram
|
||||
|
||||
```
|
||||
+--------------------------------------------------+
|
||||
| Client Layer |
|
||||
| +--------------------------------------------+ |
|
||||
| | React SPA (SlpModularCms.Frontend) | |
|
||||
| | Vite + React Router v7 + shadcn/ui | |
|
||||
| | Tailwind CSS v4 (#ac0000 theme) | |
|
||||
| +--------------------------------------------+ |
|
||||
+---------------------------+----------------------+
|
||||
| HTTP REST / JSON
|
||||
+---------------------------v----------------------+
|
||||
| API Layer |
|
||||
| +--------------------------------------------+ |
|
||||
| | SlpModularCms.Api (ASP.NET Core) | |
|
||||
| | - JWT Bearer Auth Middleware | |
|
||||
| | - CORS, Swagger/OpenAPI | |
|
||||
| | - Module registration pipeline | |
|
||||
| +--------------------------------------------+ |
|
||||
| |
|
||||
| +------------------+ +---------------------+ |
|
||||
| | Identity Module | | Availability Module | |
|
||||
| | - AuthController| | - AvailabilityCtrl | |
|
||||
| | - SetupCtrl | | - PersistentService | |
|
||||
| | - UsersCtrl | | - CircuitBreaker | |
|
||||
| +------------------+ +---------------------+ |
|
||||
+---------------------------+----------------------+
|
||||
|
|
||||
+---------------------------v----------------------+
|
||||
| Core Layer |
|
||||
| +--------------------------------------------+ |
|
||||
| | SlpModularCms.Core | |
|
||||
| | - ApplicationDbContext (EF Core) | |
|
||||
| | - Domain Entities | |
|
||||
| | - Identity Services (Auth, Setup, Invite) | |
|
||||
| | - IModule interface + ModuleInfo | |
|
||||
| +--------------------------------------------+ |
|
||||
+---------------------------+----------------------+
|
||||
|
|
||||
+---------------------------v----------------------+
|
||||
| Data Layer |
|
||||
| +--------------------------------------------+ |
|
||||
| | SQL Server Database | |
|
||||
| | - ASP.NET Identity tables | |
|
||||
| | - RefreshTokens | |
|
||||
| | - Invitations | |
|
||||
| | - GlobalAvailabilityState | |
|
||||
| +--------------------------------------------+ |
|
||||
+--------------------------------------------------+
|
||||
```
|
||||
|
||||
## Component Descriptions
|
||||
|
||||
### SlpModularCms.Api
|
||||
- **Purpose**: Web API host and application entry point
|
||||
- **Responsibilities**: Bootstrap, module loading, middleware pipeline, CORS, Swagger
|
||||
- **Dependencies**: SlpModularCms.Core, SlpModularCms.Modules.Identity, SlpModularCms.Modules.Availability
|
||||
- **Type**: Application
|
||||
|
||||
### SlpModularCms.Core
|
||||
- **Purpose**: Shared domain layer
|
||||
- **Responsibilities**: Domain entities, EF Core DbContext, authentication services, module interface
|
||||
- **Dependencies**: EF Core, ASP.NET Identity, SQL Server provider
|
||||
- **Type**: Shared Library
|
||||
|
||||
### SlpModularCms.Modules.Identity
|
||||
- **Purpose**: Identity and user management module
|
||||
- **Responsibilities**: HTTP endpoints for auth, setup, and user invitation flows
|
||||
- **Dependencies**: SlpModularCms.Core
|
||||
- **Type**: Application Module
|
||||
|
||||
### SlpModularCms.Modules.Availability
|
||||
- **Purpose**: System availability tracking module
|
||||
- **Responsibilities**: Exposes system status, allows owners to update it, caches with circuit breaker
|
||||
- **Dependencies**: SlpModularCms.Core
|
||||
- **Type**: Application Module
|
||||
|
||||
### SlpModularCms.Frontend (To Be Built)
|
||||
- **Purpose**: Admin SPA for CMS management
|
||||
- **Responsibilities**: Login, dashboard, user management, CMS content management, availability status display
|
||||
- **Dependencies**: SlpModularCms.Api (REST)
|
||||
- **Type**: Frontend Application
|
||||
|
||||
## Data Flow
|
||||
|
||||
```
|
||||
Login Flow:
|
||||
Browser -> POST /auth/login -> AuthController
|
||||
-> AuthService.AuthenticateAsync()
|
||||
-> PasswordHasher validates credentials
|
||||
-> JwtService generates access + refresh tokens
|
||||
-> Returns {accessToken, refreshToken}
|
||||
|
||||
Invite Flow:
|
||||
Admin -> POST /users/invite -> UsersController
|
||||
-> InvitationService.CreateInvitationAsync()
|
||||
-> Stores Invitation entity with token
|
||||
-> Returns invite link
|
||||
|
||||
New User Setup:
|
||||
User -> POST /users/complete-setup -> UsersController
|
||||
-> InvitationService.CompleteInvitationAsync()
|
||||
-> Sets password, activates account
|
||||
```
|
||||
|
||||
## Integration Points
|
||||
- **External APIs**: None currently
|
||||
- **Databases**: SQL Server (via EF Core)
|
||||
- **Third-party Services**: None currently
|
||||
|
||||
## Infrastructure Components
|
||||
- **Deployment Model**: Single API process + React SPA (separate deploy or static files)
|
||||
- **Authentication**: JWT Bearer tokens (HS256 or RS256 based on JwtSettings config)
|
||||
- **Database Migrations**: EF Core Code-First migrations in SlpModularCms.Core/Migrations/
|
||||
Reference in New Issue
Block a user