How sahil-das/clubkhata-backend works
This is a multi-tenant club-management SaaS backend for festival committees. Its main workflow is a client request entering the Express API, passing route-level authentication/role checks, reaching a domain controller, and reading or updating MongoDB-backed club records. The domain spans club identity and membership, festival-year setup, subscriptions and fees, expenses and rentals, and finance/audit views; platform administration and member-facing collaboration are additional capabilities. The graph uses source-index references for unsampled modules, so some detailed controller-to-model relationships are omitted.
Main entry points: app.js Express API · auditLogger.js Audit logging · rental.controller.js Rental orders and vendors · FestivalYear.js Festival years
Components 26
API and access
- Express API
src/app.js - Authentication routes
src/routes/auth.routes.js - Token and club context
src/middleware/auth.middleware.js - Role and request checks
src/middleware
Clubs and membership
- Authentication
src/controllers/auth.controller.js - Users and sessions
src/models/User.js - Clubs and memberships
src/models/Membership.js - Membership management
src/controllers/membership.controller.js
Festival operations
- Festival-year setup
src/controllers/festivalYear.controller.js - Festival years
src/models/FestivalYear.js - Rental orders and vendors
src/controllers/rental.controller.js - Rental records
src/models/RentalOrder.js - Notices and polls
src/routes - Asset management
src/routes/asset.routes.js - Festival archives
src/routes/archive.routes.js
Finance and oversight
- Subscriptions
src/controllers/subscription.controller.js - Member fees
src/controllers/memberFee.controller.js - Donations
src/controllers/donation.controller.js - Expenses
src/controllers/expense.controller.js - Budget and finance views
src/controllers/finance.controller.js - Audit logging
src/utils/auditLogger.js - Money conversion
src/utils/mongooseMoney.js - Balance calculation
src/utils/calculateBalance.js - Audit records
src/models/AuditLog.js
Platform services
- Platform administration
src/controllers/platform.controller.js
Other components
- API client
Connections 42
- API client → Express API: sends requests
- Express API → Authentication routes: mounts auth
src/app.js - Express API → Membership management: mounts member routes
src/app.js - Express API → Festival-year setup: mounts year routes
src/app.js - Express API → Subscriptions: mounts subscription routes
src/app.js - Express API → Member fees: mounts fee routes
src/app.js - Express API → Donations: mounts donation routes
src/app.js - Express API → Expenses: mounts expense routes
src/app.js - Express API → Budget and finance views: mounts finance routes
src/app.js - Express API → Rental orders and vendors: mounts rental routes
src/app.js - Express API → Notices and polls: mounts notices and polls
src/app.js - Express API → Asset management: mounts asset routes
src/app.js - Express API → Festival archives: mounts archive routes
src/app.js - Express API → Platform administration: mounts platform routes
src/app.js - Authentication routes → Authentication: routes requests
src/routes/auth.routes.js - Authentication routes → Token and club context: protects requests
src/routes/auth.routes.js - Authentication routes → Role and request checks: validates input
src/routes/auth.routes.js - Token and club context → Users and sessions: loads user
src/middleware/auth.middleware.js - Token and club context → Clubs and memberships: checks membership
src/middleware/auth.middleware.js - Authentication → Users and sessions: reads and writes
src/controllers/auth.controller.js - Authentication → Clubs and memberships: creates membership
src/controllers/auth.controller.js - Authentication → Audit logging: records actions
src/controllers/auth.controller.js - Membership management → Users and sessions: uses user records
src/controllers/membership.controller.js - Membership management → Clubs and memberships: manages memberships
src/controllers/membership.controller.js - Festival-year setup → Festival years: manages years
src/controllers/festivalYear.controller.js - Festival-year setup → Balance calculation: calculates balance
src/controllers/festivalYear.controller.js - Festival-year setup → Audit logging: records actions
src/controllers/festivalYear.controller.js - Subscriptions → Festival years: reads year state
src/controllers/subscription.controller.js - Subscriptions → Audit logging: records actions
src/controllers/subscription.controller.js - Member fees → Festival years: reads year state
src/controllers/memberFee.controller.js - Member fees → Clubs and memberships: reads memberships
src/controllers/memberFee.controller.js - Member fees → Audit logging: records actions
src/controllers/memberFee.controller.js - Expenses → Festival years: checks year status
src/controllers/expense.controller.js - Expenses → Rental orders and vendors: uses rental records
src/controllers/expense.controller.js - Expenses → Audit logging: records actions
src/controllers/expense.controller.js - Rental orders and vendors → Rental records: manages orders
src/controllers/rental.controller.js - Rental orders and vendors → Festival years: checks active year
src/controllers/rental.controller.js - Rental orders and vendors → Money conversion: formats amounts
src/controllers/rental.controller.js - Budget and finance views → Balance calculation: uses balance calculations
- Balance calculation → Money conversion: uses stored amounts
src/utils/calculateBalance.js - Audit logging → Audit records: creates log records
src/utils/auditLogger.js - Platform administration → Audit logging: records actions
src/controllers/platform.controller.js