DAC Academy — Module Deep Dive
- User enters email + password + "Remember Me" checkbox
- Validated via
signInSchema (Zod)
- Rate-limited to prevent brute force
- If parent role → redirect to
/parent/dashboard
- All other roles → redirect to
/dashboard
- JWT-based sessions via Better Auth
- Role, branchId, hostelId embedded in JWT token
- Token validated on each request
- Enter email on
/forgot-password
- Rate-limited per email
- Email sent with reset link →
/update-password?token=X
- Enter new password + confirm
- Session destroyed, redirect to
/login
| Metric | Source | Calculation |
|---|
| Total Leads | leads table | COUNT(*) — all leads |
| Hot Leads | leads table | COUNT(*) WHERE probability = 'hot' |
| Total Admissions | admissions table | COUNT(*) WHERE isDeleted = false |
| Total Students | students table | COUNT(*) WHERE isActive = true |
| Revenue | fee_installments table | SUM(amountPaise) WHERE isPaid = true |
| Pending Outings | hostel_outings table | COUNT(*) WHERE status = 'pending' |
| Pending Medical | medical_requests table | COUNT(*) WHERE status = 'pending' |
| WhatsApp Messages | whatsapp_log table | Recent monthly count |
| Leads by Status | leads table | Grouped COUNT per status |
| Fee Collection | fee_installments table | Monthly SUM, last 6 months |
| Metric | Scope |
|---|
| Hostel Students | Warden's hostel only |
| Pending Outings | Warden's hostel only |
| Pending Medical | Warden's hostel only |
| Currently Out | Approved outings not yet returned |
| Status | Meaning | Next Actions |
|---|
new | Fresh inquiry, no contact made | Contact parent, gather details |
contacted | Parent reached, discussion ongoing | Follow up, build interest |
interested | Parent showed interest | Schedule visit, share fee info |
registered | Registration fee paid | Convert to admission |
admitted | Fully enrolled (automatic from admission) | N/A — terminal |
lost | Lead converted to another academy | Record reason, close |
| Level | Color | Meaning |
|---|
hot | Red | High chance of conversion |
warm | Amber | Moderate chance |
cold | Blue | Low chance |
- Staff clicks "Register" on lead detail
- Enter: amount, payment mode, transaction ID, payment screenshot (optional)
- System creates receipt + registration record in a single transaction
- Receipt PDF generated and WhatsApp notification sent after completion
- Student Details — Name, class, target exam, DOB, gender
- Contact Details — Parent phone (required), email, father/mother/guardian phone
- Academic Info — Course, batch, board, school, address, Aadhaar (hashed)
- Hostel — Admission type, hostel assignment, room/bed/locker
- Fee & Payment — Fee overrides, amount paid, payment mode, transaction ID
- Installments — Optional custom schedule; auto-generated from batch defaults if omitted
- Documents — Checklist item completion with uploaded images
- Admission Items — Optional custom items; uses defaults if omitted
- Student Photo — Optional, uploaded to cloud storage
admissionFeePaise = form value or batch defaults
hostelFee = form value or batch default (if hostel type)
totalFee = admissionFee + hostelFee
remaining = totalFee - amountPaid
- Enforced with row lock to prevent overselling
- If batch has capacity limit and is full → error
- If email provided: existing user is linked, or new user created
- Temp password generated, email auto-verified
| Status | Meaning | Can Re-enroll? |
|---|
active | Currently enrolled | N/A |
left | Voluntarily withdrawn | Yes (clear arrears first) |
tc_issued | Transfer Certificate issued | Yes (clear arrears first) |
removed | Disciplinary removal | Yes (reinstatement) |
completed | Session/course completed | Yes (next session) |
- Batch changes rejected — Must use Batch Transfer workflow
- Branch changes rejected — Must use dedicated transfer workflow
- Hostel allocation auto-syncs with admission type changes
- Edit Profile, Batch Transfer, Promote, Re-enroll, Reinstate
- Mark Left, Mark TC Issued, Mark Removed, Mark Completed
- Reset Parent Password, Create Parent Account
- Created at admission with initial totals
- Installments generated from batch schedule or manual
- Payments recorded against installments
- Ad-hoc fees added to increase total fee
- Installments voided to reverse payment
| Mode | Description |
|---|
| New Payment | Pay any amount against a fee record |
| Edit Payment | Change payment details of existing paid installment |
| Resolve Installment | Pay a specific unpaid installment |
totalFeePaise = totalPaidPaise + remainingPaise
totalPaidPaise <= totalFeePaise
- All amounts >= 0
- Paginated table of hostel students
- Warden: sees only own hostel; Admin: sees all
- Parent: Request outing, cancel pending, view history
- Warden/Admin: View queue, approve/reject, mark returned
- WhatsApp notifications sent on request and review
- Filters: status, search, pagination
- Acknowledge button per request
- Parent submits request with disease, medicine, dose
- Status: pending — visible in warden/admin queue
- Warden/admin acknowledges → status 'acknowledged'
- Warden/admin completes → status 'completed'
- OR rejects → status 'rejected' (reason required)
- On acknowledgment: notification to parent
- Create — Admin creates new session (name, start/end dates)
- Activate — Single session activation (deactivates all others)
- Deactivate — Blocked if students enrolled in that session
- Only ONE session can be active at any time
- Session name format:
YYYY-YY
KIND/FINANCIAL-YEAR/SEQUENCE
Examples: ADM/2025-26/0042, REG/2025-26/0015
| Kind | Generated By | Amount |
|---|
| REG | Lead registration | Registration fee only |
| ADM | Admission or fee payment | Various amounts |
- Receipts CANNOT be updated or deleted
- Can be voided (business marker only — does not reverse finances)
- Financial reversals happen via installment voiding
Academy — Name, GST enabled/rate/GSTIN
Branches — CRUD with active/inactive toggle
Courses — CRUD with active/inactive toggle
Batches — CRUD with fee fields, payment schedule JSON, capacity
Sessions — Create/activate/deactivate
Hostels — CRUD per branch
Checklist — Document checklist items for admission
WhatsApp — Notification toggles and alert phone numbers
- Role, branch, course, batch, hostel status, class, status, admission type
- Only matching announcements shown
- Parents see announcements for ALL linked students
- Immutable: Strictly insert-only
- Before/After snapshots: JSONB of state before and after each change
- Admin only: No other role can view
- Filterable by entity type, action, date range, and text search
| Template | Trigger |
|---|
| Registration invoice | Lead registered |
| Admission invoice | Admission created |
| Outing request | Parent requests outing |
| Outing approved/rejected | Outing reviewed |
| Payment receipt | Payment recorded |
| Fee reminder | Fee due |
| Medical acknowledgment | Medical request acknowledged |
- Business logic enqueues notification into
jobs table
- Cron processes the queue in batches
- On success: marked completed
- On failure: retried with backoff (max 3 attempts)
/parent/dashboard — Overview with students, fees, outings, medical, receipts, announcements
/parent/hostel-outing — Request/View outings
/parent/medical — Submit/View medical requests
/parent/receipts — View receipts
| Action | Allowed? |
|---|
| View own children's data | ✅ |
| View receipts | ✅ |
| Request outing | ✅ (hostel students only) |
| Submit medical request | ✅ (hostel students only) |
| View announcements | ✅ (filtered to matching profiles) |
| Edit student info | ❌ Staff only |
| Create admission | ❌ Staff only |
| Access staff dashboard | ❌ (unless also a staff role) |
/warden → Dashboard
/warden/students — Hostel student directory
/warden/medical — Medical request queue
/warden/export — Data export