# aravinnndddd/cep-hall architecture

> Architecture diagram of the GitHub repository aravinnndddd/cep-hall, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aravinnndddd/cep-hall
- Repository: https://github.com/aravinnndddd/cep-hall

## Overview

1. **System shape**
   CEP Hall is a single-page campus resource booking application built with React + TypeScript and bundled by Vite. The frontend is the entire application surface; persistence, authentication, and role data are handled through Firebase services rather than a custom backend.

2. **Primary runtime boundary**
   All user interaction happens in the browser. The app is deployed as a static frontend on Vercel, with Firestore and Firebase Authentication acting as the external stateful services. This means the main architectural boundary is: UI/client code on one side, Firebase-managed identity and data on the other.

3. **Application shell**
   `src/main.tsx` boots the app, and `src/App.tsx` defines the top-level routing and composition. Shared chrome and layout concerns are centralized in `src/components/Layout.tsx` and `Navbar.tsx`, while `SeoManager.tsx` manages per-page metadata for the public-facing pages.

4. **Authentication and identity**
   `src/contexts/AuthContext.tsx` is the core state boundary for identity. It receives Firebase Auth session state, resolves the current user’s role, and exposes that to the rest of the app. This context is also where the app distinguishes super admin behavior from regular users and approvers.

5. **Access control**
   Admin-only navigation is enforced in the UI through `ProtectedAdminRoute.tsx`. Role-based access is not only a UI concern: the repository’s Firestore rules in the README show that write access is restricted by collection, and a designated super admin email controls sensitive admin data like resources and approvers.

6. **User-facing workflow**
   The main user path starts at `LandingPage.tsx` and `Login.tsx`, then moves into `Dashboard.tsx`, `BookingForm.tsx`, `MyBookings.tsx`, and `CalendarView.tsx`. These pages support browsing resources, checking availability, creating booking requests, and tracking request status across the approval lifecycle.

7. **Approval and administration**
   The administrative surface is split into `AdminPanel.tsx`, `AdminResources.tsx`, and `AdminApprovers.tsx`. These pages manage the resource catalog and the approver hierarchy, while the approval workflow itself is role-driven: HOD/staff/principal decisions advance booking status through the Firestore booking records.

8. **Data model and storage**
   Firestore is the system of record for at least three collections: resources, bookings, and authorized approvers. Resources describe bookable assets; bookings carry request details plus approval metadata; authorized approvers map emails to roles and department/resource scope. The architecture depends on this shared document model for both UI rendering and access decisions.

9. **Booking status flow**
   Booking state is the central business process. A booking is created as a request, then moves through waiting and approval states until it becomes approved, rejected, or correction-allowed. The README shows two variants of the approval chain depending on resource type: labs route through staff, while departmental resources route through HOD, and both end with principal approval.

10. **Document generation**
   `src/utils/pdfGenerator.ts` is a separate utility boundary for generating approval PDFs on the client using jsPDF. This sits downstream of the booking workflow: once a booking is approved, the app can produce a downloadable document without a server-side rendering or file generation service.

11. **Shared types and utilities**
   `src/types.ts` defines the booking, resource, and approver shapes used across pages and contexts, while `src/lib/utils.ts` contains shared helper logic. `src/lib/firebase.ts` is the integration point where Firebase configuration and SDK wiring are isolated from the rest of the application.

12. **Public and deployment assets**
   The `public/` directory contains static files such as robots and sitemap entries, which support SEO and crawlers for the public landing pages. `vercel.json` and `vite.config.ts` define the deployment/build boundary for a static SPA, with `index.html` as the entry document.

13. **Architecture summary for a diagram**
   The clearest diagram is: browser UI → auth context → Firebase Auth for login → Firestore for role/resource/booking data → UI pages for booking and admin workflows → client-side PDF generation for approvals. The only external services materially in scope are Firebase Auth, Cloud Firestore, and Vercel hosting.

