How malapatilikith/pg works
PG Management System supports multi-role property managers in managing PG properties, rooms, tenants, rent payments, and notifications. The main workflow is to authenticate, choose a PG scope, manage rooms and tenants, generate or update payments, and track receipts and reminders. The frontend routes users to role-protected pages; the Worker API dispatches requests to domain routes, which use PostgreSQL and supporting services. The README documents major capabilities, but some frontend pages and route implementations were not sampled, so their detailed interactions are not shown.
Main entry points: index.ts Worker entry · App.tsx App routes · schema.ts Neon PostgreSQL · cron.ts Payment and reminder scheduler
Components 24
Web and Mobile UI
- App routes
frontend/src/App.tsx - Auth context
frontend/src/context/AuthContext.tsx - Auth storage
frontend/src/utils/authStorage.ts - Tenant management
frontend/src/pages/Persons.tsx - Payment management
frontend/src/pages/Payments.tsx - Founder PG detail
frontend/src/pages/FounderPgDetail.tsx - Property and admin pages
frontend/src/pages - API client
frontend/src/utils/api.ts
Backend API
- Worker entry
backend/src/index.ts - Authentication routes
backend/src/routes/auth.ts - PG routes
backend/src/routes/pgs.ts - Room routes
backend/src/routes/rooms.ts - Person routes
backend/src/routes/persons.ts - Payment routes
backend/src/routes/payments.ts - Notification routes
backend/src/routes/notifications.ts - JWT and role checks
backend/src/middleware/auth.ts
Data and Files
- Neon PostgreSQL
backend/src/db/schema.ts - Receipt and Aadhaar storage
backend/src/services/r2.ts
Payments and Messaging
- Payment and reminder scheduler
backend/src/services/cron.ts - WhatsApp messaging
backend/src/services/fast2sms.ts - WhatsApp settings
backend/src/services/whatsappSettings.ts
Other components
- PG manager
- Messaging provider
- Cloudflare R2
Connections 35
- PG manager → App routes: uses
frontend/src/App.tsx - App routes → Auth context: provides auth
- App routes → Tenant management: routes to
frontend/src/App.tsx - App routes → Payment management: routes to
frontend/src/App.tsx - App routes → Founder PG detail: routes to
frontend/src/App.tsx - App routes → Property and admin pages: routes to
frontend/src/App.tsx - Auth context → Auth storage: reads and writes
frontend/src/context/AuthContext.tsx - Auth context → API client: requests identity
frontend/src/context/AuthContext.tsx - Tenant management → API client: requests data
frontend/src/pages/Persons.tsx - Payment management → API client: requests data
frontend/src/pages/Payments.tsx - Founder PG detail → API client: requests data
frontend/src/pages/FounderPgDetail.tsx - API client → Worker entry: calls API
- Worker entry → Authentication routes: routes to
backend/src/index.ts - Worker entry → PG routes: routes to
backend/src/index.ts - Worker entry → Room routes: routes to
backend/src/index.ts - Worker entry → Person routes: routes to
backend/src/index.ts - Worker entry → Payment routes: routes to
backend/src/index.ts - Worker entry → Notification routes: routes to
backend/src/index.ts - Worker entry → Payment and reminder scheduler: schedules
backend/src/index.ts - Authentication routes → JWT and role checks: checks access
backend/src/routes/auth.ts - Authentication routes → Neon PostgreSQL: reads and writes
backend/src/routes/auth.ts - PG routes → Neon PostgreSQL: reads and writes
backend/src/routes/pgs.ts - Room routes → Neon PostgreSQL: reads and writes
backend/src/routes/rooms.ts - Person routes → Neon PostgreSQL: reads and writes
backend/src/routes/persons.ts - Person routes → Receipt and Aadhaar storage: stores uploads
backend/src/routes/persons.ts - Payment routes → Neon PostgreSQL: reads and writes
backend/src/routes/payments.ts - Payment routes → Receipt and Aadhaar storage: stores receipts
backend/src/routes/payments.ts - Payment routes → Payment and reminder scheduler: generates payments
backend/src/routes/payments.ts - Notification routes → Payment and reminder scheduler: triggers reminders
backend/src/routes/notifications.ts - Notification routes → Neon PostgreSQL: reads logs
backend/src/routes/notifications.ts - Payment and reminder scheduler → Neon PostgreSQL: reads and writes
backend/src/services/cron.ts - Payment and reminder scheduler → WhatsApp messaging: sends messages
backend/src/services/cron.ts - Payment and reminder scheduler → WhatsApp settings: loads settings
backend/src/services/cron.ts - WhatsApp messaging → Messaging provider: sends via
- Receipt and Aadhaar storage → Cloudflare R2: stores files