Repository navigation
Architecture Overview
PersonalLearningPro is a multi-tenant educational platform built on a modern, multi-database architecture. It has transitioned from a Firebase-dependent model to a self-hosted, workspace-centric identity system.
-
client/: React application using Vite. Includes a unifiedAuthProviderfor session management. -
server/: Node.js/Express backend. Implements local auth, workspace tenancy, and AI orchestration. -
shared/: Zod schemas defining the platform's data contracts.
graph TB
subgraph "Client (React)"
UI["React Components"]
Ctx["AuthProvider<br/>(Local Session)"]
end
subgraph "Server (Express)"
Auth["Auth Service<br/>(JWT + Bcrypt)"]
Logic["Business Logic<br/>(Workspaces, Tests)"]
end
subgraph "Persistence"
PG["PostgreSQL<br/>(Identity, Tenancy)"]
Mongo["MongoDB<br/>(Content, Analytics)"]
Cass["Cassandra<br/>(Messaging)"]
end
UI --> Ctx
Ctx --> Auth
Auth --> PG
Logic --> Mongo
Logic --> Cass
All core transactional data—users, workspaces, memberships, and sessions—resides in PostgreSQL. This ensures relational integrity for multi-tenant workflows.
Flexible document storage is used for tests, question banks, and AI-generated analytics, allowing for rapid schema evolution.
High-throughput chat and activity streams are partitioned by channel in Cassandra (Astra DB) for horizontal scalability.
Authentication is now local. Sessions use HttpOnly Cookies containing JWT access tokens and database-backed refresh tokens.
The system follows a layered approach:
- Presentation: React frontend with a role-aware router.
- Application: Express API with workspace-scoped middleware.
- Domain: Unified Zod schemas for all databases.
- Infrastructure: Multi-database persistence layer.
sequenceDiagram
participant User as "User"
participant API as "Express API"
participant PG as "PostgreSQL"
participant Mongo as "MongoDB"
User->>API : "POST /api/auth/login"
API->>PG : "Verify User & Workspace"
API-->>User : "Set Session Cookies"
User->>API : "GET /api/tests (Auth Cookie)"
API->>API : "Verify JWT & Active Workspace"
API->>Mongo : "Fetch Workspace Content"
Mongo-->>API : "Test Data"
API-->>User : "JSON Response"
- Stateless Verification: JWTs allow the server to verify sessions without database hits on every request.
- Stateful Revocation: Refresh tokens in PostgreSQL allow for immediate session revocation and rotation.
-
CSRF & XSS Mitigation: Use of
HttpOnly,SameSite=Laxcookies and strict CSP headers.
PersonalLearningPro’s architecture is designed for scalability and data sovereignty. By centralizing identity in PostgreSQL while leveraging specialized NoSQL stores for content and messaging, the platform provides a robust, multi-tenant environment for educational collaboration.