# ndlhoangndl/ansinh360 architecture

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

- Interactive diagram: https://gitdiagram.com/ndlhoangndl/ansinh360
- Repository: https://github.com/ndlhoangndl/ansinh360

## Overview

AN SINH 360 is a policy, service, and opportunity guide for workers in Liên Chiểu. Its competition demo presents a situation-specific journey—job loss, housing difficulty, or having a young child—then provides contextual guidance, opportunities, and practical next steps with official-source provenance. The web demo is explicitly standalone; the .NET Phase 1 backend separately validates and imports CSV datasets rather than powering the demo. The graph preserves both product journeys and the backend’s data-foundation workflow. Backend links are supported by indexed references and excerpts; the frontend overview relies on README statements where component wiring was not shown.

Main entry points: [`apps/web/components/demo-app.tsx`](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/demo-app.tsx) (Journey interface), [`src/AnSinh360.Cli/Program.cs`](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Cli/Program.cs) (Phase 1 CLI), [`src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs`](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs) (PostgreSQL importer), [`src/AnSinh360.Application/DatasetValidator.cs`](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/DatasetValidator.cs) (Dataset validator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web_entry["Demo entry"]
  node_web_page["Demo page<br/>[page.tsx]"]
  node_demo_app["Journey interface<br/>[demo-app.tsx]"]
end

subgraph group_journeys["Worker journeys"]
  node_analysis["Situation analysis"]
  node_job_journey["Job-loss journey<br/>[job-journey.ts]"]
  node_housing_journey["Housing journey"]
  node_housing_logic["Housing guidance logic<br/>[housing-journey.ts]"]
  node_child_journey["Child journey<br/>[child-journey.tsx]"]
  node_child_logic["Child guidance logic<br/>[child-journey.ts]"]
end

subgraph group_guidance["Guidance and actions"]
  node_job_results["Job results<br/>[job-results.tsx]"]
  node_job_opportunities["Job opportunities"]
  node_job_actions["Job action plan"]
  node_service_handoff["Service handoff"]
  node_local_actions["Local action plans"]
  node_family_housing["Family housing results"]
  node_source_badge["Source disclosure<br/>[source-badge.tsx]"]
end

subgraph group_dataset["Dataset foundation"]
  node_demo_data["Demo content"]
  node_demo_helpers["Demo data access<br/>[demo.ts]"]
  node_csv_reader["CSV reader"]
  node_snapshot["Dataset snapshot<br/>[DatasetSnapshot.cs]"]
  node_validator["Dataset validator"]
  node_import_planner["Import planner<br/>[ImportPlanner.cs]"]
  node_domain_records["Dataset records<br/>[Service.cs]"]
end

subgraph group_backend_ops["Backend operations"]
  node_cli["Phase 1 CLI<br/>[Program.cs]"]
  node_postgres_importer["PostgreSQL importer"]
  node_db_context[("Dataset database")]
  node_api_health["Health API<br/>[Program.cs]"]
end

node_worker(("Worker"))

node_worker -->|"opens demo"| node_web_page
node_web_page -.->|"renders"| node_demo_app
node_demo_app -->|"shows analysis"| node_analysis
node_demo_app -->|"shows results"| node_job_results
node_demo_app -->|"shows actions"| node_job_actions
node_demo_app -->|"shows journey"| node_housing_journey
node_demo_app -->|"shows journey"| node_child_journey
node_demo_app -.->|"shows results"| node_family_housing
node_job_results -->|"renders"| node_job_opportunities
node_job_actions -->|"renders"| node_service_handoff
node_child_journey -->|"renders"| node_source_badge
node_housing_journey -->|"renders"| node_source_badge
node_job_results -->|"renders"| node_source_badge
node_job_actions -->|"renders"| node_source_badge
node_child_journey -->|"uses guidance"| node_child_logic
node_housing_journey -->|"uses guidance"| node_housing_logic
node_child_logic -->|"reads fixtures"| node_demo_data
node_housing_logic -->|"reads fixtures"| node_demo_data
node_job_journey -.->|"supports journey"| node_demo_app
node_demo_helpers -->|"reads fixtures"| node_demo_data
node_cli -->|"reads CSV"| node_csv_reader
node_csv_reader -->|"builds snapshot"| node_snapshot
node_cli -->|"validates data"| node_validator
node_validator -->|"checks structure"| node_snapshot
node_validator -->|"checks references"| node_domain_records
node_cli -->|"plans import"| node_import_planner
node_cli -->|"imports dataset"| node_postgres_importer
node_postgres_importer -->|"validates before import"| node_validator
node_postgres_importer -->|"plans changes"| node_import_planner
node_postgres_importer -->|"reads and writes"| node_db_context
node_db_context -->|"reads snapshot"| node_snapshot

click node_web_page "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/app/page.tsx"
click node_demo_app "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/demo-app.tsx"
click node_analysis "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/analysis-screen.tsx"
click node_job_journey "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/job-journey.ts"
click node_housing_journey "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/housing-journey.tsx"
click node_housing_logic "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/housing-journey.ts"
click node_child_journey "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/child-journey.tsx"
click node_child_logic "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/child-journey.ts"
click node_job_results "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-results.tsx"
click node_job_opportunities "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-opportunities.tsx"
click node_job_actions "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-action-plan.tsx"
click node_service_handoff "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-service-handoff.tsx"
click node_local_actions "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/local-action-plan.tsx"
click node_family_housing "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/family-housing-results.tsx"
click node_source_badge "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/source-badge.tsx"
click node_demo_data "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/competition-demo.ts"
click node_demo_helpers "https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/demo.ts"
click node_csv_reader "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/CsvDatasetReader.cs"
click node_snapshot "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/DatasetSnapshot.cs"
click node_validator "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/DatasetValidator.cs"
click node_import_planner "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/ImportPlanner.cs"
click node_domain_records "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Domain/Service.cs"
click node_cli "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Cli/Program.cs"
click node_postgres_importer "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs"
click node_db_context "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Infrastructure/DatasetDbContext.cs"
click node_api_health "https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Api/Program.cs"

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_web_page,node_demo_app toneBlue
class node_analysis,node_job_journey,node_housing_journey,node_housing_logic,node_child_journey,node_child_logic toneAmber
class node_job_results,node_job_opportunities,node_job_actions,node_service_handoff,node_local_actions,node_family_housing,node_source_badge toneMint
class node_demo_data,node_demo_helpers,node_csv_reader,node_snapshot,node_validator,node_import_planner,node_domain_records,node_worker toneRose
class node_cli,node_postgres_importer,node_db_context,node_api_health toneIndigo
```

## Components

### Demo entry

- [Demo page](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/app/page.tsx): `apps/web/app/page.tsx`
- [Journey interface](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/demo-app.tsx): `apps/web/components/demo-app.tsx`

### Worker journeys

- [Situation analysis](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/analysis-screen.tsx): `apps/web/components/analysis-screen.tsx`
- [Job-loss journey](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/job-journey.ts): `apps/web/lib/job-journey.ts`
- [Housing journey](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/housing-journey.tsx): `apps/web/components/housing-journey.tsx`
- [Housing guidance logic](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/housing-journey.ts): `apps/web/lib/housing-journey.ts`
- [Child journey](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/child-journey.tsx): `apps/web/components/child-journey.tsx`
- [Child guidance logic](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/child-journey.ts): `apps/web/lib/child-journey.ts`

### Guidance and actions

- [Job results](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-results.tsx): `apps/web/components/job-results.tsx`
- [Job opportunities](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-opportunities.tsx): `apps/web/components/job-opportunities.tsx`
- [Job action plan](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-action-plan.tsx): `apps/web/components/job-action-plan.tsx`
- [Service handoff](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/job-service-handoff.tsx): `apps/web/components/job-service-handoff.tsx`
- [Local action plans](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/local-action-plan.tsx): `apps/web/components/local-action-plan.tsx`
- [Family housing results](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/family-housing-results.tsx): `apps/web/components/family-housing-results.tsx`
- [Source disclosure](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/components/source-badge.tsx): `apps/web/components/source-badge.tsx`

### Dataset foundation

- [Demo content](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/competition-demo.ts): `apps/web/lib/competition-demo.ts`
- [Demo data access](https://github.com/ndlhoangndl/ansinh360/blob/main/apps/web/lib/demo.ts): `apps/web/lib/demo.ts`
- [CSV reader](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/CsvDatasetReader.cs): `src/AnSinh360.Application/CsvDatasetReader.cs`
- [Dataset snapshot](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/DatasetSnapshot.cs): `src/AnSinh360.Application/DatasetSnapshot.cs`
- [Dataset validator](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/DatasetValidator.cs): `src/AnSinh360.Application/DatasetValidator.cs`
- [Import planner](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Application/ImportPlanner.cs): `src/AnSinh360.Application/ImportPlanner.cs`
- [Dataset records](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Domain/Service.cs): `src/AnSinh360.Domain/Service.cs`

### Backend operations

- [Phase 1 CLI](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Cli/Program.cs): `src/AnSinh360.Cli/Program.cs`
- [PostgreSQL importer](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs): `src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs`
- [Dataset database](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Infrastructure/DatasetDbContext.cs): `src/AnSinh360.Infrastructure/DatasetDbContext.cs`
- [Health API](https://github.com/ndlhoangndl/ansinh360/blob/main/src/AnSinh360.Api/Program.cs): `src/AnSinh360.Api/Program.cs`

### Other components

- **Worker**

## Connections

- Worker → Demo page: opens demo (evidence: `README.md`)
- Demo page → Journey interface: renders
- Journey interface → Situation analysis: shows analysis (evidence: `apps/web/components/demo-app.tsx`)
- Journey interface → Job results: shows results (evidence: `apps/web/components/demo-app.tsx`)
- Journey interface → Job action plan: shows actions (evidence: `apps/web/components/demo-app.tsx`)
- Journey interface → Housing journey: shows journey (evidence: `apps/web/components/demo-app.tsx`)
- Journey interface → Child journey: shows journey (evidence: `apps/web/components/demo-app.tsx`)
- Journey interface → Family housing results: shows results
- Job results → Job opportunities: renders (evidence: `apps/web/components/job-results.tsx`)
- Job action plan → Service handoff: renders (evidence: `apps/web/components/job-action-plan.tsx`)
- Child journey → Source disclosure: renders (evidence: `apps/web/components/child-journey.tsx`)
- Housing journey → Source disclosure: renders (evidence: `apps/web/components/housing-journey.tsx`)
- Job results → Source disclosure: renders (evidence: `apps/web/components/job-results.tsx`)
- Job action plan → Source disclosure: renders (evidence: `apps/web/components/job-action-plan.tsx`)
- Child journey → Child guidance logic: uses guidance (evidence: `apps/web/lib/child-journey.ts`)
- Housing journey → Housing guidance logic: uses guidance (evidence: `apps/web/lib/housing-journey.ts`)
- Child guidance logic → Demo content: reads fixtures (evidence: `apps/web/lib/child-journey.ts`)
- Housing guidance logic → Demo content: reads fixtures (evidence: `apps/web/lib/housing-journey.ts`)
- Job-loss journey → Journey interface: supports journey
- Demo data access → Demo content: reads fixtures (evidence: `apps/web/lib/demo.ts`)
- Phase 1 CLI → CSV reader: reads CSV (evidence: `src/AnSinh360.Cli/Program.cs`)
- CSV reader → Dataset snapshot: builds snapshot (evidence: `src/AnSinh360.Application/CsvDatasetReader.cs`)
- Phase 1 CLI → Dataset validator: validates data (evidence: `src/AnSinh360.Cli/Program.cs`)
- Dataset validator → Dataset snapshot: checks structure (evidence: `src/AnSinh360.Application/DatasetValidator.cs`)
- Dataset validator → Dataset records: checks references (evidence: `src/AnSinh360.Application/DatasetValidator.cs`)
- Phase 1 CLI → Import planner: plans import (evidence: `src/AnSinh360.Cli/Program.cs`)
- Phase 1 CLI → PostgreSQL importer: imports dataset (evidence: `src/AnSinh360.Cli/Program.cs`)
- PostgreSQL importer → Dataset validator: validates before import (evidence: `src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs`)
- PostgreSQL importer → Import planner: plans changes (evidence: `src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs`)
- PostgreSQL importer → Dataset database: reads and writes (evidence: `src/AnSinh360.Infrastructure/PostgresDatasetImporter.cs`)
- Dataset database → Dataset snapshot: reads snapshot (evidence: `src/AnSinh360.Infrastructure/DatasetDbContext.cs`)
