How joydeep-bhattacharjee/token-sesh works
CoWork is a multi-tenant coworking-room booking REST API. Members register or authenticate, browse rooms, create and manage bookings, and retrieve availability; admins manage rooms and access usage reports and CSV exports. The main request path is FastAPI’s application entry point into endpoint routers, which apply domain rules and use SQLAlchemy-backed models. Booking creation and cancellation also invoke rate limiting, reference-code, refund, statistics, notification, and cache services. The graph follows documented endpoints and shown calls; unsampled modules are included where the README or source index establishes their role, without guessing their internal wiring.
Main entry points: bookings.py Booking Endpoints · models.py Domain Models · main.py FastAPI App · rooms.py Room Endpoints
Components 22
API Routing
- FastAPI App
app/main.py - Request Schemas
app/schemas.py - API Error Handling
app/errors.py - Health Endpoint
app/routers/health.py
Identity & Tenancy
- Auth Endpoints
app/routers/auth.py - Token & Password Auth
app/auth.py
Booking Lifecycle
- Booking Endpoints
app/routers/bookings.py - Booking Serialization
app/serializers.py - Booking Rate Limit
app/services/ratelimit.py - Reference Codes
app/services/reference.py - Refund Processing
app/services/refunds.py - Booking Notifications
app/services/notifications.py
Rooms & Reporting
- Room Statistics
app/services/stats.py - Room Endpoints
app/routers/rooms.py - Admin Reports & Export
app/routers/admin.py - CSV Export
app/services/export.py
Runtime Core
- Domain Models
app/models.py - SQLAlchemy Database
app/database.py - Runtime Config
app/config.py - Response Cache
app/cache.py - UTC Time Utilities
app/timeutils.py
Other components
- API Client
Connections 48
- API Client → FastAPI App: sends requests
README.md - FastAPI App → SQLAlchemy Database: creates schema
app/main.py - FastAPI App → API Error Handling: registers handler
app/main.py - FastAPI App → Auth Endpoints: registers routes
app/main.py - FastAPI App → Booking Endpoints: registers routes
app/main.py - FastAPI App → Room Endpoints: registers routes
app/main.py - FastAPI App → Admin Reports & Export: registers routes
app/main.py - FastAPI App → Health Endpoint: registers routes
app/main.py - Auth Endpoints → Token & Password Auth: issues and verifies
app/routers/auth.py - Auth Endpoints → Domain Models: reads and writes
app/routers/auth.py - Auth Endpoints → SQLAlchemy Database: gets sessions
app/routers/auth.py - Auth Endpoints → Request Schemas: validates requests
app/routers/auth.py - Token & Password Auth → Runtime Config: uses token settings
app/auth.py - Token & Password Auth → SQLAlchemy Database: gets sessions
app/auth.py - Token & Password Auth → Domain Models: loads users
app/auth.py - Domain Models → SQLAlchemy Database: uses declarative base
app/models.py - SQLAlchemy Database → Runtime Config: loads database URL
app/database.py - Booking Endpoints → Token & Password Auth: requires user
app/routers/bookings.py - Booking Endpoints → SQLAlchemy Database: gets sessions
app/routers/bookings.py - Booking Endpoints → Domain Models: queries and writes
app/routers/bookings.py - Booking Endpoints → Request Schemas: validates requests
app/routers/bookings.py - Booking Endpoints → Booking Rate Limit: checks request limit
app/routers/bookings.py - Booking Endpoints → Reference Codes: allocates code
app/routers/bookings.py - Booking Endpoints → Refund Processing: calculates and logs
app/routers/bookings.py - Booking Endpoints → Booking Notifications: sends notifications
app/routers/bookings.py - Booking Endpoints → Response Cache: invalidates entries
app/routers/bookings.py - Booking Endpoints → Booking Serialization: serializes bookings
app/routers/bookings.py - Booking Serialization → Domain Models: reads booking fields
app/serializers.py - Booking Serialization → UTC Time Utilities: formats timestamps
app/serializers.py - Reference Codes → Domain Models: checks references
app/services/reference.py - Refund Processing → Domain Models: creates refund logs
app/services/refunds.py - Booking Rate Limit → API Error Handling: raises limit error
app/services/ratelimit.py - Room Endpoints → Token & Password Auth: requires user or admin
app/routers/rooms.py - Room Endpoints → SQLAlchemy Database: gets sessions
app/routers/rooms.py - Room Endpoints → Domain Models: queries rooms and bookings
app/routers/rooms.py - Room Endpoints → Request Schemas: validates room input
app/routers/rooms.py - Room Endpoints → Room Statistics: gets room totals
app/routers/rooms.py - Room Endpoints → Response Cache: reads and writes availability
app/routers/rooms.py - Room Endpoints → UTC Time Utilities: formats intervals
app/routers/rooms.py - Room Statistics → Domain Models: queries bookings
app/services/stats.py - Admin Reports & Export → Token & Password Auth: requires admin
app/routers/admin.py - Admin Reports & Export → SQLAlchemy Database: gets sessions
app/routers/admin.py - Admin Reports & Export → Domain Models: queries report data
app/routers/admin.py - Admin Reports & Export → CSV Export: generates CSV
app/routers/admin.py - Admin Reports & Export → Response Cache: reads and writes reports
app/routers/admin.py - Admin Reports & Export → UTC Time Utilities: parses date range
app/routers/admin.py - CSV Export → Domain Models: queries bookings
app/services/export.py - CSV Export → UTC Time Utilities: formats timestamps
app/services/export.py