# pratham-mishra225/street-light-automation architecture

> Architecture diagram of the GitHub repository pratham-mishra225/street-light-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pratham-mishra225/street-light-automation
- Repository: https://github.com/pratham-mishra225/street-light-automation

## Overview

The product uses an 8086 assembly program as its authoritative lighting decision engine. Its state file is exposed by a Node.js bridge and visualized by a React interface, which also has a separate local demo mode. The README documents the decision behavior; the assembly implementation was not sampled, so internal assembly steps are not expanded.

Main entry points: [`server/index.js`](https://github.com/pratham-mishra225/street-light-automation/blob/main/server/index.js) (Node state API), [`frontend/src/main.jsx`](https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx) (Live state polling), [`assembly/street_light.asm`](https://github.com/pratham-mishra225/street-light-automation/blob/main/assembly/street_light.asm) (8086 decision engine), [`test-emu/STATE.TXT`](https://github.com/pratham-mishra225/street-light-automation/blob/main/test-emu/STATE.TXT) (Lighting state file)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_decision["Lighting decisions"]
  node_assembly["8086 decision engine<br/>[street_light.asm]"]
  node_statefile["Lighting state file<br/>[STATE.TXT]"]
end

subgraph group_bridge["State bridge"]
  node_bridgeapi["Node state API<br/>[index.js]"]
end

subgraph group_frontend["Visualization"]
  node_demo["Demo simulation<br/>[main.jsx]"]
  node_livepoll["Live state polling<br/>[main.jsx]"]
  node_visualization["Road and lamp visualization<br/>[main.jsx]"]
  node_metrics["Energy and state metrics<br/>[main.jsx]"]
end

node_operator(("Operator"))

node_operator -->|"enters conditions"| node_assembly
node_assembly -->|"writes decisions"| node_statefile
node_bridgeapi -->|"reads state"| node_statefile
node_livepoll -->|"requests state"| node_bridgeapi
node_bridgeapi -->|"returns state"| node_livepoll
node_operator -->|"sets demo inputs"| node_demo
node_demo -->|"provides simulated state"| node_visualization
node_livepoll -->|"provides live state"| node_visualization
node_visualization -->|"supplies displayed state"| node_metrics

click node_assembly "https://github.com/pratham-mishra225/street-light-automation/blob/main/assembly/street_light.asm"
click node_statefile "https://github.com/pratham-mishra225/street-light-automation/blob/main/test-emu/STATE.TXT"
click node_bridgeapi "https://github.com/pratham-mishra225/street-light-automation/blob/main/server/index.js"
click node_demo "https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx"
click node_livepoll "https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx"
click node_visualization "https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx"
click node_metrics "https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx"

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_assembly,node_statefile toneBlue
class node_bridgeapi toneAmber
class node_demo,node_livepoll,node_visualization,node_metrics toneMint
class node_operator toneIndigo
```

## Components

### Lighting decisions

- [8086 decision engine](https://github.com/pratham-mishra225/street-light-automation/blob/main/assembly/street_light.asm): `assembly/street_light.asm`
- [Lighting state file](https://github.com/pratham-mishra225/street-light-automation/blob/main/test-emu/STATE.TXT): `test-emu/STATE.TXT`

### State bridge

- [Node state API](https://github.com/pratham-mishra225/street-light-automation/blob/main/server/index.js): `server/index.js`

### Visualization

- [Demo simulation](https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Live state polling](https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Road and lamp visualization](https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Energy and state metrics](https://github.com/pratham-mishra225/street-light-automation/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### Other components

- **Operator**

## Connections

- Operator → 8086 decision engine: enters conditions
- 8086 decision engine → Lighting state file: writes decisions
- Node state API → Lighting state file: reads state
- Live state polling → Node state API: requests state
- Node state API → Live state polling: returns state
- Operator → Demo simulation: sets demo inputs
- Demo simulation → Road and lamp visualization: provides simulated state
- Live state polling → Road and lamp visualization: provides live state
- Road and lamp visualization → Energy and state metrics: supplies displayed state
