# poovannan-vp/smart_parking architecture

> Architecture diagram of the GitHub repository poovannan-vp/smart_parking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/poovannan-vp/smart_parking
- Repository: https://github.com/poovannan-vp/smart_parking

## Overview

Smart Parking is a role-based React/Firebase application for live building availability, security occupancy and gate-log operations, and administrative management. Public visitors and staff enter through routed pages; staff authenticate against Firebase and a Firestore profile, then use role-specific dashboards. The main domain branches cover live parking/layout views, gate vehicle lifecycle and audit records, building/user administration, and developer diagnostics. Relationships are limited to README statements and sampled router, auth, and service references; unsampled page wiring is not inferred.

Main entry points: [`src/app/router.tsx`](https://github.com/poovannan-vp/smart_parking/blob/main/src/app/router.tsx) (Role-based routes), [`src/services/buildingService.ts`](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/buildingService.ts) (Building records), [`src/config/firestore.ts`](https://github.com/poovannan-vp/smart_parking/blob/main/src/config/firestore.ts) (Cloud Firestore), [`src/features/admin/pages/AdminDashboardPage.tsx`](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/AdminDashboardPage.tsx) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and access"]
  node_app["Application providers<br/>[providers.tsx]"]
  node_router["Role-based routes<br/>[router.tsx]"]
  node_auth["Authentication session<br/>[useAuth.tsx]"]
  node_authservice["Login and profiles<br/>[authServices.ts]"]
end

subgraph group_parking["Parking operations"]
  node_home["Public availability<br/>[HomePage.tsx]"]
  node_employee["Employee portal"]
  node_security["Occupancy updates"]
  node_layouts["Physical layout views"]
  node_layoutquery["Layout subscriptions"]
  node_slotquery["Slot status subscriptions<br/>[useSlotStatuses.ts]"]
  node_layoutservice["Layout persistence<br/>[layoutService.ts]"]
end

subgraph group_gate["Gate monitoring"]
  node_logs["Vehicle log workflow"]
  node_logspage["Vehicle log console"]
  node_vehicles["Employee vehicles"]
end

subgraph group_admin["Administration"]
  node_analytics["Reports and analytics"]
  node_adminhome["Admin dashboard"]
  node_buildingadmin["Building management<br/>[BuildingsPage.tsx]"]
  node_useradmin["User management<br/>[UsersPage.tsx]"]
  node_createuser["Create staff user<br/>[CreateUserPage.tsx]"]
  node_layoutadmin["Layout editor and import"]
end

subgraph group_support["Diagnostics and data"]
  node_buildings["Building records<br/>[buildingService.ts]"]
  node_firestore[("Cloud Firestore<br/>[firestore.ts]")]
  node_developer["Developer diagnostics"]
  node_diagnostics["Diagnostics service"]
  node_cloudauth["Firebase Authentication"]
end

node_visitor(("Public visitor"))
node_staff(("Staff user"))

node_visitor -->|"opens app"| node_router
node_staff -->|"opens portal"| node_router
node_app -->|"provides routes"| node_router
node_router -->|"routes public"| node_home
node_router -->|"guards staff"| node_auth
node_router -->|"routes employee"| node_employee
node_router -->|"routes security"| node_security
node_router -->|"routes logs"| node_logspage
node_router -->|"routes admin"| node_adminhome
node_router -->|"routes buildings"| node_buildingadmin
node_router -->|"routes users"| node_useradmin
node_router -->|"routes creation"| node_createuser
node_router -->|"routes layouts"| node_layoutadmin
node_staff -->|"signs in"| node_auth
node_auth -->|"loads profile"| node_authservice
node_authservice -->|"authenticates"| node_cloudauth
node_authservice -->|"reads profile"| node_firestore
node_home -.->|"shows availability"| node_buildings
node_employee -->|"reads buildings"| node_buildings
node_employee -->|"manages vehicles"| node_vehicles
node_security -->|"updates occupancy"| node_buildings
node_layouts -.->|"renders layouts"| node_layoutquery
node_layoutquery -->|"subscribes layouts"| node_layoutservice
node_slotquery -->|"reads status"| node_firestore
node_layoutservice -->|"stores geometry"| node_firestore
node_logspage -->|"manages records"| node_logs
node_logs -->|"finds vehicle owner"| node_vehicles
node_logs -->|"writes logs audit"| node_firestore
node_adminhome -->|"loads reports"| node_analytics
node_adminhome -->|"loads buildings"| node_buildings
node_adminhome -->|"loads log data"| node_logs
node_buildingadmin -->|"manages buildings"| node_buildings
node_useradmin -->|"loads assignments"| node_buildings
node_createuser -->|"loads buildings"| node_buildings
node_layoutadmin -->|"edits layouts"| node_layoutservice
node_layoutadmin -->|"selects building"| node_buildings
node_developer -.->|"views diagnostics"| node_diagnostics
node_diagnostics -->|"reads diagnostic data"| node_firestore

click node_app "https://github.com/poovannan-vp/smart_parking/blob/main/src/app/providers.tsx"
click node_router "https://github.com/poovannan-vp/smart_parking/blob/main/src/app/router.tsx"
click node_home "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/home/pages/HomePage.tsx"
click node_auth "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/auth/hooks/useAuth.tsx"
click node_authservice "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/auth/services/authServices.ts"
click node_employee "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/employee/pages/EmployeeDashboardPage.tsx"
click node_security "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/security/pages/SecurityDashboardPage.tsx"
click node_layouts "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/components/PhysicalLayoutView.tsx"
click node_layoutquery "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/hooks/useLocationLayouts.ts"
click node_slotquery "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/hooks/useSlotStatuses.ts"
click node_buildings "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/buildingService.ts"
click node_firestore "https://github.com/poovannan-vp/smart_parking/blob/main/src/config/firestore.ts"
click node_logs "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/vehicleLogService.ts"
click node_logspage "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/security/pages/VehicleLogsPage.tsx"
click node_vehicles "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/employeeVehicleService.ts"
click node_analytics "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/analyticsService.ts"
click node_adminhome "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/AdminDashboardPage.tsx"
click node_buildingadmin "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/BuildingsPage.tsx"
click node_useradmin "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/UsersPage.tsx"
click node_createuser "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/CreateUserPage.tsx"
click node_layoutadmin "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/ParkingLayoutsPage.tsx"
click node_layoutservice "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/layoutService.ts"
click node_developer "https://github.com/poovannan-vp/smart_parking/blob/main/src/features/developer/pages/DeveloperDashboardPage.tsx"
click node_diagnostics "https://github.com/poovannan-vp/smart_parking/blob/main/src/services/developerDiagnosticsService.ts"

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_router,node_auth,node_authservice,node_staff toneBlue
class node_home,node_employee,node_security,node_layouts,node_layoutquery,node_slotquery,node_layoutservice toneAmber
class node_logs,node_logspage,node_vehicles toneMint
class node_analytics,node_adminhome,node_buildingadmin,node_useradmin,node_createuser,node_layoutadmin toneRose
class node_buildings,node_firestore,node_developer,node_diagnostics,node_cloudauth,node_visitor toneIndigo
```

## Components

### App and access

- [Application providers](https://github.com/poovannan-vp/smart_parking/blob/main/src/app/providers.tsx): `src/app/providers.tsx`
- [Role-based routes](https://github.com/poovannan-vp/smart_parking/blob/main/src/app/router.tsx): `src/app/router.tsx`
- [Authentication session](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/auth/hooks/useAuth.tsx): `src/features/auth/hooks/useAuth.tsx`
- [Login and profiles](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/auth/services/authServices.ts): `src/features/auth/services/authServices.ts`

### Parking operations

- [Public availability](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/home/pages/HomePage.tsx): `src/features/home/pages/HomePage.tsx`
- [Employee portal](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/employee/pages/EmployeeDashboardPage.tsx): `src/features/employee/pages/EmployeeDashboardPage.tsx`
- [Occupancy updates](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/security/pages/SecurityDashboardPage.tsx): `src/features/security/pages/SecurityDashboardPage.tsx`
- [Physical layout views](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/components/PhysicalLayoutView.tsx): `src/features/parking/components/PhysicalLayoutView.tsx`
- [Layout subscriptions](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/hooks/useLocationLayouts.ts): `src/features/parking/hooks/useLocationLayouts.ts`
- [Slot status subscriptions](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/parking/hooks/useSlotStatuses.ts): `src/features/parking/hooks/useSlotStatuses.ts`
- [Layout persistence](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/layoutService.ts): `src/services/layoutService.ts`

### Gate monitoring

- [Vehicle log workflow](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/vehicleLogService.ts): `src/services/vehicleLogService.ts`
- [Vehicle log console](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/security/pages/VehicleLogsPage.tsx): `src/features/security/pages/VehicleLogsPage.tsx`
- [Employee vehicles](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/employeeVehicleService.ts): `src/services/employeeVehicleService.ts`

### Administration

- [Reports and analytics](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/analyticsService.ts): `src/services/analyticsService.ts`
- [Admin dashboard](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/AdminDashboardPage.tsx): `src/features/admin/pages/AdminDashboardPage.tsx`
- [Building management](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/BuildingsPage.tsx): `src/features/admin/pages/BuildingsPage.tsx`
- [User management](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/UsersPage.tsx): `src/features/admin/pages/UsersPage.tsx`
- [Create staff user](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/CreateUserPage.tsx): `src/features/admin/pages/CreateUserPage.tsx`
- [Layout editor and import](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/admin/pages/ParkingLayoutsPage.tsx): `src/features/admin/pages/ParkingLayoutsPage.tsx`

### Diagnostics and data

- [Building records](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/buildingService.ts): `src/services/buildingService.ts`
- [Cloud Firestore](https://github.com/poovannan-vp/smart_parking/blob/main/src/config/firestore.ts): `src/config/firestore.ts`
- [Developer diagnostics](https://github.com/poovannan-vp/smart_parking/blob/main/src/features/developer/pages/DeveloperDashboardPage.tsx): `src/features/developer/pages/DeveloperDashboardPage.tsx`
- [Diagnostics service](https://github.com/poovannan-vp/smart_parking/blob/main/src/services/developerDiagnosticsService.ts): `src/services/developerDiagnosticsService.ts`
- **Firebase Authentication**

### Other components

- **Public visitor**
- **Staff user**

## Connections

- Public visitor → Role-based routes: opens app (evidence: `src/app/router.tsx`)
- Staff user → Role-based routes: opens portal (evidence: `src/app/router.tsx`)
- Application providers → Role-based routes: provides routes (evidence: `src/app/providers.tsx`)
- Role-based routes → Public availability: routes public (evidence: `src/app/router.tsx`)
- Role-based routes → Authentication session: guards staff (evidence: `src/app/router.tsx`)
- Role-based routes → Employee portal: routes employee (evidence: `src/app/router.tsx`)
- Role-based routes → Occupancy updates: routes security (evidence: `src/app/router.tsx`)
- Role-based routes → Vehicle log console: routes logs (evidence: `src/app/router.tsx`)
- Role-based routes → Admin dashboard: routes admin (evidence: `src/app/router.tsx`)
- Role-based routes → Building management: routes buildings (evidence: `src/app/router.tsx`)
- Role-based routes → User management: routes users (evidence: `src/app/router.tsx`)
- Role-based routes → Create staff user: routes creation (evidence: `src/app/router.tsx`)
- Role-based routes → Layout editor and import: routes layouts (evidence: `src/app/router.tsx`)
- Staff user → Authentication session: signs in (evidence: `README.md`)
- Authentication session → Login and profiles: loads profile (evidence: `src/features/auth/hooks/useAuth.tsx`)
- Login and profiles → Firebase Authentication: authenticates (evidence: `src/features/auth/services/authServices.ts`)
- Login and profiles → Cloud Firestore: reads profile (evidence: `src/features/auth/services/authServices.ts`)
- Public availability → Building records: shows availability
- Employee portal → Building records: reads buildings (evidence: `src/features/employee/pages/EmployeeDashboardPage.tsx`)
- Employee portal → Employee vehicles: manages vehicles (evidence: `src/features/employee/pages/EmployeeDashboardPage.tsx`)
- Occupancy updates → Building records: updates occupancy
- Physical layout views → Layout subscriptions: renders layouts
- Layout subscriptions → Layout persistence: subscribes layouts (evidence: `src/features/parking/hooks/useLocationLayouts.ts`)
- Slot status subscriptions → Cloud Firestore: reads status
- Layout persistence → Cloud Firestore: stores geometry (evidence: `src/services/layoutService.ts`)
- Vehicle log console → Vehicle log workflow: manages records (evidence: `src/features/security/pages/VehicleLogsPage.tsx`)
- Vehicle log workflow → Employee vehicles: finds vehicle owner (evidence: `src/services/vehicleLogService.ts`)
- Vehicle log workflow → Cloud Firestore: writes logs audit (evidence: `src/services/vehicleLogService.ts`)
- Admin dashboard → Reports and analytics: loads reports (evidence: `src/features/admin/pages/AdminDashboardPage.tsx`)
- Admin dashboard → Building records: loads buildings (evidence: `src/features/admin/pages/AdminDashboardPage.tsx`)
- Admin dashboard → Vehicle log workflow: loads log data (evidence: `src/features/admin/pages/AdminDashboardPage.tsx`)
- Building management → Building records: manages buildings (evidence: `src/features/admin/pages/BuildingsPage.tsx`)
- User management → Building records: loads assignments (evidence: `src/features/admin/pages/UsersPage.tsx`)
- Create staff user → Building records: loads buildings (evidence: `src/features/admin/pages/CreateUserPage.tsx`)
- Layout editor and import → Layout persistence: edits layouts (evidence: `src/features/admin/pages/ParkingLayoutsPage.tsx`)
- Layout editor and import → Building records: selects building (evidence: `src/features/admin/pages/ParkingLayoutsPage.tsx`)
- Developer diagnostics → Diagnostics service: views diagnostics
- Diagnostics service → Cloud Firestore: reads diagnostic data (evidence: `src/services/developerDiagnosticsService.ts`)
