Architect storage around SQLite+Honker: remove PG, add multi-tenant identity, scoping
Reorient @alkdev/storage around a single SQLite database host with Honker
for pub/sub, event streams, and task queues. PostgreSQL is removed as a
target (ADR-038), eliminating dual schema maintenance and infrastructure
complexity. Honker provides DB + pubsub + queues in one .db file (ADR-039).
Add system/tenant DB model (ADR-040): identity tables in system.db, all
graph data in tenant-{orgId}.db files. Identity tables move from the hub
into storage (ADR-041). Scoping columns (ownerId, projectId) added to
graphs table (ADR-042). Graph types get scope (system/tenant/user) to
protect infrastructure schemas (ADR-043).
Define Drizzle-Honker session adapter (ADR-044): ~100-line adapter enabling
Drizzle typed queries and Honker pubsub/queue on a single connection with
transactional consistency.
Resolve OQ-03, OQ-04, OQ-19, OQ-21, OQ-22, OQ-23, OQ-24. Add new
open questions OQ-26 through OQ-29 for Honker integration specifics.
New docs: honker-integration.md (adapter, event patterns, migration).
Scrub all PG/jsonb/libsql references from existing spec docs.
This commit is contained in:
@@ -1,23 +1,30 @@
|
||||
---
|
||||
status: draft
|
||||
last_updated: 2026-05-30
|
||||
last_updated: 2026-05-31
|
||||
---
|
||||
|
||||
# @alkdev/storage Architecture
|
||||
|
||||
Typed graph storage with dual database hosts. Deno-first, published via JSR.
|
||||
Typed graph storage with SQLite via Honker. Deno-first, published via JSR.
|
||||
|
||||
## Current State
|
||||
|
||||
Storage has Phase 1-3 of the metagraph implementation complete: Metagraph Module, bridge functions, reference graph type Modules (CallGraph, SecretGraph), and crypto utility. Phase 4 (graphology bridge) is pending. The repository/CRUD layer, PostgreSQL host, and additional graph types remain to be implemented.
|
||||
Storage has Phase 1-3 of the metagraph implementation complete: Metagraph Module,
|
||||
bridge functions, reference graph type Modules (CallGraph, SecretGraph), and
|
||||
crypto utility. Phase 4 (graphology bridge) is pending. The package is
|
||||
transitioning to SQLite-only with Honker integration (ADR-038, ADR-039) and
|
||||
adding identity tables for multi-tenant support (ADR-041). The repository/CRUD
|
||||
layer, Drizzle-Honker adapter, identity tables, and additional graph types
|
||||
remain to be implemented.
|
||||
|
||||
## Architecture Documents
|
||||
|
||||
| Document | Content | Status |
|
||||
|----------|---------|--------|
|
||||
| [overview.md](overview.md) | Package purpose, exports, dependencies, ecosystem integration | reviewed |
|
||||
| [overview.md](overview.md) | Package purpose, exports, dependencies, database model, ecosystem integration | draft |
|
||||
| [metagraph-module.md](metagraph-module.md) | TypeBox Module type system, bridge functions, implementation path | reviewed |
|
||||
| [sqlite-host.md](sqlite-host.md) | SQLite tables, relations, client factory, PG porting notes | reviewed |
|
||||
| [sqlite-host.md](sqlite-host.md) | SQLite tables (metagraph + identity), client factories, Honker adapter | draft |
|
||||
| [honker-integration.md](honker-integration.md) | Drizzle-Honker adapter, event patterns, system/tenant DB coordination | draft |
|
||||
| [schema-evolution.md](schema-evolution.md) | Value.Diff/Cast/Patch for schema migration, version strategy | reviewed |
|
||||
| [encrypted-data.md](encrypted-data.md) | Crypto utility, encrypted node type, key management | reviewed |
|
||||
| [forward-look.md](forward-look.md) | Pointers, dbtype, ujsx IR (conceptual, post-v1) | draft |
|
||||
@@ -64,6 +71,14 @@ Storage has Phase 1-3 of the metagraph implementation complete: Metagraph Module
|
||||
| [035](decisions/035-actors-become-acl-nodes.md) | Actors become ACL nodes, standalone table removed | Accepted |
|
||||
| [036](decisions/036-principal-agent-as-delegation-edges.md) | Principal-agent as delegation edges with scope narrowing | Accepted |
|
||||
| [037](decisions/037-setup-vs-runtime-separation.md) | Setup-time definitions seed graph types, runtime instances are separate | Accepted |
|
||||
| [038](decisions/038-sqlite-first-pg-removed.md) | SQLite-first, Postgres removed | Accepted |
|
||||
| [039](decisions/039-honker-as-sqlite-extension.md) | Honker as SQLite extension and transport | Accepted |
|
||||
| [040](decisions/040-system-db-tenant-db.md) | System DB + tenant DB separation | Accepted |
|
||||
| [041](decisions/041-identity-tables-in-storage.md) | Identity tables in storage package | Accepted |
|
||||
| [042](decisions/042-scoping-columns-on-graphs.md) | Scoping columns on graph instances | Accepted |
|
||||
| [043](decisions/043-graph-type-scope.md) | Graph type scope — system/tenant/user | Accepted |
|
||||
| [044](decisions/044-drizzle-honker-adapter.md) | Drizzle-Honker session adapter | Accepted |
|
||||
| [045](decisions/045-org-members-authoritative-belongsto-derived.md) | organization_members authoritative, BelongsToEdge derived | Accepted |
|
||||
|
||||
### Open Questions
|
||||
|
||||
@@ -93,6 +108,7 @@ ADR documents use a separate `Status` field in their body: `Proposed`, `Accepted
|
||||
|
||||
- Source: `src/`
|
||||
- AGENTS.md: `/workspace/@alkdev/storage/AGENTS.md`
|
||||
- Flowgraph architecture (pattern reference): `/workspace/@alkdev/flowgraph/docs/architecture/`
|
||||
- Honker source: `/workspace/honker/`
|
||||
- Flowgraph architecture: `/workspace/@alkdev/flowgraph/docs/architecture/`
|
||||
- ujsx architecture: `/workspace/@alkdev/ujsx/docs/architecture/`
|
||||
- Operations architecture: `/workspace/@alkdev/operations/docs/architecture/`
|
||||
Reference in New Issue
Block a user