Societee Knowledge Base
AI-Powered Digital Operating System for Residential Housing Societies & Hyperlocal Communities in India. Enterprise ERP for officials, social-media UX for residents.
265
API Endpoints
113
Database Tables
11
Middleware Layers
14
Libraries
2
Durable Objects
30+
Frontend Pages
Tech Stack
| Layer | Technology | Purpose |
|---|---|---|
| Runtime | Cloudflare Workers | Edge compute, serverless functions |
| HTTP Framework | Hono v4 | Type-safe routing, middleware pipeline |
| Language | TypeScript 5.9 | End-to-end type safety |
| Database | Cloudflare D1 (SQLite) | 113 tables, edge-replicated, multi-tenant |
| Cache/Sessions | Cloudflare KV | Rate limiting, session store, feature flag cache |
| File Storage | Cloudflare R2 | Invoices, receipts, documents, media |
| Real-time | Durable Objects | Gate sync WebSocket hub, Emergency SOS broadcast |
| Queues | Cloudflare Queues | Async billing, notifications, audit logs |
| AI | Cloudflare Workers AI | 7 AI agents (accountant, secretary, compliance, etc.) |
| Vector Search | Cloudflare Vectorize | RAG for bylaws, policies, legal docs |
| Auth | OpenAuth + PBKDF2 + JWT | OpenAuth server + legacy PBKDF2 fallback |
| Validation | Zod v4 | Request/response validation |
| Frontend | React 19 + Vite 8 + Tailwind v4 | SPA with social-media UX + enterprise ERP |
| State | TanStack React Query v5 | Server state management, caching, mutations |
| Forms | React Hook Form v7 + Zod | Form validation and submission |
| Routing | React Router DOM v7 | Client-side routing with nested layouts |
| Animation | motion/react | Page transitions, micro-interactions |
Multi-Tenant Architecture
Every query is isolated by society_id. Tenant resolution is via X-Tenant-ID or X-Society-ID header on every request. All 113 D1 tables include a society_id foreign key.
Request → Security Headers → Output Sanitization → Audit Logger
→ Request Logger → Multi-Tenant Isolation → JWT Auth + ABAC
→ Request Signing → Anomaly Detection → Route Handler → Response
Three-Experience Architecture
Resident Mode
Social-media UX. Facebook/Instagram-inspired. Scrollable feed, one-tap bill pay, visitor QR approvals, community marketplace. 12 pages.
Official Mode
Enterprise ERP. Data tables, bulk operations, financial reports, vendor management, compliance dashboards. 11 pages.
Guard Mode
Lightweight PWA. 1 screen per function, large touch targets, minimal data entry. Guard gate, visitors, vehicles, SOS, log. 5 pages.
Project Structure
societee/
├── src/ # Backend (Cloudflare Worker)
│ ├── index.ts # Entry point — mounts all routes
│ ├── routes/ # 25 route files (265 endpoints)
│ ├── middleware/ # 11 middleware layers
│ ├── lib/ # 14 shared libraries
│ ├── services/ # 10 business logic services
│ ├── schemas/ # 16 Zod validation schemas
│ ├── durable_objects/ # 2 Durable Object classes
│ ├── utils/ # Utility helpers
│ └── types/ # TypeScript type definitions
├── db/
│ ├── schema.sql # 113 tables, 223 indexes
│ └── seed.sql # Test society data
├── auth/ # OpenAuth Server (separate Worker)
│ ├── src/index.ts # Auth issuer + success callback
│ ├── src/subjects.ts # JWT subject schema
│ ├── wrangler.json # Auth Worker config
│ └── migrations/ # D1 migrations for auth DB
├── frontend/ # React SPA
│ └── src/
│ ├── pages/ # 30+ page components
│ ├── components/ # Shared UI components
│ ├── contexts/ # Auth, Theme, Persona contexts
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # API client, utilities
│ └── types/ # Frontend type definitions
├── Docs/ # Business & feature docs
└── wrangler.toml # Backend Worker config
Quick Links
API Reference →
All 265 endpoints across 25 route modules
Database Schema →
113 tables, 223 indexes, full column reference
Security Model →
AES-256, RBAC, MFA, DPDP, audit trail
Integrations →
WhatsApp, UPI, GST, Tally, Park+, ANPR/RFID
Architecture →
Cloudflare edge stack, DO, queues, RAG
Deployment →
Cloudflare resources, secrets, migration