How purnasai1807-lgtm/college_project works
Purpose and principal workflow
ACE Canteen is a mobile-first ordering and operations application for a college canteen. A student initiates the main workflow through the browser app: browse the catalogue, submit an order, track its status, and present a signed pickup link; staff manage the order queue and confirm collection. Admins operate catalogue, inventory, users, and reports. The backend is a FastAPI application that serves the web app and API, while relational state is stored through SQLAlchemy.
Components
Browser experience
• Canteen web app — frontend/js/app.js: Main browser client for student, staff, and admin workflows; the README documents those role-specific capabilities.
• QR pickup page — frontend/js/pickup.js: Handles the mobile-friendly public pickup view; the README describes its limited order details and token submission behavior.
• Installable app shell — frontend/sw.js: Service worker for the web app; the backend serves it at the origin root, as shown in backend/app/main.py.
HTTP application and domain workflows
• FastAPI entry point and page/API host — backend/app/main.py: Defines the application’s HTTP routes, serves the web app and pickup page, and implements API behavior. The excerpt shows page routes and API handlers for authentication, catalogue, inventory, notifications, and canteen status.
• Identity and role authorization — backend/app/security.py: Hashes and verifies passwords, issues and validates signed bearer tokens, and enforces role requirements for protected routes.
• Catalogue and category operations — backend/app/main.py: Implements product and category administration and the catalogue-facing API; the excerpt shows product validation and category updates.
• Order, payment-gated lifecycle, and pickup — backend/app/main.py: Implements order payload and lifecycle behavior; the excerpt identifies checkout, payment-gated order handling, pickup tokens, and staff/admin queue as API responsibilities.
• Inventory, suppliers, and stock movements — backend/app/main.py: Implements inventory operations, stock thresholds, purchase-order inputs, and stock movement/audit behavior; the README documents batches, suppliers, expiry, and inventory management.
• Operational reporting and audit history — backend/app/main.py: Implements admin reports and audit routes; the excerpt explicitly marks the reporting and immutable audit-history phase.
• Request/response contracts — backend/app/schemas.py: Defines validated API inputs and outputs for users, products, orders, and stock adjustments.
Persistence and supporting application behavior
• Relational domain state — backend/app/models.py: Defines SQLAlchemy entities and relationships for users, products, orders, payments, settings, and inventory movements.
• Database session layer — backend/app/database.py: Creates the SQLite/PostgreSQL-compatible engine and session factory and exposes the request-scoped database dependency.
• Environment and operational settings — backend/app/config.py: Loads and validates database, security, payment, email, canteen-hours, and pickup-slot settings.
• Email delivery — backend/app/emailer.py: Provides the application’s email capability; the README documents password-reset and order-ready email behavior, while the excerpted source index shows this module depends on configuration.
• Development data seeding — backend/app/seed.py: Idempotently creates demo categories, products, and initial inventory movements for local development.
• Administrator bootstrap — backend/app/create_admin.py: Provides the documented command-line path for creating the first administrator.
External actors and systems
• Student — null repository path: External user who browses, orders, and checks their order or pickup status.
• Staff — null repository path: External user who manages the queue and confirms collection.
• Admin — null repository path: External user who manages products, inventory, users, and reports.
• Phone camera / browser — null repository path: Opens the HTTPS pickup link from a QR code, as documented in the README.
• Database — null repository path: SQLite or PostgreSQL configured through DATABASE_URL; stores the application’s relational state.
Relationships
• Student -> Canteen web app: initiates browsing and ordering; evidence: README.md.
• Staff -> Canteen web app: initiates queue and pickup workflows; evidence: README.md.
• Admin -> Canteen web app: initiates administration and reporting workflows; evidence: README.md.
• Phone camera / browser -> QR pickup page: opens the QR link; evidence: README.md.
• Canteen web app -> FastAPI entry point and page/API host: uses the application’s HTTP interface; evidence: README.md (API use is documented, but the client request implementation is not shown in the excerpts).
• FastAPI entry point and page/API host -> Canteen web app: serves the application home page; evidence: backend/app/main.py (excerpt).
• FastAPI entry point and page/API host -> QR pickup page: serves the pickup page; evidence: backend/app/main.py (excerpt).
• FastAPI entry point and page/API host -> Identity and role authorization: uses authentication and authorization dependencies; evidence: backend/app/main.py (SOURCE INDEX).
• Identity and role authorization -> Database session layer: obtains database access for current-user lookup; evidence: backend/app/security.py (excerpt).
• FastAPI entry point and page/API host -> Relational domain state: queries and mutates domain records; evidence: backend/app/main.py (SOURCE INDEX).
• FastAPI entry point and page/API host -> Request/response contracts: imports and uses API schemas; evidence: backend/app/main.py (SOURCE INDEX).
• Database session layer -> Environment and operational settings: configures the database URL; evidence: backend/app/database.py (excerpt).
• Relational domain state -> Database session layer: derives its ORM base from the database module; evidence: backend/app/models.py (SOURCE INDEX).
• FastAPI entry point and page/API host -> Email delivery: uses email functionality; evidence: backend/app/main.py (SOURCE INDEX).
• Email delivery -> Environment and operational settings: reads application settings; evidence: backend/app/emailer.py (SOURCE INDEX).
• FastAPI entry point and page/API host -> Database: persists and reads application state through the session layer; evidence: backend/app/main.py (SOURCE INDEX and backend/app/database.py excerpt).
Coverage limits
The sampled primary main.py excerpt omits most route implementations, so finer-grained order/payment/pickup sequencing and provider calls cannot be established. The README documents payment and QR behavior, but no concrete payment-provider call site is shown. Frontend files were read but their contents were not excerpted; detailed client-to-route wiring is therefore not asserted beyond documented behavior. The tree also contains numbered duplicate filenames; their relationship to the primary files is unclear, so this map describes the primary paths.
Main entry points: main.py FastAPI host · app.js Canteen web app · database.py Database session layer · security.py Identity and authorization
Components 14
External actors
- Student
- Staff
- Admin
- Phone camera / browser
- Database · SQLite or PostgreSQL configured through DATABASE_URL.
Browser experience
- Canteen web app · Supports student ordering, staff queue and pickup workflows, and admin operations and reporting.
frontend/js/app.js - QR pickup page · Public mobile-friendly pickup view accepts a token and shows limited order details.
frontend/js/pickup.js
HTTP application
- FastAPI host · Hosts pages and APIs for authentication, catalogue, order and payment-gated lifecycle, pickup, inventory, and reporting.
backend/app/main.py - Identity and authorization
backend/app/security.py - API contracts
backend/app/schemas.py
Persistence and support
- Relational domain state · Defines users, products, orders, payments, settings, and inventory movements.
backend/app/models.py - Database session layer · Creates the engine and session factory and exposes request-scoped database access.
backend/app/database.py - Operational settings
backend/app/config.py - Email delivery · Supports documented password-reset and order-ready email behavior.
backend/app/emailer.py
Connections 16
- Student → Canteen web app: Browse and order
README.md - Staff → Canteen web app: Manage queue
README.md - Admin → Canteen web app: Manage operations
README.md - Phone camera / browser → QR pickup page: Open pickup link
README.md - Canteen web app → FastAPI host: Use HTTP API · API use is documented; client request implementation is not shown in the excerpts.
README.md - FastAPI host → Canteen web app: Serve home page
backend/app/main.py - FastAPI host → QR pickup page: Serve pickup page
backend/app/main.py - FastAPI host → Identity and authorization: Use authorization
backend/app/main.py - Identity and authorization → Database session layer: Access user data
backend/app/security.py - FastAPI host → Relational domain state: Query and mutate
backend/app/main.py - FastAPI host → API contracts: Use contracts
backend/app/main.py - Database session layer → Operational settings: Read database URL
backend/app/database.py - Relational domain state → Database session layer: Derive ORM base
backend/app/models.py - FastAPI host → Email delivery: Send email
backend/app/main.py - Email delivery → Operational settings: Read settings
backend/app/emailer.py - FastAPI host → Database: Persist and read · Accesses application state through the session layer.
backend/app/main.py