# santiagoa58/blind-journal architecture

> Architecture diagram of the GitHub repository santiagoa58/blind-journal, 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/santiagoa58/blind-journal
- Repository: https://github.com/santiagoa58/blind-journal

## Overview

Blind Journal is a zero-knowledge encrypted journal: the browser derives keys, encrypts entry content, and displays plaintext only while unlocked; the server authenticates users and stores encrypted records. The principal flow is account creation or sign-in, followed by an unlocked journal session and encrypted entry CRUD. The graph also preserves the documented locale-aware and responsive experience. Relationships among sampled server modules are supported by the source index or excerpts; client-to-API and UI composition links rely on README statements where implementation excerpts were unavailable.

Main entry points: [`app/api/v1/auth/login/route.ts`](https://github.com/santiagoa58/blind-journal/blob/main/app/api/v1/auth/login/route.ts) (Auth API routes), [`components/journal/journal-workspace.tsx`](https://github.com/santiagoa58/blind-journal/blob/main/components/journal/journal-workspace.tsx) (Journal workspace), [`server/auth/session.ts`](https://github.com/santiagoa58/blind-journal/blob/main/server/auth/session.ts) (Opaque sessions), [`components/auth/login-card.tsx`](https://github.com/santiagoa58/blind-journal/blob/main/components/auth/login-card.tsx) (Account and sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and sessions"]
  node_auth_ui["Account and sign-in<br/>[login-card.tsx]"]
  node_account_ui["Create account"]
  node_key_client["Key derivation client"]
  node_key_worker["Derivation worker"]
  node_auth_api["Auth API routes<br/>[route.ts]"]
  node_auth_service["Authentication service<br/>[auth.ts]"]
  node_session_service["Opaque sessions<br/>[session.ts]"]
  node_session_state["Browser session state"]
end

subgraph group_journal["Encrypted journaling"]
  node_journal_ui["Journal workspace"]
  node_entry_list["Entry list and filter<br/>[entry-list.tsx]"]
  node_entry_editor["Rich-text editor<br/>[journal-editor.tsx]"]
  node_entry_crypto["Entry encryption<br/>[journal.crypto.ts]"]
  node_journal_client["Journal API client<br/>[journal.ts]"]
  node_entry_routes["Entry API routes<br/>[route.ts]"]
  node_journal_service["Journal service<br/>[journal.ts]"]
end

subgraph group_server["Server and storage"]
  node_account_store[("Account database<br/>[accounts.ts]")]
  node_session_store[("Session database<br/>[sessions.ts]")]
  node_entry_store[("Encrypted entry database<br/>[journal-entries.ts]")]
end

subgraph group_experience["User experience"]
  node_locales["Locale routing<br/>[routing.ts]"]
  node_pwa_theme["PWA and themes<br/>[manifest.ts]"]
end

node_person(("Journal user"))

node_person -->|"creates account"| node_account_ui
node_person -->|"signs in"| node_auth_ui
node_account_ui -.->|"derives keys"| node_key_client
node_auth_ui -.->|"derives keys"| node_key_client
node_key_client -->|"dispatches derivation"| node_key_worker
node_account_ui -.->|"submits account"| node_auth_api
node_auth_ui -.->|"submits credentials"| node_auth_api
node_auth_api -->|"calls service"| node_auth_service
node_auth_service -->|"reads and creates"| node_account_store
node_auth_service -->|"creates session"| node_session_service
node_session_service -->|"reads and writes"| node_session_store
node_auth_api -->|"starts session"| node_session_service
node_session_state -.->|"unlocks workspace"| node_journal_ui
node_person -->|"journals"| node_journal_ui
node_journal_ui -.->|"edits entries"| node_entry_editor
node_journal_ui -.->|"browses entries"| node_entry_list
node_entry_editor -.->|"encrypts content"| node_entry_crypto
node_entry_list -.->|"decrypts content"| node_entry_crypto
node_entry_crypto -.->|"protects payload"| node_journal_client
node_journal_client -.->|"sends requests"| node_entry_routes
node_entry_routes -->|"authenticates user"| node_session_service
node_entry_routes -->|"dispatches CRUD"| node_journal_service
node_journal_service -->|"reads and writes"| node_entry_store
node_person -.->|"chooses locale"| node_locales
node_person -.->|"uses app"| node_pwa_theme

click node_auth_ui "https://github.com/santiagoa58/blind-journal/blob/main/components/auth/login-card.tsx"
click node_account_ui "https://github.com/santiagoa58/blind-journal/blob/main/components/auth/create-account-card.tsx"
click node_key_client "https://github.com/santiagoa58/blind-journal/blob/main/lib/api/auth/auth-worker-client.ts"
click node_key_worker "https://github.com/santiagoa58/blind-journal/blob/main/lib/api/auth/worker/auth-key-derivation.ts"
click node_auth_api "https://github.com/santiagoa58/blind-journal/blob/main/app/api/v1/auth/login/route.ts"
click node_auth_service "https://github.com/santiagoa58/blind-journal/blob/main/server/auth/auth.ts"
click node_session_service "https://github.com/santiagoa58/blind-journal/blob/main/server/auth/session.ts"
click node_session_state "https://github.com/santiagoa58/blind-journal/blob/main/client-state/app-session.state.tsx"
click node_journal_ui "https://github.com/santiagoa58/blind-journal/blob/main/components/journal/journal-workspace.tsx"
click node_entry_list "https://github.com/santiagoa58/blind-journal/blob/main/components/journal/entry-list.tsx"
click node_entry_editor "https://github.com/santiagoa58/blind-journal/blob/main/components/journal/journal-editor.tsx"
click node_entry_crypto "https://github.com/santiagoa58/blind-journal/blob/main/lib/api/journal/journal.crypto.ts"
click node_journal_client "https://github.com/santiagoa58/blind-journal/blob/main/lib/api/journal/journal.ts"
click node_entry_routes "https://github.com/santiagoa58/blind-journal/blob/main/app/api/v1/entries/route.ts"
click node_journal_service "https://github.com/santiagoa58/blind-journal/blob/main/server/journal/journal.ts"
click node_account_store "https://github.com/santiagoa58/blind-journal/blob/main/server/database/accounts.ts"
click node_session_store "https://github.com/santiagoa58/blind-journal/blob/main/server/database/sessions.ts"
click node_entry_store "https://github.com/santiagoa58/blind-journal/blob/main/server/database/journal-entries.ts"
click node_locales "https://github.com/santiagoa58/blind-journal/blob/main/i18n/routing.ts"
click node_pwa_theme "https://github.com/santiagoa58/blind-journal/blob/main/app/manifest.ts"

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_auth_ui,node_account_ui,node_key_client,node_key_worker,node_auth_api,node_auth_service,node_session_service,node_session_state,node_person toneBlue
class node_journal_ui,node_entry_list,node_entry_editor,node_entry_crypto,node_journal_client,node_entry_routes,node_journal_service toneAmber
class node_account_store,node_session_store,node_entry_store toneMint
class node_locales,node_pwa_theme toneRose
```

## Components

### Identity and sessions

- [Account and sign-in](https://github.com/santiagoa58/blind-journal/blob/main/components/auth/login-card.tsx): `components/auth/login-card.tsx`
- [Create account](https://github.com/santiagoa58/blind-journal/blob/main/components/auth/create-account-card.tsx): `components/auth/create-account-card.tsx`
- [Key derivation client](https://github.com/santiagoa58/blind-journal/blob/main/lib/api/auth/auth-worker-client.ts): `lib/api/auth/auth-worker-client.ts`
- [Derivation worker](https://github.com/santiagoa58/blind-journal/blob/main/lib/api/auth/worker/auth-key-derivation.ts): `lib/api/auth/worker/auth-key-derivation.ts`
- [Auth API routes](https://github.com/santiagoa58/blind-journal/blob/main/app/api/v1/auth/login/route.ts): `app/api/v1/auth/login/route.ts`
- [Authentication service](https://github.com/santiagoa58/blind-journal/blob/main/server/auth/auth.ts): `server/auth/auth.ts`
- [Opaque sessions](https://github.com/santiagoa58/blind-journal/blob/main/server/auth/session.ts): `server/auth/session.ts`
- [Browser session state](https://github.com/santiagoa58/blind-journal/blob/main/client-state/app-session.state.tsx): `client-state/app-session.state.tsx`

### Encrypted journaling

- [Journal workspace](https://github.com/santiagoa58/blind-journal/blob/main/components/journal/journal-workspace.tsx): `components/journal/journal-workspace.tsx`
- [Entry list and filter](https://github.com/santiagoa58/blind-journal/blob/main/components/journal/entry-list.tsx): `components/journal/entry-list.tsx`
- [Rich-text editor](https://github.com/santiagoa58/blind-journal/blob/main/components/journal/journal-editor.tsx): `components/journal/journal-editor.tsx`
- [Entry encryption](https://github.com/santiagoa58/blind-journal/blob/main/lib/api/journal/journal.crypto.ts): `lib/api/journal/journal.crypto.ts`
- [Journal API client](https://github.com/santiagoa58/blind-journal/blob/main/lib/api/journal/journal.ts): `lib/api/journal/journal.ts`
- [Entry API routes](https://github.com/santiagoa58/blind-journal/blob/main/app/api/v1/entries/route.ts): `app/api/v1/entries/route.ts`
- [Journal service](https://github.com/santiagoa58/blind-journal/blob/main/server/journal/journal.ts): `server/journal/journal.ts`

### Server and storage

- [Account database](https://github.com/santiagoa58/blind-journal/blob/main/server/database/accounts.ts): `server/database/accounts.ts`
- [Session database](https://github.com/santiagoa58/blind-journal/blob/main/server/database/sessions.ts): `server/database/sessions.ts`
- [Encrypted entry database](https://github.com/santiagoa58/blind-journal/blob/main/server/database/journal-entries.ts): `server/database/journal-entries.ts`

### User experience

- [Locale routing](https://github.com/santiagoa58/blind-journal/blob/main/i18n/routing.ts): `i18n/routing.ts`
- [PWA and themes](https://github.com/santiagoa58/blind-journal/blob/main/app/manifest.ts): `app/manifest.ts`

### Other components

- **Journal user**

## Connections

- Journal user → Create account: creates account
- Journal user → Account and sign-in: signs in
- Create account → Key derivation client: derives keys
- Account and sign-in → Key derivation client: derives keys
- Key derivation client → Derivation worker: dispatches derivation (evidence: `lib/api/auth/auth-worker-client.ts`)
- Create account → Auth API routes: submits account
- Account and sign-in → Auth API routes: submits credentials
- Auth API routes → Authentication service: calls service (evidence: `app/api/v1/auth/login/route.ts`)
- Authentication service → Account database: reads and creates (evidence: `server/auth/auth.ts`)
- Authentication service → Opaque sessions: creates session (evidence: `server/auth/auth.ts`)
- Opaque sessions → Session database: reads and writes (evidence: `server/auth/session.ts`)
- Auth API routes → Opaque sessions: starts session (evidence: `app/api/v1/auth/login/route.ts`)
- Browser session state → Journal workspace: unlocks workspace
- Journal user → Journal workspace: journals
- Journal workspace → Rich-text editor: edits entries
- Journal workspace → Entry list and filter: browses entries
- Rich-text editor → Entry encryption: encrypts content
- Entry list and filter → Entry encryption: decrypts content
- Entry encryption → Journal API client: protects payload
- Journal API client → Entry API routes: sends requests
- Entry API routes → Opaque sessions: authenticates user (evidence: `app/api/v1/entries/route.ts`)
- Entry API routes → Journal service: dispatches CRUD (evidence: `app/api/v1/entries/route.ts`)
- Journal service → Encrypted entry database: reads and writes (evidence: `server/journal/journal.ts`)
- Journal user → Locale routing: chooses locale
- Journal user → PWA and themes: uses app
