# dbtkdfhr/hwalro architecture

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

- Interactive diagram: https://gitdiagram.com/dbtkdfhr/hwalro
- Repository: https://github.com/dbtkdfhr/hwalro

## Overview

HWALRO supports pre-opening safety review of pop-up, exhibition, and event spaces. The main workflow registers a review, creates a drawing and layout, configures and runs an evacuation simulation, then analyzes results; users can compare layouts and create a report from simulation results. Separate work areas manage risks, safety checklists, and regulations. The README documents product stages and service responsibilities; sampled source confirms selected authentication, simulation, safety-check, and regulation behavior, but does not expose every route or service-to-service connection.

Main entry points: [`apps/frontend/src/App.tsx`](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/App.tsx) (Web application), [`apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java`](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java) (Simulation service), [`apps/frontend/src/features/simulationResult/pages/SimulationResultPage.tsx`](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/simulationResult/pages/SimulationResultPage.tsx) (Result analysis), [`apps/frontend/src/features/layout/pages/LayoutPage.tsx`](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/layout/pages/LayoutPage.tsx) (Drawings and layouts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["User application"]
  node_frontend["Web application<br/>[App.tsx]"]
  node_review["Review dashboard"]
end

subgraph group_identity["Identity and access"]
  node_auth_ui["Sign-in and access<br/>[AuthContext.tsx]"]
  node_auth_service["Authentication service<br/>[AuthService.java]"]
  node_user_domain["User and roles<br/>[User.java]"]
end

subgraph group_simulation["Review and simulation"]
  node_drawing["Drawings and layouts<br/>[LayoutPage.tsx]"]
  node_simulation_setup["Simulation setup"]
  node_sim_service["Simulation service"]
  node_drawing_service["Drawing service"]
  node_engine["Evacuation engine"]
  node_results["Result analysis"]
  node_layout_search["Layout search"]
  node_improvements["Improvement proposals"]
  node_evacuation["Evacuation preview"]
end

subgraph group_safety["Safety operations"]
  node_risk["Risk management<br/>[RiskService.java]"]
  node_checklists["Safety checklists"]
end

subgraph group_reporting["Laws and reporting"]
  node_law_ui["Regulation browser"]
  node_law_service["Regulation lookup"]
  node_law_api["External law API<br/>[LawApiClient.java]"]
  node_reports["Reports and AI drafts<br/>[ReportService.java]"]
  node_ai_generator["AI draft generator"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_frontend
node_frontend -->|"signs in"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_service
node_auth_service -->|"loads user"| node_user_domain
node_frontend -->|"opens review"| node_review
node_review -->|"registers layout"| node_drawing
node_drawing -->|"sets conditions"| node_simulation_setup
node_simulation_setup -->|"runs simulation"| node_sim_service
node_sim_service -.->|"uses drawings"| node_drawing_service
node_sim_service -->|"executes model"| node_engine
node_sim_service -->|"provides results"| node_results
node_results -->|"compares layouts"| node_layout_search
node_results -.->|"reviews proposals"| node_improvements
node_drawing -.->|"previews routes"| node_evacuation
node_frontend -->|"manages risks"| node_risk
node_frontend -->|"records checks"| node_checklists
node_frontend -->|"browses laws"| node_law_ui
node_law_ui -->|"searches laws"| node_law_service
node_law_service -->|"fetches law data"| node_law_api
node_results -->|"starts report"| node_reports
node_reports -.->|"generates draft"| node_ai_generator

click node_frontend "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/App.tsx"
click node_review "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/home/hooks/useHomeDashboard.ts"
click node_drawing "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/layout/pages/LayoutPage.tsx"
click node_simulation_setup "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/simulations/pages/SimulationSetupPage.tsx"
click node_sim_service "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java"
click node_drawing_service "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/drawing/service/DrawingService.java"
click node_engine "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/engine/SimulationEngineRunner.java"
click node_results "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/simulationResult/pages/SimulationResultPage.tsx"
click node_layout_search "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/search/service/LayoutSearchQueryService.java"
click node_improvements "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/improvement/service/ImprovementProposalQueryService.java"
click node_evacuation "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/zone/service/EvacuationPreviewService.java"
click node_auth_ui "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/auth/context/AuthContext.tsx"
click node_auth_service "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/auth-service/src/main/java/com/hwalro/auth/auth/AuthService.java"
click node_user_domain "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/auth-service/src/main/java/com/hwalro/auth/domain/User.java"
click node_risk "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/risk/service/RiskService.java"
click node_checklists "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/safetycheck/service/SafetyCheckService.java"
click node_law_ui "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/pages/RegulationsPage.tsx"
click node_law_service "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/law/service/RegulationService.java"
click node_law_api "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/law/api/LawApiClient.java"
click node_reports "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/report/service/ReportService.java"
click node_ai_generator "https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/report/ai/OpenAiReportDraftGenerator.java"

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_frontend,node_review toneBlue
class node_auth_ui,node_auth_service,node_user_domain toneAmber
class node_drawing,node_simulation_setup,node_sim_service,node_drawing_service,node_engine,node_results,node_layout_search,node_improvements,node_evacuation toneMint
class node_risk,node_checklists toneRose
class node_law_ui,node_law_service,node_law_api,node_reports,node_ai_generator,node_operator toneIndigo
```

## Components

### User application

- [Web application](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/App.tsx): `apps/frontend/src/App.tsx`
- [Review dashboard](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/home/hooks/useHomeDashboard.ts): `apps/frontend/src/features/home/hooks/useHomeDashboard.ts`

### Identity and access

- [Sign-in and access](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/auth/context/AuthContext.tsx): `apps/frontend/src/features/auth/context/AuthContext.tsx`
- [Authentication service](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/auth-service/src/main/java/com/hwalro/auth/auth/AuthService.java): `apps/auth-service/src/main/java/com/hwalro/auth/auth/AuthService.java`
- [User and roles](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/auth-service/src/main/java/com/hwalro/auth/domain/User.java): `apps/auth-service/src/main/java/com/hwalro/auth/domain/User.java`

### Review and simulation

- [Drawings and layouts](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/layout/pages/LayoutPage.tsx): `apps/frontend/src/features/layout/pages/LayoutPage.tsx`
- [Simulation setup](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/simulations/pages/SimulationSetupPage.tsx): `apps/frontend/src/features/simulations/pages/SimulationSetupPage.tsx`
- [Simulation service](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java`
- [Drawing service](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/drawing/service/DrawingService.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/drawing/service/DrawingService.java`
- [Evacuation engine](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/engine/SimulationEngineRunner.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/engine/SimulationEngineRunner.java`
- [Result analysis](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/features/simulationResult/pages/SimulationResultPage.tsx): `apps/frontend/src/features/simulationResult/pages/SimulationResultPage.tsx`
- [Layout search](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/search/service/LayoutSearchQueryService.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/search/service/LayoutSearchQueryService.java`
- [Improvement proposals](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/improvement/service/ImprovementProposalQueryService.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/improvement/service/ImprovementProposalQueryService.java`
- [Evacuation preview](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/simulation-service/src/main/java/com/hwalro/simulation/zone/service/EvacuationPreviewService.java): `apps/simulation-service/src/main/java/com/hwalro/simulation/zone/service/EvacuationPreviewService.java`

### Safety operations

- [Risk management](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/risk/service/RiskService.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/risk/service/RiskService.java`
- [Safety checklists](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/safetycheck/service/SafetyCheckService.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/safetycheck/service/SafetyCheckService.java`

### Laws and reporting

- [Regulation browser](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/frontend/src/pages/RegulationsPage.tsx): `apps/frontend/src/pages/RegulationsPage.tsx`
- [Regulation lookup](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/law/service/RegulationService.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/law/service/RegulationService.java`
- [External law API](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/law/api/LawApiClient.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/law/api/LawApiClient.java`
- [Reports and AI drafts](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/report/service/ReportService.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/report/service/ReportService.java`
- [AI draft generator](https://github.com/dbtkdfhr/hwalro/blob/dev/apps/regulation-service/src/main/java/com/hwalro/regulation/report/ai/OpenAiReportDraftGenerator.java): `apps/regulation-service/src/main/java/com/hwalro/regulation/report/ai/OpenAiReportDraftGenerator.java`

### Other components

- **Operator**

## Connections

- Operator → Web application: uses (evidence: `README.md`)
- Web application → Sign-in and access: signs in (evidence: `README.md`)
- Sign-in and access → Authentication service: authenticates (evidence: `README.md`)
- Authentication service → User and roles: loads user (evidence: `apps/auth-service/src/main/java/com/hwalro/auth/auth/AuthService.java`)
- Web application → Review dashboard: opens review (evidence: `README.md`)
- Review dashboard → Drawings and layouts: registers layout (evidence: `README.md`)
- Drawings and layouts → Simulation setup: sets conditions (evidence: `README.md`)
- Simulation setup → Simulation service: runs simulation (evidence: `README.md`)
- Simulation service → Drawing service: uses drawings
- Simulation service → Evacuation engine: executes model (evidence: `apps/simulation-service/src/main/java/com/hwalro/simulation/simulation/service/SimulationService.java`)
- Simulation service → Result analysis: provides results (evidence: `README.md`)
- Result analysis → Layout search: compares layouts (evidence: `README.md`)
- Result analysis → Improvement proposals: reviews proposals
- Drawings and layouts → Evacuation preview: previews routes
- Web application → Risk management: manages risks (evidence: `README.md`)
- Web application → Safety checklists: records checks (evidence: `README.md`)
- Web application → Regulation browser: browses laws (evidence: `README.md`)
- Regulation browser → Regulation lookup: searches laws (evidence: `README.md`)
- Regulation lookup → External law API: fetches law data (evidence: `apps/regulation-service/src/main/java/com/hwalro/regulation/law/service/RegulationService.java`)
- Result analysis → Reports and AI drafts: starts report (evidence: `README.md`)
- Reports and AI drafts → AI draft generator: generates draft
