Repository navigation
Architecture
English · 한국어
The client separates account authentication from local vault encryption. Miroven owns editing, search, photo conversion, encryption/decryption, IndexedDB, PIN locking, and encrypted backups. Miroven-API owns email codes, sessions, encrypted key envelopes, sync, blob storage, cleanup, and quotas. PostgreSQL and blob storage hold authentication/sync metadata and ciphertext. Miroven-Web serves product information and policies without handling the vault.
The API does not receive plaintext entries, photos, recovery codes, or PINs. It can observe email addresses, access/change times, identifiers, and ciphertext sizes.
Paths are relative to the Miroven repository:
| Path | Responsibility |
|---|---|
web/app/components/ |
Journal, search, account, and lock screens |
web/app/hooks/ |
Connect authentication, sync, backups, and UI state |
web/app/lib/remote/ |
HTTP, sessions, CSRF, generated types, envelopes, and files |
web/app/lib/journal-sync.ts |
Outbox transmission, changes, and expired-cursor recovery |
web/app/lib/vault/ |
Encryption, IndexedDB, Outbox, conflicts, and snapshot reconciliation |
web/public/sw.js |
Public app shell and static resource cache |
deploy/nginx.conf |
Static client and same-origin API proxy |
web/tests/ |
Compatibility, vault, sync, and browser checks |
Journal startup keeps home profile editing and recovery-code creation immediately available. DeferredAccountSettingsModal loads the Account UI, backup implementation, and diagnostics independently when Account opens. Its lightweight dialog can close while loading. A failed Account UI import closes the attempt with a retry message while preserving the draft; backup/diagnostic failures disable only that feature and offer an in-dialog retry. Locking cancels the pending open so a late module completion cannot reopen it.
local-vault.ts keeps the asynchronous createEncryptedBackup/importEncryptedBackup facade and dynamically imports vault/backup.ts. vault/envelope.ts provides lightweight metadata reads, while vault/operation-errors.ts shares error identities through existing facade/legacy import paths. Recovery creation remains eagerly available. This is a code-loading boundary: API contracts, IndexedDB identifiers, AAD, crypto/recovery and backup formats are unchanged; no migration is required. See Account, backups, and performance measurement.
All API routes below are under /api/v1:
| Operation | Routes | Client module |
|---|---|---|
| Email codes and sessions |
/auth/code/request, /auth/code/verify, /auth/session, /auth/logout, /auth/logout-all
|
remote/auth.ts, remote/client.ts
|
| Public signup policy | /auth/policy |
remote/auth.ts |
| Vault key envelopes | /vault |
remote/vault-repository.ts |
| Push, pull, and snapshots |
/sync/push, /sync/changes, /sync/snapshot
|
remote/journal-sync-transport.ts, journal-sync.ts
|
| Encrypted photos |
/blobs, /blobs/{blob_id}
|
remote/journal-sync-transport.ts |
| Usage and deletion |
/account/usage, /account, /account/deletion
|
remote/account.ts, useVaultAuth.ts
|
The browser does not directly access database tables or storage buckets. Account login uses a six-digit email code and an HttpOnly cookie. State changes enforce Origin and CSRF checks. Split HTTPS deployment requires same-site subdomains, the exact permitted app origin, credential CORS, and cookie-enabled requests.
A new device authenticates, fetches the wrapped vault key, and unlocks it with the recovery code. The client binds its local vault to API URL and user ID; the server rejects a stale tab's account hint if the cookie account changed. Changing accounts requires a backup, logout, and explicit local reset. Legacy remote accounts/data are not automatically migrated.
- Encrypt the entry on-device and save it locally.
- For a recoverable vault, save encrypted work in the Outbox with the entry.
- Upload encrypted photos and operations when connected. The server checks operation IDs and revisions.
- Receive remote changes, validate/decrypt them, and encrypt them in the local format.
- Commit local changes before advancing the cursor.
Cursors are opaque strings, not numbers. Conflicts preserve both sides for explicit resolution. The profile uses one reserved encrypted document and is excluded from journal/search results.
Full snapshots are staged in IndexedDB remote-stage. Only after every page validates are entries, Outbox, and cursor reconciled in one transaction. Failure preserves the existing journal and pending work. Missing server records can be republished; outdated revisions after server reset can be reconciled with current local content while preserving conflicts.
The Service Worker caches only the public shell/static assets, never sessions, API responses, or files. Non-navigation GET requests to / (including queries and alternate-representation headers) are left to the browser rather than served cached shell HTML. These requests may fail offline while root navigation still falls back to the installed shell. Decrypted caches stay in memory and are cleared on lock/logout. Account deletion requires a fresh code; its bearer receipt grants only deletion-status access. See account and sync, backup, and cryptographic format.
API request/response types are defined by its OpenAPI contract and copied with npm run api:generate; check them with npm run api:check. Production server operations are documented in API operations.
The production Service Worker precaches the complete emitted JS/CSS list, including lazy chunks, before activating. Root navigation and unhashed shell files revalidate with the network first while preserving the installed complete build as offline fallback. Existing documents are not reloaded on takeover; retained app caches supply their older lazy chunks until conservative cleanup is possible. Cached Worker responses preserve requested URL fragments for Safari. Details, exclusions, and regression commands are in PWA and updates.
- Client development · 클라이언트 개발
- Self-hosting · 자체 호스팅
- PWA, offline use, and updates · PWA·오프라인·업데이트
- Client performance · 클라이언트 성능
- Architecture · 아키텍처
- Cryptographic format · 암호화 형식
- Image processing · 사진 처리
- Security model · 보안 경계
- Product principles · 제품 원칙
- Dependency licenses · 의존성 라이선스
- Account and sync · 계정과 동기화
- Backup and recovery · 백업과 복구
- Entry quotes · 기록 인용
- Profile document · 프로필 문서