# htl23pernsteiner/dewit---todo-app architecture

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

- Interactive diagram: https://gitdiagram.com/htl23pernsteiner/dewit---todo-app
- Repository: https://github.com/htl23pernsteiner/dewit---todo-app

## Overview

Dewit is a todo and note-taking app with authenticated, per-user notes, priorities, a My Day focus, search/filtering and calendar views. The main workflow is users opening the web app, signing in, then managing notes through the frontend API client; the Express API authenticates requests and persists data in PostgreSQL. An alternate localStorage frontend supports offline development. The README documents Nginx and the frontend/backend/database arrangement; source excerpts show the API’s database and authentication calls, but do not show all page wiring.

Main entry points: [`backend/server.js`](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/server.js) (REST API), [`script-api.js`](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/script-api.js) (API client and views), [`nginx.conf`](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/nginx.conf) (Nginx web server), [`index.html`](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/index.html) (Todo app page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_nginx["Nginx web server<br/>[nginx.conf]"]
  node_main_page["Todo app page<br/>[index.html]"]
  node_login_page["Login page<br/>[index-login.html]"]
  node_api_client["API client and views<br/>[script-api.js]"]
  node_offline_app["Offline localStorage app<br/>[script.js]"]
end

subgraph group_api["Backend API"]
  node_api_server["REST API<br/>[server.js]"]
  node_auth["JWT and passwords<br/>[auth.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_pool["PostgreSQL pool<br/>[db.js]"]
  node_postgres[("PostgreSQL notes and users<br/>[schema.sql]")]
end

node_user(("User"))
node_browser_storage[("Browser localStorage")]

node_user -->|"opens app"| node_nginx
node_nginx -->|"serves frontend"| node_main_page
node_user -->|"signs in"| node_login_page
node_login_page -.->|"uses auth client"| node_api_client
node_main_page -.->|"loads client"| node_api_client
node_api_client -->|"calls API"| node_api_server
node_api_server -->|"uses auth helpers"| node_auth
node_api_server -->|"queries pool"| node_db_pool
node_db_pool -->|"connects to"| node_postgres
node_offline_app -->|"reads and writes"| node_browser_storage

click node_nginx "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/nginx.conf"
click node_main_page "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/index.html"
click node_login_page "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/index-login.html"
click node_api_client "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/script-api.js"
click node_offline_app "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/script.js"
click node_api_server "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/server.js"
click node_auth "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/auth.js"
click node_db_pool "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/db.js"
click node_postgres "https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/schema.sql"

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_nginx,node_main_page,node_login_page,node_api_client,node_offline_app,node_user toneBlue
class node_api_server,node_auth,node_browser_storage toneAmber
class node_db_pool,node_postgres toneMint
```

## Components

### Web application

- [Nginx web server](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/nginx.conf): `nginx.conf`
- [Todo app page](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/index.html): `index.html`
- [Login page](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/index-login.html): `index-login.html`
- [API client and views](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/script-api.js): `script-api.js`
- [Offline localStorage app](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/script.js): `script.js`

### Backend API

- [REST API](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/server.js): `backend/server.js`
- [JWT and passwords](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/auth.js): `backend/auth.js`

### Persistence

- [PostgreSQL pool](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/db.js): `backend/db.js`
- [PostgreSQL notes and users](https://github.com/htl23pernsteiner/dewit---todo-app/blob/main/backend/schema.sql): `backend/schema.sql`

### Other components

- **User**
- **Browser localStorage**

## Connections

- User → Nginx web server: opens app (evidence: `README.md`)
- Nginx web server → Todo app page: serves frontend (evidence: `README.md`)
- User → Login page: signs in (evidence: `README.md`)
- Login page → API client and views: uses auth client
- Todo app page → API client and views: loads client
- API client and views → REST API: calls API (evidence: `README.md`)
- REST API → JWT and passwords: uses auth helpers (evidence: `backend/server.js`)
- REST API → PostgreSQL pool: queries pool (evidence: `backend/server.js`)
- PostgreSQL pool → PostgreSQL notes and users: connects to (evidence: `backend/db.js`)
- Offline localStorage app → Browser localStorage: reads and writes (evidence: `script.js`)
