medicine-wheel

data-store-postgres — RISE Specification

Minimal Postgres/Neon backend for Medicine Wheel relational persistence.

Goal: Add a PostgreSQL/Neon path while keeping ontology-core types unchanged and converging the long-term provider abstraction in src/storage-provider/.

Architecture: Keep the storage contract thin. Reuse RelationalNode, RelationalEdge, and CeremonyLog from @medicine-wheel/ontology-core; use this package as a small Postgres scaffold only, while the shared provider-selection surface lives in src/storage-provider/.

Tech Stack: TypeScript, pg, Neon/Postgres connection strings with explicit SSL selection.


Why this exists

The current src/data-store package is Redis-specific. The demo app already has Postgres/Neon available in hosted environments, so we need an additive Postgres path that proves the backend without promoting a second long-term provider architecture beside src/storage-provider/.

Minimal requirement

Create a new workspace package at src/data-store-postgres/ that:

  1. Connects through pg using DATABASE_URL, POSTGRES_URL, or NEON_DATABASE_URL
  2. Exports a shared pool helper keyed by effective connection options
  3. Reuses ontology-core types as the storage contract
  4. Stays small enough to serve as the first backend proof

Non-goals for this first pass

Suggested first schema target

Start with the same core entities the Redis store already handles:

Keep the schema simple and JSON-friendly so the app can move from Redis/JSONL toward Postgres without changing domain types.

Acceptance criteria

Notes for the implementing agent