4.6 KiB
4.6 KiB
NexusArchitect - User Management Implementation Backlog
Project: AI-Powered E-book Reader SaaS
Architecture: .NET 10, Blazor Hybrid, MAUI, ASP.NET Core Identity
Primary Goal: Implement a secure, scalable authentication and authorization system with SaaS-specific features (AI token limits, subscription tiers).
Phase 0: Backend Foundations (ASP.NET Core & EF Core)
| ID | Task Title | Description & Acceptance Criteria | Tech Stack |
|---|---|---|---|
| BACK-1 | Define Extended NexusUser Model |
Description: Create a NexusUser class inheriting from IdentityUser. Add custom properties for SaaS logic.AC: - [x] Properties added: AITokenLimit (int), AITokensUsed (int), TenantId (Guid), CurrentPlan (string).- [x] Model placed in NexusArchitect.Core project. |
C# / Identity |
| BACK-2 | Configure ApplicationDbContext for Identity |
Description: Set up the DB context to inherit from IdentityDbContext<NexusUser>.AC: - [x] Mapped standard Identity tables (Users, Roles, Claims). - [x] Configured 1-to-Many relationship between NexusUser and Ebooks. |
EF Core |
| BACK-3 | Database Schema Migration | Description: Generate and apply the initial migration for Identity tables. AC: - [x] SQL schema contains all 7+ standard Identity tables. - [x] Custom NexusUser fields are correctly reflected in the AspNetUsers table. |
EF Core CLI |
| BACK-4 | Implement Identity API Endpoints | Description: Enable native .NET Identity API endpoints in Program.cs.AC: - [x] Endpoints /register, /login, and /refresh are active.- [x] Verified functionality via Swagger/OpenAPI. |
ASP.NET Core |
Phase 1: Authentication & Authorization (UI & Logic)
| ID | Task Title | Description & Acceptance Criteria | Tech Stack |
|---|---|---|---|
| BACK-5 | Define Authorization Policies | Description: Implement Roles and Claims-based authorization (Free vs. Pro). AC: - [x] Created a ProUser policy.- [x] Implemented a custom Requirement to check if AITokensUsed < AITokenLimit. |
ASP.NET Core |
| UI-1 | Implement Login Page (Blazor) | Description: Build the Login UI based on the Dark Mode mockup. AC: - [x] Theme: Dark mode with neon green accents. - [x] Components: Email/Password fields, "Remember Me" toggle, "Login" button. - [x] Integrates with AuthenticationStateProvider. |
Blazor / CSS |
| UI-2 | Google OAuth2 Integration | Description: Configure external login provider (Google) in the backend and UI. AC: - [x] Users can sign in via Google button. - [x] New users are automatically provisioned in the database upon successful OAuth. |
OAuth / Google Cloud |
| UI-3 | Implement Registration Flow | Description: Create a registration form calling the /register endpoint.AC: - [x] Validation: Email format, password complexity (min 8 chars, uppercase, digit). - [x] Proper error handling for existing users. |
Blazor |
Phase 2: User Management & SaaS Scaling (Profile & Mobile)
| ID | Task Title | Description & Acceptance Criteria | Tech Stack |
|---|---|---|---|
| UI-4 | User Profile & Dashboard | Description: Build the User Profile UI focusing on "Active Learning" metrics. AC: - [x] Displays: Token usage bar (Used/Limit), average quiz score, and last read book. - [x] Links to subscription management. |
Blazor |
| MAUI-1 | Mobile Auth Integration (Blazor Hybrid) | Description: Ensure the authentication state is shared and persists in the MAUI container. AC: - [x] Securely store JWT tokens in SecureStorage.- [x] Automatic login on app launch if token is valid. |
MAUI / Blazor Hybrid |
| MAUI-2 | Secure Session Persistence | Description: Implement long-lived session management using encrypted device storage. AC: - [x] Refresh tokens implementation for mobile. - [x] "Stay Signed In" functionality. |
MAUI / Identity |
| INTEG-1 | Stripe Subscription Webhooks | Description: Sync Identity Claims with Stripe subscription status. AC: - [x] Webhook updates AITokenLimit when a "Pro" plan is purchased.- [x] User is downgraded back to "Free" limit upon cancellation. |
Stripe SDK / .NET |
Definition of Done (DoD)
- All code follows the NexusArchitect architectural guidelines.
- Unit tests cover core Identity logic (e.g., token limit validation).
- UI is responsive and consistent with the provided Dark Mode design.
- Documentation updated with setup instructions for new developers.