Main entry points: [`src/App.tsx`](https://github.com/aravinnndddd/cep-hall/blob/main/src/App.tsx) (App shell), [`src/contexts/AuthContext.tsx`](https://github.com/aravinnndddd/cep-hall/blob/main/src/contexts/AuthContext.tsx) (Auth context), [`src/pages/Dashboard.tsx`](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/Dashboard.tsx) (Dashboard), [`src/pages/BookingForm.tsx`](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/BookingForm.tsx) (Booking form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_client["Client App"]
  node_node_main["main<br/>entrypoint<br/>[main.tsx]"]
  node_node_app["App shell<br/>router/composition<br/>[App.tsx]"]
  node_node_layout["Layout<br/>shell<br/>[Layout.tsx]"]
  node_node_navbar["Navbar<br/>[Navbar.tsx]"]
  node_node_seo["SEO<br/>metadata<br/>[SeoManager.tsx]"]
  node_node_authctx["Auth context<br/>state context<br/>[AuthContext.tsx]"]
  node_node_guard["Admin guard<br/>route guard"]
  node_node_landing["Landing<br/>page<br/>[LandingPage.tsx]"]
  node_node_login["Login<br/>page<br/>[Login.tsx]"]
  node_node_dashboard["Dashboard<br/>page<br/>[Dashboard.tsx]"]
  node_node_booking["Booking form<br/>page<br/>[BookingForm.tsx]"]
  node_node_mybookings["My bookings<br/>page<br/>[MyBookings.tsx]"]
  node_node_calendar["Calendar view<br/>page<br/>[CalendarView.tsx]"]
  node_node_adminpanel["Admin panel<br/>page<br/>[AdminPanel.tsx]"]
  node_node_resources["Resources<br/>page<br/>[AdminResources.tsx]"]
  node_node_approvers["Approvers<br/>page<br/>[AdminApprovers.tsx]"]
  node_node_pdf["PDF generator<br/>[pdfGenerator.ts]"]
  node_node_types["Shared types<br/>schema<br/>[types.ts]"]
end

subgraph group_group_data["State & Services"]
  node_node_firebase["Firebase SDK<br/>integration<br/>[firebase.ts]"]
  node_node_firestore[("Cloud Firestore<br/>datastore")]
  node_node_auth[("Firebase Auth<br/>identity service")]
end

subgraph group_group_deploy["Build & Deploy"]
  node_node_vercel["Vercel<br/>hosting<br/>[vercel.json]"]
  node_node_vite["Vite build<br/>build config<br/>[vite.config.ts]"]
  node_node_index["index.html<br/>document shell<br/>[index.html]"]
  node_node_public["Public assets<br/>static assets"]
end

node_node_main -->|"mounts"| node_node_app
node_node_app -->|"wraps"| node_node_layout
node_node_app -->|"includes"| node_node_navbar
node_node_app -->|"manages"| node_node_seo
node_node_app -->|"connects"| node_node_authctx
node_node_authctx -->|"reads session"| node_node_auth
node_node_authctx -->|"resolves role"| node_node_firestore
node_node_firebase -->|"initializes"| node_node_auth
node_node_firebase -->|"initializes"| node_node_firestore
node_node_landing -->|"routes to"| node_node_login
node_node_login -->|"authenticates via"| node_node_authctx
node_node_dashboard -->|"starts"| node_node_booking
node_node_dashboard -->|"shows"| node_node_mybookings
node_node_dashboard -->|"shows"| node_node_calendar
node_node_booking -->|"writes bookings"| node_node_firestore
node_node_mybookings -->|"reads bookings"| node_node_firestore
node_node_calendar -->|"reads resources"| node_node_firestore
node_node_guard -->|"protects"| node_node_adminpanel
node_node_adminpanel -->|"navigates"| node_node_resources
node_node_adminpanel -->|"navigates"| node_node_approvers
node_node_resources -->|"manages resources"| node_node_firestore
node_node_approvers -->|"manages approvers"| node_node_firestore
node_node_booking -->|"exports"| node_node_pdf
node_node_pdf -->|"uses shapes"| node_node_types
node_node_landing -->|"supported by"| node_node_public
node_node_index -->|"loads"| node_node_main
node_node_vite -->|"builds from"| node_node_index
node_node_vercel -->|"deploys"| node_node_vite

click node_node_main "https://github.com/aravinnndddd/cep-hall/blob/main/src/main.tsx"
click node_node_app "https://github.com/aravinnndddd/cep-hall/blob/main/src/App.tsx"
click node_node_layout "https://github.com/aravinnndddd/cep-hall/blob/main/src/components/Layout.tsx"
click node_node_navbar "https://github.com/aravinnndddd/cep-hall/blob/main/src/components/Navbar.tsx"
click node_node_seo "https://github.com/aravinnndddd/cep-hall/blob/main/src/components/SeoManager.tsx"
click node_node_authctx "https://github.com/aravinnndddd/cep-hall/blob/main/src/contexts/AuthContext.tsx"
click node_node_guard "https://github.com/aravinnndddd/cep-hall/blob/main/src/components/ProtectedAdminRoute.tsx"
click node_node_landing "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/LandingPage.tsx"
click node_node_login "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/Login.tsx"
click node_node_dashboard "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/Dashboard.tsx"
click node_node_booking "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/BookingForm.tsx"
click node_node_mybookings "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/MyBookings.tsx"
click node_node_calendar "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/CalendarView.tsx"
click node_node_adminpanel "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminPanel.tsx"
click node_node_resources "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminResources.tsx"
click node_node_approvers "https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminApprovers.tsx"
click node_node_pdf "https://github.com/aravinnndddd/cep-hall/blob/main/src/utils/pdfGenerator.ts"
click node_node_types "https://github.com/aravinnndddd/cep-hall/blob/main/src/types.ts"
click node_node_firebase "https://github.com/aravinnndddd/cep-hall/blob/main/src/lib/firebase.ts"
click node_node_vercel "https://github.com/aravinnndddd/cep-hall/blob/main/vercel.json"
click node_node_vite "https://github.com/aravinnndddd/cep-hall/blob/main/vite.config.ts"
click node_node_index "https://github.com/aravinnndddd/cep-hall/blob/main/index.html"
click node_node_public "https://github.com/aravinnndddd/cep-hall/tree/main/public"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_app,node_node_layout,node_node_navbar,node_node_seo,node_node_authctx,node_node_guard,node_node_landing,node_node_login,node_node_dashboard,node_node_booking,node_node_mybookings,node_node_calendar,node_node_adminpanel,node_node_resources,node_node_approvers,node_node_pdf,node_node_types toneBlue
class node_node_firebase,node_node_firestore,node_node_auth toneAmber
class node_node_vercel,node_node_vite,node_node_index,node_node_public toneMint
```

## Components

### Client App

React SPA, shared UI, pages, and client-side state.

- [main](https://github.com/aravinnndddd/cep-hall/blob/main/src/main.tsx): entrypoint · Bootstraps the React app. · `src/main.tsx`
- [App shell](https://github.com/aravinnndddd/cep-hall/blob/main/src/App.tsx): router/composition · Top-level routing and app composition. · `src/App.tsx`
- [Layout](https://github.com/aravinnndddd/cep-hall/blob/main/src/components/Layout.tsx): shell · Shared page chrome and page framing. · `src/components/Layout.tsx`
- [Navbar](https://github.com/aravinnndddd/cep-hall/blob/main/src/components/Navbar.tsx): nav · Primary navigation and user entry points. · `src/components/Navbar.tsx`
- [SEO](https://github.com/aravinnndddd/cep-hall/blob/main/src/components/SeoManager.tsx): metadata · Page metadata for public-facing routes. · `src/components/SeoManager.tsx`
- [Auth context](https://github.com/aravinnndddd/cep-hall/blob/main/src/contexts/AuthContext.tsx): state context · Central identity and role state for the app. · `src/contexts/AuthContext.tsx`
- [Admin guard](https://github.com/aravinnndddd/cep-hall/blob/main/src/components/ProtectedAdminRoute.tsx): route guard · UI-level protection for admin-only routes. · `src/components/ProtectedAdminRoute.tsx`
- [Landing](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/LandingPage.tsx): page · Public entry page for the service. · `src/pages/LandingPage.tsx`
- [Login](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/Login.tsx): page · Authentication entry and sign-in flow. · `src/pages/Login.tsx`
- [Dashboard](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/Dashboard.tsx): page · User home for booking and status overview. · `src/pages/Dashboard.tsx`
- [Booking form](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/BookingForm.tsx): page · Creates booking requests and captures details. · `src/pages/BookingForm.tsx`
- [My bookings](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/MyBookings.tsx): page · Shows request history and current status. · `src/pages/MyBookings.tsx`
- [Calendar view](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/CalendarView.tsx): page · Resource availability and scheduling view. · `src/pages/CalendarView.tsx`
- [Admin panel](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminPanel.tsx): page · Administrative entry point and overview. · `src/pages/AdminPanel.tsx`
- [Resources](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminResources.tsx): page · Manages the bookable resource catalog. · `src/pages/AdminResources.tsx`
- [Approvers](https://github.com/aravinnndddd/cep-hall/blob/main/src/pages/AdminApprovers.tsx): page · Manages approver roles and scope. · `src/pages/AdminApprovers.tsx`
- [PDF generator](https://github.com/aravinnndddd/cep-hall/blob/main/src/utils/pdfGenerator.ts): utility · Client-side approval document generation. · `src/utils/pdfGenerator.ts`
- [Shared types](https://github.com/aravinnndddd/cep-hall/blob/main/src/types.ts): schema · Common booking, resource, and approver shapes. · `src/types.ts`

### State & Services

Firebase-backed identity and data storage used by the frontend.

- [Firebase SDK](https://github.com/aravinnndddd/cep-hall/blob/main/src/lib/firebase.ts): integration · Isolated Firebase configuration and wiring. · `src/lib/firebase.ts`
- **Cloud Firestore**: datastore · System of record for resources, bookings, and approvers.
- **Firebase Auth**: identity service · External authentication and session provider.

### Build & Deploy

Static app entry points, build config, and hosted assets.

- [Vercel](https://github.com/aravinnndddd/cep-hall/blob/main/vercel.json): hosting · Static frontend hosting and deployment target. · `vercel.json`
- [Vite build](https://github.com/aravinnndddd/cep-hall/blob/main/vite.config.ts): build config · Frontend bundling and local build pipeline. · `vite.config.ts`
- [index.html](https://github.com/aravinnndddd/cep-hall/blob/main/index.html): document shell · SPA entry document. · `index.html`
- [Public assets](https://github.com/aravinnndddd/cep-hall/tree/main/public): static assets · SEO and crawler-facing static files. · `public`

## Connections

- main → App shell: mounts · Bootstraps the application shell.
- App shell → Layout: wraps · Provides shared page framing.
- App shell → Navbar: includes · Renders global navigation.
- App shell → SEO: manages · Sets per-page metadata.
- App shell → Auth context: connects · Shares auth and role state across pages.
- Auth context → Firebase Auth: reads session · Consumes Firebase Auth session state.
- Auth context → Cloud Firestore: resolves role · Loads user role and access scope.
- Firebase SDK → Firebase Auth: initializes · Configures authentication client.
- Firebase SDK → Cloud Firestore: initializes · Configures database client.
- Landing → Login: routes to · Public entry leads into sign-in.
- Login → Auth context: authenticates via · Sign-in updates identity state.
- Dashboard → Booking form: starts · User booking workflow entry.
- Dashboard → My bookings: shows · Surfaces current requests and status.
- Dashboard → Calendar view: shows · Displays availability and schedule.
- Booking form → Cloud Firestore: writes bookings · Creates and updates booking documents.
- My bookings → Cloud Firestore: reads bookings · Fetches booking history and state.
- Calendar view → Cloud Firestore: reads resources · Loads resource availability data.
- Admin guard → Admin panel: protects · Blocks non-admin access to admin routes.
- Admin panel → Resources: navigates · Admin resource management surface.
- Admin panel → Approvers: navigates · Admin approver management surface.
- Resources → Cloud Firestore: manages resources · Edits resource catalog documents.
- Approvers → Cloud Firestore: manages approvers · Edits approver documents and scope.
- Booking form → PDF generator: exports · Generates approval PDFs client-side.
- PDF generator → Shared types: uses shapes · Shares booking data model definitions.
- Landing → Public assets: supported by · Uses static SEO and crawler assets.
- index.html → main: loads · SPA document loads the app entry.
- Vite build → index.html: builds from · Bundles the entry document and assets.
- Vercel → Vite build: deploys · Hosts the built static frontend.
