How nasablueberry/alo works
1. Overall shape
- This is a two-tier MERN system: a Node/Express backend exposes JSON APIs, and a React/Vite frontend consumes them.
- The domain is scholarship aid management for Bangladesh: student intake, provider programs, application review, disbursement, and admin oversight.
2. Backend boundary
- The backend is the system of record and contains the business rules.
- It is organized into controllers for request handling, routes for API wiring, middleware for auth/validation/error handling, services for domain logic, and models for MongoDB persistence via Mongoose.
3. Frontend boundary
- The client is a single-page app with role-specific pages for student, provider, and admin users.
- Shared UI shells, dashboards, and context providers handle auth state, theme, and language; the app is not server-rendered.
4. Identity and role model
- Authentication is JWT-based and role-aware: student, provider, and admin.
- Protected routes on the backend rely on auth middleware; the frontend likely gates navigation using AuthContext.
- Separate registration flows exist for students and providers, with admin accounts created via a script or seed data.
5. Core domain data
- MongoDB collections model the main entities: User, StudentProfile, AidProvider, ScholarshipProgram, Application, Disbursement, Notification, AuditLog, and withdrawal-related records.
- This separation indicates a clean domain boundary between identity, profile data, program data, application workflow, and financial actions.
6. Student intake and document handling
- Student registration includes academic and regional information plus document upload.
- File uploads are handled by multer, and uploaded PDFs are stored locally under backend/uploads, which means document persistence is filesystem-based rather than object storage-based.
7. Program and provider workflow
- Providers can create, update, and close scholarship programs with eligibility criteria and fund allocation.
- The provider-facing pages cover dashboard, program creation, application review, rejected applicants, and provider profile management.
- Program management is a major bounded context separate from student application management.
8. Application review pipeline
- Applications move through an eligibility and ranking pipeline before approval/rejection.
- Services such as eligibility, applicantRanking, financialNeedScore, and duplicateDetection indicate that review is not purely manual; the backend computes decision support and conflict warnings.
- The application route set supports applying, listing personal applications, viewing program applicants, and reviewing submissions.
9. Admin operations
- Admin functionality is broader than CRUD: it includes student verification, at-risk analysis, fraud/rejection review, fund utilization visibility, and report generation.
- The admin dashboard pages mirror these operational concerns and are backed by dedicated admin/analytics controllers.
10. Risk, fraud, and auditability
- The presence of dropoutRisk, duplicateDetection, and auditLog services shows that the system actively evaluates student risk and aid conflicts.
- Audit logging is an important cross-cutting concern, likely triggered by sensitive operations such as approval, disbursement, and verification.
11. Notifications and email
- Notifications are modeled in the database and exposed through a dedicated API.
- Email delivery is handled through utility code and likely uses SMTP via Nodemailer, making notification delivery a side effect of important workflow events.
12. Reporting and analytics
- There is a distinct analytics/reporting slice with regional impact aggregation and report generation.
- Backend report utilities suggest exported formats such as CSV/PDF, which are operational outputs rather than user-facing pages.
13. Main request flow
- Typical flow: user authenticates → frontend stores token and role → API requests hit protected routes → controllers invoke services → Mongoose models persist changes → notifications/audit logs are written as side effects.
- This separation keeps HTTP handling, business rules, and persistence distinct.
14. Operational tooling and deployment
- The repo includes seed/admin scripts for populating development data and creating an admin account.
- render.yaml and vercel.json indicate deployment targets for backend and frontend respectively, reinforcing the split runtime model.
Main entry points: App.jsx SPA App · index.js API Server · application.controller.js Application Ctrl · User.model.js Domain Models
Components 21
Backend
Node/Express API and domain logic
- API Server · Express bootstrap and route mounting
backend/src/index.js - Auth API · Login and registration endpoints
backend/src/routes/auth.routes.js - Application API · Apply, list, and review applications
backend/src/routes/application.routes.js - Program API · Provider program management endpoints
backend/src/routes/program.routes.js - Admin API · Verification, fraud, disbursement, and oversight endpoints
backend/src/routes/admin.routes.js - Student Ctrl · Student profile and intake handling
backend/src/controllers/student.controller.js - Provider Ctrl · Provider profile and program ownership
backend/src/controllers/provider.controller.js - Admin Ctrl · Administrative review and operations
backend/src/controllers/admin.controller.js - Application Ctrl · Application submission and review orchestration
backend/src/controllers/application.controller.js - Program Ctrl · Scholarship program CRUD and status changes
backend/src/controllers/program.controller.js - Decision Services · Eligibility, ranking, need, risk, and duplicate checks
backend/src/services/eligibility.service.js - Domain Models · Users, profiles, programs, applications, disbursements, notifications, audits
backend/src/models/User.model.js - Local Uploads · Stored PDF documents for applications and verification
backend/uploads - Notify & Audit · Email, notifications, and audit logging
backend/src/utils/email.js
Frontend
React/Vite SPA for role-based users
- SPA App · Client entry and route composition
client/src/App.jsx - Auth State · Token, role, and session state
client/src/context/AuthContext.jsx - UI Shell · Shared layout, header, footer, dashboard shell
client/src/components/Layout.jsx - Student Area · Student dashboard, applications, profile, withdraw flow
client/src/pages/StudentDashboard.jsx - Provider Area · Provider dashboard, program creation, review, rejections
client/src/pages/ProviderDashboard.jsx - Admin Area · Admin dashboard and oversight screens
client/src/pages/AdminDashboard.jsx - Public Programs · Program listing and application entry points
client/src/pages/ProgramsList.jsx
Connections 26
- SPA App → Auth State: session · App reads auth state for role-aware navigation
- SPA App → UI Shell: layout · Routes render inside shared shell
- SPA App → Student Area: student routes · Student-facing pages are mounted in the SPA
- SPA App → Provider Area: provider routes · Provider-facing pages are mounted in the SPA
- SPA App → Admin Area: admin routes · Admin-facing pages are mounted in the SPA
- SPA App → Public Programs: browse/apply · Public program browsing and application entry
- SPA App → API Server: API calls · Frontend consumes backend JSON endpoints
- API Server → Auth API: mounts · Authentication routes are registered on the server
- API Server → Application API: mounts · Application routes are registered on the server
- API Server → Program API: mounts · Program routes are registered on the server
- API Server → Admin API: mounts · Admin routes are registered on the server
- Auth API → Student Ctrl: register student · Student signup flows through student controller
- Auth API → Provider Ctrl: register provider · Provider signup flows through provider controller
- Application API → Application Ctrl: orchestrates · Application route handlers delegate to application controller
- Program API → Program Ctrl: orchestrates · Program route handlers delegate to program controller
- Admin API → Admin Ctrl: orchestrates · Admin route handlers delegate to admin controller
- Application Ctrl → Decision Services: scores/reviews · Eligibility, ranking, need, and duplicate checks support decisions
- Admin Ctrl → Decision Services: risk checks · Admin review uses risk and conflict analysis
- Student Ctrl → Domain Models: persists · Student data is stored in MongoDB models
- Provider Ctrl → Domain Models: persists · Provider data is stored in MongoDB models
- Application Ctrl → Domain Models: persists · Applications, disbursements, and audit-related records are stored in models
- Program Ctrl → Domain Models: persists · Scholarship programs and provider-owned records are stored in models
- Application Ctrl → Local Uploads: stores docs · Uploaded PDF documents are saved locally
- Admin Ctrl → Notify & Audit: side effects · Sensitive actions trigger notifications, email, and audit logging
- Application Ctrl → Notify & Audit: side effects · Application events emit notifications and audit entries
- Program Ctrl → Notify & Audit: side effects · Program changes can notify stakeholders