# liziqian/aladdin architecture

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

- Interactive diagram: https://gitdiagram.com/liziqian/aladdin
- Repository: https://github.com/liziqian/aladdin

## Overview

ALADDIN is an intranet hardware-test and sample lifecycle platform. The principal workflow runs from project and stage planning through task configuration, sample assignment, execution and result recording, then into sample-history lookup. The README also documents device inventory, bulk import, scoped data migration and per-sample archive transfer. The graph combines those documented capabilities with sampled frontend synchronization, task mutation and SQLite behavior; unsampled subsystem wiring is shown only where the tree and documentation support it.

Main entry points: [`backend/server_modules/storage_core.py`](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/storage_core.py) (SQLite database), [`backend/server_modules/http_routes.py`](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_routes.py) (API routes), [`frontend/js/workspace`](https://github.com/liziqian/aladdin/tree/main/frontend/js/workspace) (Workspace and views), [`backend/server_modules/http_handler.py`](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_handler.py) (HTTP handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser application"]
  node_spa["ALADDIN SPA<br/>[app.core.js]"]
  node_ui["Workspace and views"]
  node_clientdata["Client data state<br/>[app.data.js]"]
  node_sync["Server sync<br/>[app.server.js]"]
  node_serverapi["API client<br/>[api.js]"]
end

subgraph group_http["HTTP service"]
  node_server["Server entry<br/>[server.py]"]
  node_handler["HTTP handler<br/>[http_handler.py]"]
  node_routes["API routes<br/>[http_routes.py]"]
end

subgraph group_domain["Test operations"]
  node_projects["Projects and stages<br/>[projects.py]"]
  node_tasks["Task lifecycle<br/>[tasks.py]"]
  node_samples["Sample records<br/>[samples.py]"]
  node_devices["Device warehouse"]
  node_results["Results and issues<br/>[problem_records.py]"]
  node_history["Sample history<br/>[sample_history.py]"]
end

subgraph group_data["State and transfer"]
  node_state["State reads"]
  node_sqlite[("SQLite database<br/>[storage_core.py]")]
  node_assets["Sample files<br/>[sample_assets.py]"]
  node_bulkimport["Bulk import"]
  node_migration["Scope and diff<br/>[migration_scope.py]"]
  node_archive["Sample archive transfer"]
end

node_user(("Test team"))
node_warehouse(("Inventory users"))

node_user -->|"uses"| node_spa
node_spa -->|"dispatches actions"| node_ui
node_ui -->|"updates view state"| node_clientdata
node_ui -->|"requests data"| node_sync
node_sync -->|"queues reads and writes"| node_serverapi
node_serverapi -->|"sends API requests"| node_handler
node_server -->|"creates handler"| node_handler
node_handler -->|"resolves routes"| node_routes
node_routes -->|"dispatches mutations"| node_projects
node_routes -->|"dispatches mutations"| node_tasks
node_routes -->|"dispatches mutations"| node_samples
node_routes -->|"dispatches inventory"| node_devices
node_routes -->|"dispatches result actions"| node_results
node_routes -->|"serves history"| node_history
node_handler -->|"requests state"| node_state
node_projects -->|"writes records"| node_sqlite
node_tasks -->|"writes task state"| node_sqlite
node_samples -->|"writes records"| node_sqlite
node_devices -->|"stores inventory"| node_sqlite
node_results -->|"stores results"| node_sqlite
node_history -->|"reads history"| node_sqlite
node_state -->|"reads state"| node_sqlite
node_samples -->|"manages attachments"| node_assets
node_user -->|"uploads bundle"| node_bulkimport
node_bulkimport -->|"filters and compares"| node_migration
node_bulkimport -->|"commits import"| node_sqlite
node_user -->|"requests archive transfer"| node_archive
node_archive -->|"reads archive data"| node_sqlite
node_archive -->|"packages sample files"| node_assets
node_warehouse -->|"manages device inventory"| node_ui

click node_spa "https://github.com/liziqian/aladdin/blob/main/frontend/js/app.core.js"
click node_ui "https://github.com/liziqian/aladdin/tree/main/frontend/js/workspace"
click node_clientdata "https://github.com/liziqian/aladdin/blob/main/frontend/js/app.data.js"
click node_sync "https://github.com/liziqian/aladdin/blob/main/frontend/js/app.server.js"
click node_serverapi "https://github.com/liziqian/aladdin/blob/main/frontend/js/server/api.js"
click node_server "https://github.com/liziqian/aladdin/blob/main/backend/server.py"
click node_handler "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_handler.py"
click node_routes "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_routes.py"
click node_projects "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/projects.py"
click node_tasks "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/tasks.py"
click node_samples "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/samples.py"
click node_devices "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/device_warehouse.py"
click node_results "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/problem_records.py"
click node_history "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/sample_history.py"
click node_state "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/state_read_service.py"
click node_sqlite "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/storage_core.py"
click node_assets "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/sample_assets.py"
click node_bulkimport "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/import_bundle_service.py"
click node_migration "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/migration_scope.py"
click node_archive "https://github.com/liziqian/aladdin/blob/main/backend/server_modules/bundle_preview_service.py"

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_spa,node_ui,node_clientdata,node_sync,node_serverapi,node_warehouse toneBlue
class node_server,node_handler,node_routes toneAmber
class node_projects,node_tasks,node_samples,node_devices,node_results,node_history toneMint
class node_state,node_sqlite,node_assets,node_bulkimport,node_migration,node_archive toneRose
class node_user toneIndigo
```

## Components

### Browser application

- [ALADDIN SPA](https://github.com/liziqian/aladdin/blob/main/frontend/js/app.core.js): `frontend/js/app.core.js`
- [Workspace and views](https://github.com/liziqian/aladdin/tree/main/frontend/js/workspace): `frontend/js/workspace`
- [Client data state](https://github.com/liziqian/aladdin/blob/main/frontend/js/app.data.js): `frontend/js/app.data.js`
- [Server sync](https://github.com/liziqian/aladdin/blob/main/frontend/js/app.server.js): `frontend/js/app.server.js`
- [API client](https://github.com/liziqian/aladdin/blob/main/frontend/js/server/api.js): `frontend/js/server/api.js`

### HTTP service

- [Server entry](https://github.com/liziqian/aladdin/blob/main/backend/server.py): `backend/server.py`
- [HTTP handler](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_handler.py): `backend/server_modules/http_handler.py`
- [API routes](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/http_routes.py): `backend/server_modules/http_routes.py`

### Test operations

- [Projects and stages](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/projects.py): `backend/server_modules/mutations/projects.py`
- [Task lifecycle](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/tasks.py): `backend/server_modules/mutations/tasks.py`
- [Sample records](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/mutations/samples.py): `backend/server_modules/mutations/samples.py`
- [Device warehouse](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/device_warehouse.py): `backend/server_modules/device_warehouse.py`
- [Results and issues](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/problem_records.py): `backend/server_modules/problem_records.py`
- [Sample history](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/sample_history.py): `backend/server_modules/sample_history.py`

### State and transfer

- [State reads](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/state_read_service.py): `backend/server_modules/state_read_service.py`
- [SQLite database](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/storage_core.py): `backend/server_modules/storage_core.py`
- [Sample files](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/sample_assets.py): `backend/server_modules/sample_assets.py`
- [Bulk import](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/import_bundle_service.py): `backend/server_modules/import_bundle_service.py`
- [Scope and diff](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/migration_scope.py): `backend/server_modules/migration_scope.py`
- [Sample archive transfer](https://github.com/liziqian/aladdin/blob/main/backend/server_modules/bundle_preview_service.py): `backend/server_modules/bundle_preview_service.py`

### Other components

- **Test team**
- **Inventory users**

## Connections

- Test team → ALADDIN SPA: uses
- ALADDIN SPA → Workspace and views: dispatches actions
- Workspace and views → Client data state: updates view state
- Workspace and views → Server sync: requests data
- Server sync → API client: queues reads and writes
- API client → HTTP handler: sends API requests
- Server entry → HTTP handler: creates handler
- HTTP handler → API routes: resolves routes
- API routes → Projects and stages: dispatches mutations
- API routes → Task lifecycle: dispatches mutations
- API routes → Sample records: dispatches mutations
- API routes → Device warehouse: dispatches inventory
- API routes → Results and issues: dispatches result actions
- API routes → Sample history: serves history
- HTTP handler → State reads: requests state
- Projects and stages → SQLite database: writes records
- Task lifecycle → SQLite database: writes task state
- Sample records → SQLite database: writes records
- Device warehouse → SQLite database: stores inventory
- Results and issues → SQLite database: stores results
- Sample history → SQLite database: reads history
- State reads → SQLite database: reads state
- Sample records → Sample files: manages attachments
- Test team → Bulk import: uploads bundle
- Bulk import → Scope and diff: filters and compares
- Bulk import → SQLite database: commits import
- Test team → Sample archive transfer: requests archive transfer
- Sample archive transfer → SQLite database: reads archive data
- Sample archive transfer → Sample files: packages sample files
- Inventory users → Workspace and views: manages device inventory
