# jdeinane/sonic-light architecture

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

- Interactive diagram: https://gitdiagram.com/jdeinane/sonic-light
- Repository: https://github.com/jdeinane/sonic-light

## Overview

SonicLight is a drawing-and-sonification web app. A user identifies by username, loads or creates a stroke drawing, saves it through the API, and can listen to it; administrators can browse and listen to all saved drawings. The graph covers the documented SQLite persistence and sonification capabilities. Some implementation details are unsampled, so edges are limited to relationships visible in excerpts, the source index, or the README.

Main entry points: [`frontend/src/router/index.js`](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/router/index.js) (Page router), [`frontend/src/views/DrawView.vue`](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/DrawView.vue) (Drawing page), [`frontend/src/api.js`](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/api.js) (API client), [`frontend/src/views/AdminView.vue`](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/AdminView.vue) (Admin gallery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app_shell["App shell<br/>[App.vue]"]
  node_router["Page router<br/>[index.js]"]
  node_session["Username session<br/>[session.js]"]
  node_login["Login page<br/>[LoginView.vue]"]
end

subgraph group_drawing["Drawing experience"]
  node_draw_view["Drawing page<br/>[DrawView.vue]"]
  node_canvas["Drawing canvas<br/>[DrawingCanvas.vue]"]
  node_rendering["Stroke rendering<br/>[drawing.js]"]
  node_admin_view["Admin gallery<br/>[AdminView.vue]"]
end

subgraph group_sonification["Sonification"]
  node_play_button["Listen control<br/>[PlayButton.vue]"]
  node_audio["Drawing sonification<br/>[audio.js]"]
end

subgraph group_api["API and validation"]
  node_api_client["API client<br/>[api.js]"]
  node_api_routes["API routes<br/>[app.js]"]
  node_validation["Input validation<br/>[validation.js]"]
  node_server["API server<br/>[server.js]"]
end

subgraph group_persistence["Persistence"]
  node_data_access["Drawing data access<br/>[db.js]"]
  node_sqlite[("SQLite database")]
end

node_user(("User"))

node_user -->|"identifies"| node_login
node_user -->|"draws and saves"| node_draw_view
node_user -->|"listens"| node_play_button
node_app_shell -->|"mounts"| node_router
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_draw_view
node_router -->|"routes to"| node_admin_view
node_router -->|"checks access"| node_session
node_login -->|"logs in via"| node_api_client
node_login -->|"sets identity"| node_session
node_draw_view -->|"loads and saves"| node_api_client
node_draw_view -->|"edits strokes"| node_canvas
node_draw_view -->|"offers playback"| node_play_button
node_canvas -->|"renders strokes"| node_rendering
node_admin_view -->|"loads gallery"| node_api_client
node_admin_view -->|"shows thumbnails"| node_canvas
node_admin_view -->|"offers playback"| node_play_button
node_play_button -->|"plays drawing"| node_audio
node_audio -->|"uses stroke model"| node_rendering
node_api_client -->|"adds username"| node_session
node_api_client -->|"sends API requests"| node_api_routes
node_api_routes -->|"validates input"| node_validation
node_api_routes -->|"reads and writes"| node_data_access
node_server -->|"starts app"| node_api_routes
node_server -->|"opens database"| node_data_access
node_data_access -->|"persists drawings"| node_sqlite

click node_app_shell "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/App.vue"
click node_router "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/router/index.js"
click node_session "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/session.js"
click node_login "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/LoginView.vue"
click node_draw_view "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/DrawView.vue"
click node_canvas "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/components/DrawingCanvas.vue"
click node_rendering "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/drawing.js"
click node_admin_view "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/AdminView.vue"
click node_play_button "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/components/PlayButton.vue"
click node_audio "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/audio.js"
click node_api_client "https://github.com/jdeinane/sonic-light/blob/main/frontend/src/api.js"
click node_api_routes "https://github.com/jdeinane/sonic-light/blob/main/backend/src/app.js"
click node_validation "https://github.com/jdeinane/sonic-light/blob/main/backend/src/validation.js"
click node_server "https://github.com/jdeinane/sonic-light/blob/main/backend/src/server.js"
click node_data_access "https://github.com/jdeinane/sonic-light/blob/main/backend/src/db.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_app_shell,node_router,node_session,node_login,node_user toneBlue
class node_draw_view,node_canvas,node_rendering,node_admin_view toneAmber
class node_play_button,node_audio toneMint
class node_api_client,node_api_routes,node_validation,node_server toneRose
class node_data_access,node_sqlite toneIndigo
```

## Components

### Web client

- [App shell](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Page router](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/router/index.js): `frontend/src/router/index.js`
- [Username session](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/session.js): `frontend/src/session.js`
- [Login page](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/LoginView.vue): `frontend/src/views/LoginView.vue`

### Drawing experience

- [Drawing page](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/DrawView.vue): `frontend/src/views/DrawView.vue`
- [Drawing canvas](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/components/DrawingCanvas.vue): `frontend/src/components/DrawingCanvas.vue`
- [Stroke rendering](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/drawing.js): `frontend/src/drawing.js`
- [Admin gallery](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/views/AdminView.vue): `frontend/src/views/AdminView.vue`

### Sonification

- [Listen control](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/components/PlayButton.vue): `frontend/src/components/PlayButton.vue`
- [Drawing sonification](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/audio.js): `frontend/src/audio.js`

### API and validation

- [API client](https://github.com/jdeinane/sonic-light/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [API routes](https://github.com/jdeinane/sonic-light/blob/main/backend/src/app.js): `backend/src/app.js`
- [Input validation](https://github.com/jdeinane/sonic-light/blob/main/backend/src/validation.js): `backend/src/validation.js`
- [API server](https://github.com/jdeinane/sonic-light/blob/main/backend/src/server.js): `backend/src/server.js`

### Persistence

- [Drawing data access](https://github.com/jdeinane/sonic-light/blob/main/backend/src/db.js): `backend/src/db.js`
- **SQLite database**

### Other components

- **User**

## Connections

- User → Login page: identifies (evidence: `README.md`)
- User → Drawing page: draws and saves (evidence: `README.md`)
- User → Listen control: listens (evidence: `README.md`)
- App shell → Page router: mounts (evidence: `frontend/src/main.js`)
- Page router → Login page: routes to (evidence: `frontend/src/router/index.js`)
- Page router → Drawing page: routes to (evidence: `frontend/src/router/index.js`)
- Page router → Admin gallery: routes to (evidence: `frontend/src/router/index.js`)
- Page router → Username session: checks access (evidence: `frontend/src/router/index.js`)
- Login page → API client: logs in via (evidence: `frontend/src/views/LoginView.vue`)
- Login page → Username session: sets identity (evidence: `frontend/src/views/LoginView.vue`)
- Drawing page → API client: loads and saves (evidence: `frontend/src/views/DrawView.vue`)
- Drawing page → Drawing canvas: edits strokes (evidence: `frontend/src/views/DrawView.vue`)
- Drawing page → Listen control: offers playback (evidence: `frontend/src/views/DrawView.vue`)
- Drawing canvas → Stroke rendering: renders strokes (evidence: `frontend/src/components/DrawingCanvas.vue`)
- Admin gallery → API client: loads gallery (evidence: `frontend/src/views/AdminView.vue`)
- Admin gallery → Drawing canvas: shows thumbnails (evidence: `frontend/src/views/AdminView.vue`)
- Admin gallery → Listen control: offers playback (evidence: `frontend/src/views/AdminView.vue`)
- Listen control → Drawing sonification: plays drawing (evidence: `frontend/src/components/PlayButton.vue`)
- Drawing sonification → Stroke rendering: uses stroke model (evidence: `frontend/src/audio.js`)
- API client → Username session: adds username (evidence: `frontend/src/api.js`)
- API client → API routes: sends API requests (evidence: `frontend/src/api.js`)
- API routes → Input validation: validates input (evidence: `backend/src/app.js`)
- API routes → Drawing data access: reads and writes (evidence: `backend/src/app.js`)
- API server → API routes: starts app (evidence: `backend/src/server.js`)
- API server → Drawing data access: opens database (evidence: `backend/src/server.js`)
- Drawing data access → SQLite database: persists drawings (evidence: `README.md`)
