How aravinnndddd/cep-hall works
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: App.tsx App shell · AuthContext.tsx Auth context · Dashboard.tsx Dashboard · BookingForm.tsx Booking form
Components 25
Client App
React SPA, shared UI, pages, and client-side state.
- main · Bootstraps the React app.
src/main.tsx - App shell · Top-level routing and app composition.
src/App.tsx - Layout · Shared page chrome and page framing.
src/components/Layout.tsx - Navbar · Primary navigation and user entry points.
src/components/Navbar.tsx - SEO · Page metadata for public-facing routes.
src/components/SeoManager.tsx - Auth context · Central identity and role state for the app.
src/contexts/AuthContext.tsx - Admin guard · UI-level protection for admin-only routes.
src/components/ProtectedAdminRoute.tsx - Landing · Public entry page for the service.
src/pages/LandingPage.tsx - Login · Authentication entry and sign-in flow.
src/pages/Login.tsx - Dashboard · User home for booking and status overview.
src/pages/Dashboard.tsx - Booking form · Creates booking requests and captures details.
src/pages/BookingForm.tsx - My bookings · Shows request history and current status.
src/pages/MyBookings.tsx - Calendar view · Resource availability and scheduling view.
src/pages/CalendarView.tsx - Admin panel · Administrative entry point and overview.
src/pages/AdminPanel.tsx - Resources · Manages the bookable resource catalog.
src/pages/AdminResources.tsx - Approvers · Manages approver roles and scope.
src/pages/AdminApprovers.tsx - PDF generator · Client-side approval document generation.
src/utils/pdfGenerator.ts - Shared types · Common booking, resource, and approver shapes.
src/types.ts
State & Services
Firebase-backed identity and data storage used by the frontend.
- Firebase SDK · Isolated Firebase configuration and wiring.
src/lib/firebase.ts - Cloud Firestore · System of record for resources, bookings, and approvers.
- Firebase Auth · External authentication and session provider.
Build & Deploy
Static app entry points, build config, and hosted assets.
- Vercel · Static frontend hosting and deployment target.
vercel.json - Vite build · Frontend bundling and local build pipeline.
vite.config.ts - index.html · SPA entry document.
index.html - Public assets · SEO and crawler-facing static files.
public
Connections 28
- 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.