# guroking/diary-zip architecture

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

- Interactive diagram: https://gitdiagram.com/guroking/diary-zip
- Repository: https://github.com/guroking/diary-zip

## Overview

Diary.zip is a private diary application: users sign in, write an entry, receive AI-generated reflections, then revisit entries through calendar and monthly insights. The client also supports secondary-lock settings and checklist-oriented reminders. The sampled server excerpt shows authentication, diary analysis, database queries and calendar handling; the README documents additional API and security capabilities. Several backend stages share server.js, so their boundaries are conceptual rather than separate modules; unsampled implementation details are not inferred.

Main entry points: [`diary-client/src/App.tsx`](https://github.com/guroking/diary-zip/blob/main/diary-client/src/App.tsx) (Diary interface), [`diary-server/config/db.js`](https://github.com/guroking/diary-zip/blob/main/diary-server/config/db.js) (PostgreSQL access), [`diary-server/server.js`](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js) (Diary operations), [`diary-client/src/main.tsx`](https://github.com/guroking/diary-zip/blob/main/diary-client/src/main.tsx) (Client startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Diary client"]
  node_client_app["Diary interface<br/>[App.tsx]"]
  node_client_entry["Client startup<br/>[main.tsx]"]
end

subgraph group_server["Diary services"]
  node_auth["Account access<br/>[server.js]"]
  node_settings["Lock settings<br/>[server.js]"]
  node_entry_api["Diary operations<br/>[server.js]"]
  node_analysis["AI analysis<br/>[server.js]"]
  node_calendar["Calendar data<br/>[server.js]"]
  node_insights["Monthly insights<br/>[server.js]"]
  node_streak["Writing streak<br/>[server.js]"]
  node_db_pool["PostgreSQL access<br/>[db.js]"]
end

subgraph group_integrations["External services"]
  node_diary_store[("Diary database")]
  node_ai_provider["AI provider"]
end

node_user(("Diary user"))

node_user -->|"uses"| node_client_app
node_client_entry -->|"renders"| node_client_app
node_client_app -->|"requests login"| node_auth
node_client_app -->|"updates locks"| node_settings
node_client_app -->|"opens entries"| node_entry_api
node_client_app -->|"loads month"| node_calendar
node_client_app -->|"loads insights"| node_insights
node_auth -->|"queries accounts"| node_db_pool
node_settings -.->|"queries settings"| node_db_pool
node_entry_api -->|"requests analysis"| node_analysis
node_entry_api -->|"stores entries"| node_db_pool
node_calendar -->|"queries dates"| node_db_pool
node_insights -.->|"queries statistics"| node_db_pool
node_streak -->|"queries dates"| node_db_pool
node_db_pool -->|"reads and writes"| node_diary_store
node_analysis -->|"analyzes diary"| node_ai_provider

click node_client_app "https://github.com/guroking/diary-zip/blob/main/diary-client/src/App.tsx"
click node_client_entry "https://github.com/guroking/diary-zip/blob/main/diary-client/src/main.tsx"
click node_auth "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_settings "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_entry_api "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_analysis "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_calendar "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_insights "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_streak "https://github.com/guroking/diary-zip/blob/main/diary-server/server.js"
click node_db_pool "https://github.com/guroking/diary-zip/blob/main/diary-server/config/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_client_app,node_client_entry,node_user toneBlue
class node_auth,node_settings,node_entry_api,node_analysis,node_calendar,node_insights,node_streak,node_db_pool toneAmber
class node_diary_store,node_ai_provider toneMint
```

## Components

### Diary client

- [Diary interface](https://github.com/guroking/diary-zip/blob/main/diary-client/src/App.tsx): `diary-client/src/App.tsx`
- [Client startup](https://github.com/guroking/diary-zip/blob/main/diary-client/src/main.tsx): `diary-client/src/main.tsx`

### Diary services

- [Account access](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [Lock settings](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [Diary operations](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [AI analysis](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [Calendar data](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [Monthly insights](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [Writing streak](https://github.com/guroking/diary-zip/blob/main/diary-server/server.js): `diary-server/server.js`
- [PostgreSQL access](https://github.com/guroking/diary-zip/blob/main/diary-server/config/db.js): `diary-server/config/db.js`

### External services

- **Diary database**
- **AI provider**

### Other components

- **Diary user**

## Connections

- Diary user → Diary interface: uses (evidence: `README.md`)
- Client startup → Diary interface: renders (evidence: `diary-client/src/main.tsx`)
- Diary interface → Account access: requests login (evidence: `diary-client/src/App.tsx`)
- Diary interface → Lock settings: updates locks (evidence: `diary-client/src/App.tsx`)
- Diary interface → Diary operations: opens entries (evidence: `diary-client/src/App.tsx`)
- Diary interface → Calendar data: loads month (evidence: `diary-client/src/App.tsx`)
- Diary interface → Monthly insights: loads insights (evidence: `diary-client/src/App.tsx`)
- Account access → PostgreSQL access: queries accounts (evidence: `diary-server/server.js`)
- Lock settings → PostgreSQL access: queries settings (evidence: `diary-server/server.js`)
- Diary operations → AI analysis: requests analysis (evidence: `diary-server/server.js`)
- Diary operations → PostgreSQL access: stores entries (evidence: `diary-server/server.js`)
- Calendar data → PostgreSQL access: queries dates (evidence: `diary-server/server.js`)
- Monthly insights → PostgreSQL access: queries statistics (evidence: `diary-server/server.js`)
- Writing streak → PostgreSQL access: queries dates (evidence: `diary-server/server.js`)
- PostgreSQL access → Diary database: reads and writes (evidence: `diary-server/config/db.js`)
- AI analysis → AI provider: analyzes diary (evidence: `README.md`)
