How princes1-hash/impactlink works
1. Overall shape
This is a monolithic Node.js + Express application with a server-rendered EJS UI and a MongoDB-backed data layer. The app centers on an NGO/volunteer marketplace called ImpactLink.
2. Request entry and routing
app.js is the main composition point. It wires the HTTP server to the route modules under routes/, which split the app into functional areas: auth, admin, NGO, volunteers, opportunities, applications, and impact.
3. Auth and role boundaries
Authentication appears to be token-based, with utils/generateToken.js and middlewares/authmiddleware.js enforcing access control. The app has clearly separated roles: admin, NGO, and volunteer, each with its own dashboard and route surface.
4. Controller layer
Controllers are organized by domain and act as the application’s orchestration layer:
- authcontroller.js handles login/register/onboarding flows.
- adminController.js supports admin dashboard and oversight.
- ngoController.js, volunteerController.js, opportunitiesController.js, applicationController.js, and impactController.js handle the core feature areas.
- projectController.js suggests NGO/project creation flows alongside opportunities.
5. Data model boundaries
MongoDB collections are represented by models in models/:
- User
- NGO
- Volunteer
- Opportunity
- Application
- ImpactLog
These model the main business entities and the relationships between users, opportunities, applications, and impact reporting.
6. Core business flow
The main loop is: NGO creates opportunities/projects → volunteers discover and apply → applications are stored and reviewed → impact is logged. This is the primary data flow that drives the app’s dashboards and summary pages.
7. Matching and discovery
services/matchEngine.js is a distinct business-service boundary. It likely scores or ranks opportunities for volunteers and powers the discover experience and recommendation-like behavior rather than keeping that logic inside controllers.
8. Presentation layer
The UI is entirely server-rendered with EJS templates in views/. Key pages include:
- landing/home and login/register/onboard
- dashboard/profile
- discover and opportunity details
- NGO and volunteer dashboards
- leaderboard and error pages
views/partials/navbar.ejs provides shared layout/navigation.
9. Admin and reporting surfaces
views/leaderboard.ejs plus controllers/impactController.js and models/ImpactLog.js indicate a reporting/recognition subsystem. The admin layer likely oversees seeded demo accounts, platform status, and aggregate impact/engagement views.
10. Bootstrapping and demo data
seeds/seed.js creates the demo environment described in the README: one admin, multiple NGOs, multiple volunteers, and many opportunities. This means the repository is designed to be runnable as a demo system with realistic sample data.
11. Operational scripts and artifacts
scripts/add_leaderboard_demo.js and scripts/check_routes.js are support utilities for demo content and route validation. The cookies_*.txt files appear to be saved browser/session artifacts for the sample accounts, useful for demoing authenticated roles.
12. Infrastructure dependency
MongoDB is the only external infrastructure explicitly required. The README notes that if MongoDB is unavailable, the server can still start, but data-driven pages become limited—so persistence is a core dependency, while the HTTP app itself is a separate runtime boundary.
Main entry points: app.js app.js · authcontroller.js Auth controller · volunteerController.js Volunteer controller · impactController.js Impact controller
Components 21
Runtime
Express app composition and cross-cutting request handling
- app.js · Main server composition and route wiring
app.js - Auth guard · Token-based access control for protected routes
middlewares/authmiddleware.js - Token util · Creates authentication tokens
utils/generateToken.js
Domain
Feature routes, controllers, services, and data models
- Auth routes · Login, register, and onboarding endpoints
routes/auth.js - Admin routes · Admin dashboard and oversight endpoints
routes/admin.js - NGO routes · NGO dashboard and project flows
routes/ngo.js - Volunteer routes · Volunteer profile and discovery endpoints
routes/volunteers.js - Opportunity routes · Opportunity discovery and detail endpoints
routes/opportunities.js - Applications · Volunteer application submission and review endpoints
routes/applications.js - Impact routes · Impact reporting and leaderboard endpoints
routes/impact.js - Auth controller · Authentication and onboarding orchestration
controllers/authcontroller.js - NGO controller · NGO dashboard and project management
controllers/ngoController.js - Volunteer controller · Volunteer profile and discovery orchestration
controllers/volunteerController.js - Opportunity controller · Opportunity browsing and detail logic
controllers/opportunitiesController.js - Application controller · Application lifecycle and review logic
controllers/applicationController.js - Impact controller · Impact aggregation and leaderboard data
controllers/impactController.js - Match engine · Ranks or matches opportunities for volunteers
services/matchEngine.js - Mongo models · Core entities for users, NGOs, volunteers, opportunities, applications, and impact logs
UI
Server-rendered EJS pages and shared presentation
- EJS views · Pages for home, auth, dashboards, discovery, profile, and leaderboard
Ops
Demo data and maintenance scripts
- Seed data · Creates demo admin, NGOs, volunteers, and opportunities
seeds/seed.js - Demo scripts · Route checks and leaderboard demo helpers
Connections 32
- app.js → Auth routes: mounts · Registers authentication routes
- app.js → Admin routes: mounts · Registers admin routes
- app.js → NGO routes: mounts · Registers NGO routes
- app.js → Volunteer routes: mounts · Registers volunteer routes
- app.js → Opportunity routes: mounts · Registers opportunity routes
- app.js → Applications: mounts · Registers application routes
- app.js → Impact routes: mounts · Registers impact routes
- Auth routes → Auth controller: uses · Delegates auth flows to controller
- Admin routes → Auth guard: protects · Restricts admin access
- Admin routes → Impact controller: uses · Admin oversight and reporting
- NGO routes → Auth guard: protects · Requires authenticated NGO access
- NGO routes → NGO controller: uses · Delegates NGO dashboard actions
- Volunteer routes → Auth guard: protects · Requires authenticated volunteer access
- Volunteer routes → Volunteer controller: uses · Delegates volunteer flows
- Opportunity routes → Opportunity controller: uses · Delegates discovery and detail handling
- Applications → Application controller: uses · Delegates application workflow
- Impact routes → Impact controller: uses · Delegates impact reporting
- Auth controller → Token util: creates · Issues auth tokens
- Volunteer controller → Match engine: scores · Supports discover and recommendation behavior
- NGO controller → Mongo models: reads/writes · Persists NGOs, projects, and related data
- Volunteer controller → Mongo models: reads/writes · Persists volunteer profile data
- Opportunity controller → Mongo models: reads/writes · Persists and retrieves opportunities
- Application controller → Mongo models: reads/writes · Stores applications and status changes
- Impact controller → Mongo models: reads/writes · Stores and aggregates impact logs
- Auth controller → Mongo models: reads/writes · Creates and authenticates users
- app.js → EJS views: renders · Serves EJS pages
- Auth controller → EJS views: renders · Login, register, and onboard screens
- Volunteer controller → EJS views: renders · Discovery, profile, and dashboard pages
- NGO controller → EJS views: renders · NGO dashboard and project form pages
- Impact controller → EJS views: renders · Leaderboard and reporting pages
- Seed data → Mongo models: populates · Seeds demo entities into MongoDB
- Demo scripts → Seed data: supports · Maintenance and demo setup tasks