# biswasnirmalya48-lgtm/crowd-sense- architecture

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

- Interactive diagram: https://gitdiagram.com/biswasnirmalya48-lgtm/crowd-sense-
- Repository: https://github.com/biswasnirmalya48-lgtm/crowd-sense-

## Overview

CrowdSense is a campus crowd-monitoring application: students view current facility occupancy and alternatives, while administrators can adjust or simulate occupancy. The sampled frontend implements polling, density sorting, and alternatives; the README documents broader forecasting, mapping, filtering, notifications, and analytics capabilities. The simulation engine and seed data are listed as core or substantial files but were not sampled, so their internal behavior is represented only where the README documents it. Some documented API capabilities are not visible in the sampled server routes.

Main entry points: [`server.ts`](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server.ts) (REST routes), [`server/simulationEngine.ts`](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server/simulationEngine.ts) (Simulation engine), [`src/App.tsx`](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/App.tsx) (Live dashboard), [`src/services/api.ts`](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/services/api.ts) (Facilities API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Campus interface"]
  node_dashboard["Live dashboard<br/>[App.tsx]"]
  node_alternatives["Space alternatives<br/>[App.tsx]"]
  node_webapi["Facilities API client<br/>[api.ts]"]
  node_types["Facility data types<br/>[index.ts]"]
  node_map["Campus spatial map"]
  node_search["Search and filters"]
  node_admincontrols["Admin simulation controls"]
  node_notifications["Vacancy notifications"]
end

subgraph group_api["HTTP service"]
  node_server["REST routes<br/>[server.ts]"]
end

subgraph group_domain["Crowd domain"]
  node_engine["Simulation engine"]
  node_seed["Facility seed data<br/>[seedData.ts]"]
  node_checkin["Entry and exit<br/>[server.ts]"]
end

subgraph group_insights["Planning and alerts"]
  node_forecast["Occupancy forecast"]
  node_heatmap["Weekly crowd insights"]
end

node_student(("Student"))
node_admin(("Administrator"))
node_sensor(("Physical sensors"))

node_student -->|"views"| node_dashboard
node_admin -->|"adjusts occupancy"| node_admincontrols
node_dashboard -->|"polls facilities"| node_webapi
node_webapi -->|"requests facilities"| node_server
node_server -->|"reads facilities"| node_engine
node_server -->|"routes entry and exit"| node_checkin
node_checkin -->|"updates occupancy"| node_engine
node_engine -.->|"uses facility data"| node_seed
node_dashboard -->|"ranks spaces"| node_alternatives
node_student -->|"explores facilities"| node_map
node_student -->|"filters facilities"| node_search
node_student -->|"views predictions"| node_forecast
node_server -->|"serves forecasts"| node_forecast
node_student -->|"views insights"| node_heatmap
node_server -->|"serves analytics"| node_heatmap
node_admincontrols -->|"controls simulation"| node_server
node_engine -.->|"triggers vacancy alerts"| node_notifications
node_sensor -.->|"submits occupancy"| node_server

click node_dashboard "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/App.tsx"
click node_alternatives "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/App.tsx"
click node_webapi "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/services/api.ts"
click node_types "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/types/index.ts"
click node_server "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server.ts"
click node_engine "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server/simulationEngine.ts"
click node_seed "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server/seedData.ts"
click node_checkin "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server.ts"
click node_forecast "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/server"
click node_map "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src"
click node_search "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src"
click node_admincontrols "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src"
click node_notifications "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src"
click node_heatmap "https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/server"

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_dashboard,node_alternatives,node_webapi,node_types,node_map,node_search,node_admincontrols,node_notifications toneBlue
class node_server toneAmber
class node_engine,node_seed,node_checkin toneMint
class node_forecast,node_heatmap toneRose
class node_student,node_admin,node_sensor toneIndigo
```

## Components

### Campus interface

- [Live dashboard](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/App.tsx): `src/App.tsx`
- [Space alternatives](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/App.tsx): `src/App.tsx`
- [Facilities API client](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/services/api.ts): `src/services/api.ts`
- [Facility data types](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/src/types/index.ts): `src/types/index.ts`
- [Campus spatial map](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src): `src`
- [Search and filters](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src): `src`
- [Admin simulation controls](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src): `src`
- [Vacancy notifications](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/src): `src`

### HTTP service

- [REST routes](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server.ts): `server.ts`

### Crowd domain

- [Simulation engine](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server/simulationEngine.ts): `server/simulationEngine.ts`
- [Facility seed data](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server/seedData.ts): `server/seedData.ts`
- [Entry and exit](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/blob/main/server.ts): `server.ts`

### Planning and alerts

- [Occupancy forecast](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/server): `server`
- [Weekly crowd insights](https://github.com/biswasnirmalya48-lgtm/crowd-sense-/tree/main/server): `server`

### Other components

- **Student**
- **Administrator**
- **Physical sensors**

## Connections

- Student → Live dashboard: views (evidence: `README.md`)
- Administrator → Admin simulation controls: adjusts occupancy (evidence: `README.md`)
- Live dashboard → Facilities API client: polls facilities (evidence: `src/App.tsx`)
- Facilities API client → REST routes: requests facilities (evidence: `src/services/api.ts`)
- REST routes → Simulation engine: reads facilities (evidence: `server.ts`)
- REST routes → Entry and exit: routes entry and exit (evidence: `server.ts`)
- Entry and exit → Simulation engine: updates occupancy (evidence: `server.ts`)
- Simulation engine → Facility seed data: uses facility data
- Live dashboard → Space alternatives: ranks spaces (evidence: `src/App.tsx`)
- Student → Campus spatial map: explores facilities (evidence: `README.md`)
- Student → Search and filters: filters facilities (evidence: `README.md`)
- Student → Occupancy forecast: views predictions (evidence: `README.md`)
- REST routes → Occupancy forecast: serves forecasts (evidence: `README.md`)
- Student → Weekly crowd insights: views insights (evidence: `README.md`)
- REST routes → Weekly crowd insights: serves analytics (evidence: `README.md`)
- Admin simulation controls → REST routes: controls simulation (evidence: `README.md`)
- Simulation engine → Vacancy notifications: triggers vacancy alerts
- Physical sensors → REST routes: submits occupancy
