How ayshwarya-ashok/parinaam-vms-v2 works
Purpose and Topology
Parinaam VMS v2 is a volunteer-management platform for program delivery: volunteer registration/compliance, enrollment in dated events, attendance, feedback, certificates, reporting, and administration. It is a Dockerized monorepo with a React SPA, NestJS API and background worker, PostgreSQL, Redis, and n8n-mediated email. Composition and service boundaries are defined in docker-compose.yml, with deployment images in apps/api/Dockerfile and apps/web/Dockerfile.
Entry Points and Clients
The API boots NestJS from apps/api/src/main.ts; the same API image also runs asynchronous work through apps/api/src/worker.ts. Module composition is centralized in apps/api/src/app.module.ts. The browser SPA starts at apps/web/src/main.tsx, establishes providers/layout/auth routing in apps/web/src/app/router.tsx and apps/web/src/app/providers.tsx, and calls the API through apps/web/src/api/client.ts.
Domain and Persistence Boundary
PostgreSQL is the business-system source of truth. The central hierarchy is program → activity → dated event; volunteer enrollment, attendance, training, recognition, feedback, communications, and reporting persist around it. Forward-only SQL migrations define the schema and database-side business views/functions in database/migrations/V003__programs_activities_events.sql, database/migrations/V005__enrollments_and_waitlist.sql, and database/migrations/V009__views_and_functions.sql. API entity mappings are organized by domain in apps/api/src/database/entities/.
Identity, Authorization, and Volunteer Lifecycle
Auth supports account/profile registration, pending review, password handling, JWT authentication, consent, and role-gated API access. The API boundary applies JWT and role controls from apps/api/src/common/guards/jwt-auth.guard.ts and apps/api/src/common/guards/roles.guard.ts; authentication workflows reside in apps/api/src/modules/auth/auth.service.ts. Volunteer-facing profile and administrative directory functions are served by apps/api/src/modules/volunteers/volunteers.service.ts, with guarded SPA routes in apps/web/src/app/guards.tsx.
Program Delivery and Enrollment
Administrators create/manage programs, activities, events, coordinators, and event execution through apps/api/src/modules/programs/programs.service.ts and apps/api/src/modules/programs/events-admin.service.ts. Volunteers browse eligible dated events and enroll through apps/api/src/modules/enrollments/events-browse.service.ts and apps/api/src/modules/enrollments/enrollments.service.ts. This boundary enforces capacity, waitlists/auto-promotion, schedule conflicts, program/activity availability, and training eligibility. The volunteer UI’s primary discovery/enrollment screens are apps/web/src/pages/volunteer/BrowseSessions.tsx and apps/web/src/components/EnrollFlow.tsx.
Compliance, Attendance, and Outcomes
Training content, assessments, attempts, and completion gates are managed in apps/api/src/modules/trainings/trainings.service.ts. Attendance is recorded using signed, no-login links and operational reminders in apps/api/src/modules/attendance/link-token.service.ts and apps/api/src/modules/attendance/attendance.service.ts. Feedback attaches to occurrences, while certificates aggregate attended hours at program level; these outcome flows are implemented in apps/api/src/modules/feedback/feedback.service.ts and apps/api/src/modules/certificates/certificates.service.ts, including PDF generation in apps/api/src/modules/certificates/certificate-pdf.service.ts.
Async Communications, Files, and Reporting
The API writes email outbox/log records, renders Handlebars templates, and posts signed payloads to n8n; it never connects to SMTP directly. Delivery callbacks update message state via apps/api/src/modules/notifications/n8n.client.ts, apps/api/src/modules/notifications/email.processor.ts, and apps/api/src/modules/notifications/webhooks.controller.ts. n8n’s versioned workflow is n8n/workflows/vms-email-dispatch.json; Mailpit is the local SMTP sink. Redis supports worker/queue-related infrastructure. Files use a storage abstraction and signed URLs in apps/api/src/modules/storage/storage.service.ts. Reports export CSV/Excel/PDF and run scheduled dispatch through apps/api/src/modules/reports/reports.service.ts and apps/api/src/modules/reports/scheduled.service.ts.
Main entry points: app.module.ts Module composition · enrollments.service.ts Enrollment rules · trainings.service.ts Training, attendance & outcomes · router.tsx Auth routing & providers
Components 20
Browser Client
- React SPA · Volunteer and administrator interface.
apps/web/src/main.tsx - Auth routing & providers
apps/web/src/app/router.tsx - Event browse & enrollment
apps/web/src/pages/volunteer/BrowseSessions.tsx - API client
apps/web/src/api/client.ts
NestJS API & Worker
- NestJS API
apps/api/src/main.ts - Module composition
apps/api/src/app.module.ts - Auth & access control · JWT, roles, registration, review, and consent.
apps/api/src/modules/auth/auth.service.ts - Volunteer lifecycle
apps/api/src/modules/volunteers/volunteers.service.ts - Programs & event admin
apps/api/src/modules/programs/programs.service.ts - Enrollment rules · Capacity, waitlists, conflicts, availability, and eligibility.
apps/api/src/modules/enrollments/enrollments.service.ts - Training, attendance & outcomes · Training gates, signed attendance, feedback, and certificates.
apps/api/src/modules/trainings/trainings.service.ts - Reports & scheduled dispatch
apps/api/src/modules/reports/reports.service.ts - Background worker
apps/api/src/worker.ts - Notification delivery · Posts signed payloads to n8n; receives delivery callbacks.
apps/api/src/modules/notifications/n8n.client.ts - File storage · Provides signed file URLs.
apps/api/src/modules/storage/storage.service.ts
Data & Integrations
- PostgreSQL · Stores program delivery, volunteer, compliance, and outcome data.
- Schema migrations & DB views · Forward-only schema plus database views and functions.
database/migrations/V009__views_and_functions.sql - Redis
- n8n email workflow · Routes email to SMTP without API SMTP access.
n8n/workflows/vms-email-dispatch.json - Mailpit
Connections 29
- React SPA → Auth routing & providers: initializes
- Auth routing & providers → Event browse & enrollment: serves guarded screens
- Auth routing & providers → API client: uses
- Event browse & enrollment → API client: browses and enrolls
- API client → NestJS API: HTTPS API calls
- NestJS API → Module composition: boots
- Module composition → Auth & access control: composes
- Module composition → Volunteer lifecycle: composes
- Module composition → Programs & event admin: composes
- Module composition → Enrollment rules: composes
- Module composition → Training, attendance & outcomes: composes
- Module composition → Reports & scheduled dispatch: composes
- Auth & access control → Volunteer lifecycle: authorizes lifecycle access
- Programs & event admin → Enrollment rules: provides dated events
- Enrollment rules → Training, attendance & outcomes: checks training eligibility
- Auth & access control → PostgreSQL: persists accounts and roles
- Volunteer lifecycle → PostgreSQL: persists profiles
- Programs & event admin → PostgreSQL: persists program hierarchy
- Enrollment rules → PostgreSQL: persists enrollment and waitlist
- Training, attendance & outcomes → PostgreSQL: persists compliance and outcomes
- Reports & scheduled dispatch → PostgreSQL: reads reporting data
- Schema migrations & DB views → PostgreSQL: defines schema and views
- Background worker → Redis: consumes queued work
- Background worker → Notification delivery: processes email outbox
- Notification delivery → PostgreSQL: updates outbox and delivery state
- Notification delivery → n8n email workflow: signed email payloads
- n8n email workflow → Mailpit: local SMTP delivery
- Reports & scheduled dispatch → File storage: writes exports
- Training, attendance & outcomes → File storage: stores certificate files