How mibnekhalid/nodejsuserportal works
Main Components
a) Client-Side Layer:
• Public Assets (Static Files)
• CSS Styles
• Client-side Scripts
• Images
• Views (Nunjucks Templates)
• Main Pages
• Static Pages
• Templates
• Notice Pages
• Error Pages
b) Server-Side Layer:
• Express.js Server (index.js)
• Authentication System
• Route Handlers
• Session Management
• Role-Based Access Control (RBAC)
c) Database Layer:
• PostgreSQL Database
• Users Table
• Session Table
Component Relationships
• Client browsers connect to the Express.js server
• Server routes handle different endpoints (auth.js, main.js)
• Database pool manages connections to PostgreSQL
• Session management between server and database
• Role-based access control flow from client request through authentication to protected resources
Specific Implementation Details
• Cookie Management System (username, userRole, donationNotice)
• Feedback System (storing in JSON)
• File Storage System (for donation proofs)
• Template Engine (Nunjucks)
• Access Control Middleware
• API Endpoints (both GET and POST)
[Client Browser]
• ↓
[Static Assets] → [Nunjucks Templates]
• ↓
[Express Server]
• ↓
[Route Handlers] ← [Authentication/RBAC]
• ↓
[Database Pool]
• ↓
[PostgreSQL DB]
Important Elements to Highlight
• Role hierarchy (SuperAdmin → NormalAdmin → NormalUser → Guest → Demo)
• Session management flow
• Template rendering process
• API endpoints and their relationships
• File storage system for donations
• Feedback storage system