Feature Flags
101 feature keys across 12 modules. Admin-controlled per-society toggles. KV-cached with 5-minute TTL. Small societies see only what they need.
Architecture
Admin toggles feature via POST /admin/features/toggle
│
├─→ UPDATE society_features SET enabled = 1/0
├─→ Invalidate KV cache: DELETE "features:{societyId}"
└─→ Next request picks up new state
Route handler:
requireFeature('billing.maintenance')
├─→ Check KV cache first (5-min TTL)
├─→ Cache miss → query D1 society_features table
└─→ Returns 403 if feature disabled
Default Enabled Features (46)
These are enabled by default for all societies on first setup:
| Module | Feature Keys |
|---|---|
| Billing | billing.maintenance |
| Members | members.directory |
| Notices | notices.board, notices.push |
| Complaints | complaints.basic |
| Documents | documents.vault |
| Amenities | amenity.booking |
| Community | community.feed |
| Accounting | accounting.coa |
| Auth | auth.mfa, auth.rbac |
| Guard | guard.basic |
| Finance | erp.vendors, finance.vendor_bills |
| Reports | reports.financial, reports.complaints, reports.visitors, reports.overview, reports.export, reports.gst, reports.tds |
Full Feature List (12 modules, 101 keys)
| Module | Feature Keys |
|---|---|
| Billing | billing.maintenance, billing.auto_demand, billing.penalty, billing.escalation, billing.service_blocking, billing.reminders, billing.invoice_pdf, billing.e_invoicing |
| Payments | payments.razorpay, payments.upi, payments.neft, payments.cheque, payments.auto_pay, payments.refund, bank_accounts, payment_verification |
| Accounting | accounting.coa, accounting.journal, accounting.bank_reconciliation, advanced_accounting, accounting.gst, accounting.tds, accounting.credit_debit |
| Governance | agm.workflow, agm.quorum, e_voting, governance, noc_approval, letter_approval, ai_mom, noc_esign |
| Security | guard.basic, guard.patrol, guard.leaderboard, guard.leaderboard, blacklist, sos, boom_barrier |
| Parking | parking.zone_map, parking.anpr, parking.rfid, parking.ev_charging, parking.visitor |
| Workforce | workforce.attendance, workforce.shifts, workforce.payroll, workforce.checklist |
| Facilities | amenity.booking, facilities.pricing, facilities.deposits, facilities.analytics |
| Community | community.feed, community.polls, community.forum, community.events, community.blood_donor, safety_alerts, hyperlocal |
| Documents | documents.vault, statutory_registers, document_signatures |
| Compliance | gst_compliance, tds_filing, dpdp_compliance, audit_logs |
| Reports | reports.financial, reports.complaints, reports.visitors, reports.overview, reports.export, reports.gst, reports.tds |
Admin API
GET /admin/features → List all features with enablement status
POST /admin/features/toggle → Toggle a feature on/off
POST /admin/features/bulk-toggle → Toggle multiple features at once