# preety5123/surakshavikas-ar architecture

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

- Interactive diagram: https://gitdiagram.com/preety5123/surakshavikas-ar
- Repository: https://github.com/preety5123/surakshavikas-ar

## Overview

SurakshaVikas AR is a mobile-first vocational safety-training product with offline support, interactive fire/gas practice, assessments, certificates, and an administrative dashboard with public certificate verification. The principal workflow moves from worker onboarding and language selection through simulation, assessment, certificate issuance, and verification; queued training records sync to the backend when online. A separate browser-based PASS trainer implements WebXR/simulation extinguisher practice. Source excerpts establish the backend, mobile engine, and web trainer wiring; dashboard internals and several mobile screens are documented in the README but not sampled.

Main entry points: [`web-pass-trainer/js/main.js`](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/main.js) (Browser Practice), [`mobile-app/App.js`](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/App.js) (Training App), [`web-pass-trainer/js/fire.js`](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/fire.js) (Fire Hazard), [`mobile-app/src/engine/store.js`](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/store.js) (Queued Sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile Training"]
  node_mobileapp["Training App<br/>[App.js]"]
  node_localstore[("Offline Store<br/>[store.js]")]
  node_language["Localization<br/>[i18n.js]"]
  node_assessment["Assessment Engine<br/>[assessment.js]"]
  node_session["Session Results<br/>[App.js]"]
  node_sync["Queued Sync<br/>[store.js]"]
end

subgraph group_webtrainer["Browser PASS Trainer"]
  node_practice["Browser Practice<br/>[main.js]"]
  node_ar["AR Session<br/>[session.js]"]
  node_fsm["Training State<br/>[fsm.js]"]
  node_extinguisher["Extinguisher Model<br/>[extinguisher.js]"]
  node_hazard["Fire Hazard<br/>[fire.js]"]
  node_sweep["Sweep Tracking<br/>[sweep.js]"]
  node_particles["Particle Effects<br/>[particles.js]"]
  node_audio["Synth Audio<br/>[audio.js]"]
  node_trainerui["Trainer UI<br/>[ui.js]"]
end

subgraph group_backend["Backend Services"]
  node_api["Training API<br/>[server.js]"]
  node_db[("JSON Records<br/>[db.js]")]
  node_verify["Certificate Verification<br/>[server.js]"]
end

subgraph group_admin["Administration"]
  node_dashboard["Admin Dashboard<br/>[index.html]"]
end

node_worker(("Worker"))
node_adminuser(("Administrator"))
node_certuser(("Certificate Checker"))
node_network["HTTP Network"]

node_worker -->|"uses"| node_mobileapp
node_mobileapp -->|"translates"| node_language
node_mobileapp -->|"loads and saves"| node_localstore
node_mobileapp -->|"assesses"| node_assessment
node_mobileapp -.->|"records progress"| node_session
node_localstore -->|"queues records"| node_sync
node_mobileapp -->|"starts sync"| node_sync
node_sync -->|"posts queued data"| node_network
node_network -.->|"sends requests"| node_api
node_api -->|"loads and saves"| node_db
node_adminuser -->|"reviews stats"| node_dashboard
node_dashboard -.->|"fetches records"| node_api
node_certuser -->|"checks certificate"| node_verify
node_verify -->|"reads certificates"| node_db
node_worker -.->|"practices PASS"| node_practice
node_practice -->|"updates session"| node_ar
node_practice -->|"wires state"| node_fsm
node_practice -->|"creates controller"| node_extinguisher
node_practice -->|"places hazard"| node_hazard
node_practice -->|"updates tracker"| node_sweep
node_practice -->|"controls audio"| node_audio
node_practice -->|"binds controls"| node_trainerui
node_extinguisher -->|"emits spray"| node_particles
node_hazard -->|"renders effects"| node_particles
node_hazard -->|"uses damage"| node_sweep
node_hazard -->|"stops fire sound"| node_audio

click node_mobileapp "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/App.js"
click node_localstore "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/store.js"
click node_language "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/i18n.js"
click node_assessment "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/assessment.js"
click node_practice "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/main.js"
click node_ar "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/session.js"
click node_fsm "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/fsm.js"
click node_extinguisher "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/extinguisher.js"
click node_hazard "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/fire.js"
click node_sweep "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/sweep.js"
click node_particles "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/particles.js"
click node_audio "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/audio.js"
click node_trainerui "https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/ui.js"
click node_session "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/App.js"
click node_sync "https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/store.js"
click node_api "https://github.com/preety5123/surakshavikas-ar/blob/master/backend/server.js"
click node_db "https://github.com/preety5123/surakshavikas-ar/blob/master/backend/db.js"
click node_dashboard "https://github.com/preety5123/surakshavikas-ar/blob/master/admin-dashboard/index.html"
click node_verify "https://github.com/preety5123/surakshavikas-ar/blob/master/backend/server.js"

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_mobileapp,node_localstore,node_language,node_assessment,node_session,node_sync toneBlue
class node_practice,node_ar,node_fsm,node_extinguisher,node_hazard,node_sweep,node_particles,node_audio,node_trainerui toneAmber
class node_api,node_db,node_verify toneMint
class node_dashboard,node_worker toneRose
class node_adminuser,node_certuser,node_network toneIndigo
```

## Components

### Mobile Training

- [Training App](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/App.js): `mobile-app/App.js`
- [Offline Store](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/store.js): `mobile-app/src/engine/store.js`
- [Localization](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/i18n.js): `mobile-app/src/engine/i18n.js`
- [Assessment Engine](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/assessment.js): `mobile-app/src/engine/assessment.js`
- [Session Results](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/App.js): `mobile-app/App.js`
- [Queued Sync](https://github.com/preety5123/surakshavikas-ar/blob/master/mobile-app/src/engine/store.js): `mobile-app/src/engine/store.js`

### Browser PASS Trainer

- [Browser Practice](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/main.js): `web-pass-trainer/js/main.js`
- [AR Session](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/session.js): `web-pass-trainer/js/session.js`
- [Training State](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/fsm.js): `web-pass-trainer/js/fsm.js`
- [Extinguisher Model](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/extinguisher.js): `web-pass-trainer/js/extinguisher.js`
- [Fire Hazard](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/fire.js): `web-pass-trainer/js/fire.js`
- [Sweep Tracking](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/sweep.js): `web-pass-trainer/js/sweep.js`
- [Particle Effects](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/particles.js): `web-pass-trainer/js/particles.js`
- [Synth Audio](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/audio.js): `web-pass-trainer/js/audio.js`
- [Trainer UI](https://github.com/preety5123/surakshavikas-ar/blob/master/web-pass-trainer/js/ui.js): `web-pass-trainer/js/ui.js`

### Backend Services

- [Training API](https://github.com/preety5123/surakshavikas-ar/blob/master/backend/server.js): `backend/server.js`
- [JSON Records](https://github.com/preety5123/surakshavikas-ar/blob/master/backend/db.js): `backend/db.js`
- [Certificate Verification](https://github.com/preety5123/surakshavikas-ar/blob/master/backend/server.js): `backend/server.js`

### Administration

- [Admin Dashboard](https://github.com/preety5123/surakshavikas-ar/blob/master/admin-dashboard/index.html): `admin-dashboard/index.html`

### Other components

- **Worker**
- **Administrator**
- **Certificate Checker**
- **HTTP Network**

## Connections

- Worker → Training App: uses (evidence: `README.md`)
- Training App → Localization: translates (evidence: `mobile-app/App.js`)
- Training App → Offline Store: loads and saves (evidence: `mobile-app/App.js`)
- Training App → Assessment Engine: assesses (evidence: `README.md`)
- Training App → Session Results: records progress (evidence: `mobile-app/App.js`)
- Offline Store → Queued Sync: queues records (evidence: `mobile-app/src/engine/store.js`)
- Training App → Queued Sync: starts sync (evidence: `mobile-app/App.js`)
- Queued Sync → HTTP Network: posts queued data (evidence: `mobile-app/src/engine/store.js`)
- HTTP Network → Training API: sends requests (evidence: `README.md`)
- Training API → JSON Records: loads and saves (evidence: `backend/server.js`)
- Administrator → Admin Dashboard: reviews stats (evidence: `README.md`)
- Admin Dashboard → Training API: fetches records (evidence: `README.md`)
- Certificate Checker → Certificate Verification: checks certificate (evidence: `backend/server.js`)
- Certificate Verification → JSON Records: reads certificates (evidence: `backend/server.js`)
- Worker → Browser Practice: practices PASS
- Browser Practice → AR Session: updates session (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Training State: wires state (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Extinguisher Model: creates controller (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Fire Hazard: places hazard (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Sweep Tracking: updates tracker (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Synth Audio: controls audio (evidence: `web-pass-trainer/js/main.js`)
- Browser Practice → Trainer UI: binds controls (evidence: `web-pass-trainer/js/main.js`)
- Extinguisher Model → Particle Effects: emits spray (evidence: `web-pass-trainer/js/extinguisher.js`)
- Fire Hazard → Particle Effects: renders effects (evidence: `web-pass-trainer/js/fire.js`)
- Fire Hazard → Sweep Tracking: uses damage (evidence: `web-pass-trainer/js/fire.js`)
- Fire Hazard → Synth Audio: stops fire sound (evidence: `web-pass-trainer/js/fire.js`)
