# mlakshmipriya0601/campus-flow architecture

> Architecture diagram of the GitHub repository mlakshmipriya0601/campus-flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mlakshmipriya0601/campus-flow
- Repository: https://github.com/mlakshmipriya0601/campus-flow

## Overview

CampusFlow is a role-based, single-page campus operations demo. A user enters through login and guarded navigation, opens a role-appropriate dashboard or workflow, and the page calls Promise-based services backed by browser localStorage; custom collection events refresh views. The main domain areas are gate passes, events, complaints, bookings, latecomers, and classrooms, with reporting and campus administration alongside them. The README documents capabilities beyond the sampled code; those branches are included, but their internal call links are not inferred where source evidence is missing.

Main entry points: [`src/App.tsx`](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/App.tsx) (App router), [`src/services/index.ts`](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/index.ts) (Service registry), [`src/pages/EventDetailPage.tsx`](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/EventDetailPage.tsx) (Event workflow), [`src/services/events.ts`](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/events.ts) (Event service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App router<br/>[App.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_guards["Role guards<br/>[guards.tsx]"]
  node_navigation["Role navigation<br/>[navigation.ts]"]
  node_shell["Application shell<br/>[AppLayout.tsx]"]
  node_dashboard["Role dashboards<br/>[DashboardPage.tsx]"]
end

subgraph group_workflows["Campus workflows"]
  node_gatepasses["Gate pass workflow<br/>[GatePassPage.tsx]"]
  node_events["Event workflow"]
  node_complaints["Complaint workflow<br/>[ComplaintsPage.tsx]"]
  node_hall_bookings["Hall bookings"]
  node_latecomers["Latecomer tracking<br/>[LatecomersPage.tsx]"]
  node_classrooms["Classroom directory<br/>[ClassroomsPage.tsx]"]
  node_admin_ops["Campus administration<br/>[UsersPage.tsx]"]
end

subgraph group_data["Services and data"]
  node_gatepass_service["Gate pass service<br/>[gatePass.ts]"]
  node_event_service["Event service<br/>[events.ts]"]
  node_complaint_service["Complaint service<br/>[complaints.ts]"]
  node_collection_hook["Reactive collection hook<br/>[useCollection.ts]"]
  node_service_registry["Service registry<br/>[index.ts]"]
  node_collection_service[("Collection storage<br/>[collection.ts]")]
  node_seed_data["Demo seed data<br/>[seed.ts]"]
end

subgraph group_shared["Shared capabilities"]
  node_reports["Operational reports<br/>[ReportsPage.tsx]"]
  node_notifications["Notifications"]
  node_shared_ui["Shared UI components<br/>[ui.tsx]"]
  node_data_table["Data table<br/>[DataTable.tsx]"]
  node_modal["Modal dialogs<br/>[Modal.tsx]"]
  node_permissions["Permission rules<br/>[permissions.ts]"]
  node_event_rules["Event rules<br/>[events.ts]"]
  node_complaint_rules["Complaint rules<br/>[complaints.ts]"]
  node_date_utils["Date utilities<br/>[date.ts]"]
  node_toast["Toast feedback<br/>[ToastContext.tsx]"]
end

node_user(("Campus user"))
node_browser_storage[("Browser localStorage")]

node_user -->|"opens"| node_app
node_app -->|"requires"| node_auth
node_app -->|"guards routes"| node_guards
node_app -->|"renders"| node_shell
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_gatepasses
node_app -->|"routes to"| node_events
node_app -->|"routes to"| node_complaints
node_app -->|"routes to"| node_hall_bookings
node_app -->|"routes to"| node_latecomers
node_app -->|"routes to"| node_classrooms
node_app -->|"routes to"| node_admin_ops
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_notifications
node_guards -->|"checks access"| node_navigation
node_shell -->|"builds menu"| node_navigation
node_gatepasses -->|"requests and records"| node_gatepass_service
node_events -->|"manages events"| node_event_service
node_events -->|"checks visibility"| node_event_rules
node_complaints -->|"manages complaints"| node_complaint_service
node_hall_bookings -.->|"uses bookings"| node_service_registry
node_latecomers -.->|"uses records"| node_service_registry
node_classrooms -.->|"uses rooms"| node_service_registry
node_admin_ops -.->|"manages users"| node_service_registry
node_reports -->|"reads operations"| node_service_registry
node_notifications -.->|"reads notifications"| node_service_registry
node_dashboard -->|"loads summaries"| node_collection_hook
node_collection_hook -->|"lists and refreshes"| node_collection_service
node_service_registry -->|"creates collections"| node_collection_service
node_service_registry -->|"initializes from"| node_seed_data
node_collection_service -->|"reads and writes"| node_browser_storage
node_event_service -->|"notifies users"| node_service_registry
node_event_service -->|"validates actions"| node_event_rules
node_event_service -->|"formats dates"| node_date_utils
node_complaint_service -->|"applies rules"| node_complaint_rules
node_gatepasses -->|"checks actions"| node_permissions
node_events -->|"checks actions"| node_permissions
node_events -->|"renders participants"| node_data_table
node_events -->|"opens dialogs"| node_modal
node_gatepasses -->|"renders passes"| node_data_table
node_app -.->|"uses interface"| node_shared_ui
node_event_service -->|"reports outcome"| node_toast

click node_app "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/App.tsx"
click node_auth "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/context/AuthContext.tsx"
click node_guards "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/routes/guards.tsx"
click node_navigation "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/routes/navigation.ts"
click node_shell "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/layouts/AppLayout.tsx"
click node_dashboard "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/dashboard/DashboardPage.tsx"
click node_gatepasses "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/GatePassPage.tsx"
click node_gatepass_service "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/gatePass.ts"
click node_events "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/EventDetailPage.tsx"
click node_event_service "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/events.ts"
click node_complaints "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ComplaintsPage.tsx"
click node_complaint_service "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/complaints.ts"
click node_hall_bookings "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/HallBookingPage.tsx"
click node_latecomers "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/LatecomersPage.tsx"
click node_classrooms "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ClassroomsPage.tsx"
click node_admin_ops "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/UsersPage.tsx"
click node_reports "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ReportsPage.tsx"
click node_notifications "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/NotificationsPage.tsx"
click node_shared_ui "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/ui.tsx"
click node_data_table "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/DataTable.tsx"
click node_modal "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/Modal.tsx"
click node_permissions "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/permissions.ts"
click node_collection_hook "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/hooks/useCollection.ts"
click node_service_registry "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/index.ts"
click node_collection_service "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/collection.ts"
click node_seed_data "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/data/seed.ts"
click node_event_rules "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/events.ts"
click node_complaint_rules "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/complaints.ts"
click node_date_utils "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/date.ts"
click node_toast "https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/context/ToastContext.tsx"

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_app,node_auth,node_guards,node_navigation,node_shell,node_dashboard,node_user toneBlue
class node_gatepasses,node_events,node_complaints,node_hall_bookings,node_latecomers,node_classrooms,node_admin_ops,node_browser_storage toneAmber
class node_gatepass_service,node_event_service,node_complaint_service,node_collection_hook,node_service_registry,node_collection_service,node_seed_data toneMint
class node_reports,node_notifications,node_shared_ui,node_data_table,node_modal,node_permissions,node_event_rules,node_complaint_rules,node_date_utils,node_toast toneRose
```

## Components

### Application shell

- [App router](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication state](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Role guards](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/routes/guards.tsx): `src/routes/guards.tsx`
- [Role navigation](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/routes/navigation.ts): `src/routes/navigation.ts`
- [Application shell](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/layouts/AppLayout.tsx): `src/layouts/AppLayout.tsx`
- [Role dashboards](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/dashboard/DashboardPage.tsx): `src/pages/dashboard/DashboardPage.tsx`

### Campus workflows

- [Gate pass workflow](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/GatePassPage.tsx): `src/pages/GatePassPage.tsx`
- [Event workflow](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/EventDetailPage.tsx): `src/pages/EventDetailPage.tsx`
- [Complaint workflow](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ComplaintsPage.tsx): `src/pages/ComplaintsPage.tsx`
- [Hall bookings](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/HallBookingPage.tsx): `src/pages/HallBookingPage.tsx`
- [Latecomer tracking](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/LatecomersPage.tsx): `src/pages/LatecomersPage.tsx`
- [Classroom directory](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ClassroomsPage.tsx): `src/pages/ClassroomsPage.tsx`
- [Campus administration](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/UsersPage.tsx): `src/pages/UsersPage.tsx`

### Services and data

- [Gate pass service](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/gatePass.ts): `src/services/gatePass.ts`
- [Event service](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/events.ts): `src/services/events.ts`
- [Complaint service](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/complaints.ts): `src/services/complaints.ts`
- [Reactive collection hook](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/hooks/useCollection.ts): `src/hooks/useCollection.ts`
- [Service registry](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/index.ts): `src/services/index.ts`
- [Collection storage](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/services/collection.ts): `src/services/collection.ts`
- [Demo seed data](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/data/seed.ts): `src/data/seed.ts`

### Shared capabilities

- [Operational reports](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`
- [Notifications](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/pages/NotificationsPage.tsx): `src/pages/NotificationsPage.tsx`
- [Shared UI components](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/ui.tsx): `src/components/ui/ui.tsx`
- [Data table](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/DataTable.tsx): `src/components/ui/DataTable.tsx`
- [Modal dialogs](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/components/ui/Modal.tsx): `src/components/ui/Modal.tsx`
- [Permission rules](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/permissions.ts): `src/utils/permissions.ts`
- [Event rules](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/events.ts): `src/utils/events.ts`
- [Complaint rules](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/complaints.ts): `src/utils/complaints.ts`
- [Date utilities](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/utils/date.ts): `src/utils/date.ts`
- [Toast feedback](https://github.com/mlakshmipriya0601/campus-flow/blob/main/src/context/ToastContext.tsx): `src/context/ToastContext.tsx`

### Other components

- **Campus user**
- **Browser localStorage**

## Connections

- Campus user → App router: opens (evidence: `src/App.tsx`)
- App router → Authentication state: requires (evidence: `src/App.tsx`)
- App router → Role guards: guards routes (evidence: `src/App.tsx`)
- App router → Application shell: renders (evidence: `src/App.tsx`)
- App router → Role dashboards: routes to (evidence: `src/App.tsx`)
- App router → Gate pass workflow: routes to (evidence: `src/App.tsx`)
- App router → Event workflow: routes to (evidence: `src/App.tsx`)
- App router → Complaint workflow: routes to (evidence: `src/App.tsx`)
- App router → Hall bookings: routes to (evidence: `src/App.tsx`)
- App router → Latecomer tracking: routes to (evidence: `src/App.tsx`)
- App router → Classroom directory: routes to (evidence: `src/App.tsx`)
- App router → Campus administration: routes to (evidence: `src/App.tsx`)
- App router → Operational reports: routes to (evidence: `src/App.tsx`)
- App router → Notifications: routes to (evidence: `src/App.tsx`)
- Role guards → Role navigation: checks access (evidence: `src/routes/guards.tsx`)
- Application shell → Role navigation: builds menu
- Gate pass workflow → Gate pass service: requests and records (evidence: `src/pages/GatePassPage.tsx`)
- Event workflow → Event service: manages events (evidence: `src/pages/EventDetailPage.tsx`)
- Event workflow → Event rules: checks visibility (evidence: `src/pages/EventDetailPage.tsx`)
- Complaint workflow → Complaint service: manages complaints (evidence: `README.md`)
- Hall bookings → Service registry: uses bookings
- Latecomer tracking → Service registry: uses records
- Classroom directory → Service registry: uses rooms
- Campus administration → Service registry: manages users
- Operational reports → Service registry: reads operations (evidence: `src/pages/ReportsPage.tsx`)
- Notifications → Service registry: reads notifications
- Role dashboards → Reactive collection hook: loads summaries (evidence: `src/pages/dashboard/DashboardPage.tsx`)
- Reactive collection hook → Collection storage: lists and refreshes (evidence: `src/hooks/useCollection.ts`)
- Service registry → Collection storage: creates collections (evidence: `src/services/index.ts`)
- Service registry → Demo seed data: initializes from (evidence: `src/services/index.ts`)
- Collection storage → Browser localStorage: reads and writes (evidence: `README.md`)
- Event service → Service registry: notifies users (evidence: `src/services/events.ts`)
- Event service → Event rules: validates actions (evidence: `src/services/events.ts`)
- Event service → Date utilities: formats dates (evidence: `src/services/events.ts`)
- Complaint service → Complaint rules: applies rules (evidence: `src/services/complaints.ts`)
- Gate pass workflow → Permission rules: checks actions (evidence: `src/pages/GatePassPage.tsx`)
- Event workflow → Permission rules: checks actions (evidence: `src/pages/EventDetailPage.tsx`)
- Event workflow → Data table: renders participants (evidence: `src/pages/EventDetailPage.tsx`)
- Event workflow → Modal dialogs: opens dialogs (evidence: `src/pages/EventDetailPage.tsx`)
- Gate pass workflow → Data table: renders passes (evidence: `src/pages/GatePassPage.tsx`)
- App router → Shared UI components: uses interface
- Event service → Toast feedback: reports outcome (evidence: `src/hooks/useEventAction.ts`)
