Files
investor-flow/docs/adr/0001-local-first-multi-tenant.md
T

1.1 KiB

ADR-0001: Local-first, multi-tenant architecture

Date: 2026-06-27 Status: Accepted (design phase)

Context

Investor Flow must serve many beginner users (not just the operator) while honoring "store locally, run reports, avoid rate limits." Single-user local SQLite does not fit once multiple users exist.

Decision

One shared Bun + SQLite backend (Docker Compose), local-first (not cloud). Per-user logical isolation inside one DB:

  • Tier A (shared market cache): price, options, filings, 13F/13G/4 snapshots, sector map.
  • Tier B (shared content): X/Reddit thread mirrors, adapter backoff state.
  • Tier C (per-user, ownerId): watchlists, portfolios, journal, reports, alerts, trusted accounts, saved posts.
  • Tier D (system): users, sessions.

Adapter queue dedupes: User A and B both requesting NVDA price within staleness window triggers ONE fetch; result shared.

Consequences

  • Multi-tenant + local-first coexist via shared public cache, private user rows.
  • Most LLM summaries are free for second-and-later users (deterministic by prompt-hash).
  • Operator runs admin tooling for user management, GDPR export, queue health.