npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@derwinjs/db

v0.18.0

Published

Prisma schema + migrations for Derwin's own Postgres. 14 models, project-namespaced. Per ADR-0005. Ships its own generated Prisma client (multi-platform binaries) for cross-consumer compatibility.

Readme

@derwinjs/db

Prisma schema + migrations for Derwin's own Postgres. 14 models, project-namespaced. Per ADR-0005.

This package owns the platform's persistence layer. Consumer DBs (Lifeline's Postgres, Side Piece's Postgres) are NOT shared with this — Derwin reads from them via Ticket / Document adapters; it stores its own state here.

Quick start

# 1. Set up Postgres locally (one option: Docker)
docker run -d --name derwin-pg \
  -e POSTGRES_USER=derwin \
  -e POSTGRES_PASSWORD=derwin \
  -e POSTGRES_DB=derwin \
  -p 5432:5432 \
  postgres:16

# 2. Configure connection
cp packages/db/.env.example packages/db/.env
# Edit DATABASE_URL if needed

# 3. Generate Prisma client + apply migrations
pnpm --filter @derwinjs/db prisma:generate
pnpm --filter @derwinjs/db prisma:migrate

# 4. Seed dev fixture (Lifeline project + Profile + default Policy)
pnpm --filter @derwinjs/db db:seed

After seeding, you can connect with psql and inspect:

docker exec -it derwin-pg psql -U derwin -d derwin -c "SELECT slug, type, mode FROM projects;"

Expected: one row, lifeline | ERP | AUTHOR.

Production: Supabase

Per ADR-0005, the production deployment uses Supabase (parity with Lifeline). Connection string format:

postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres

The pgvector extension gets enabled in QAP-036 (Sprint 3 — DB deployment). The RAGCorpus.embedding column is Bytes? for v1; QAP-076 (Sprint 7) switches it to vector(1536) once pgvector is available.

Schema conventions

  • Project-namespaced. Every project-scoped table has a projectId FK to Project. Cross-project leakage is the leading regression risk; queries MUST filter on projectId.
  • Cascading deletes. Deleting a Project cleanly removes all project-scoped data (cascades through 12 of 14 models).
  • Append-only logs. ProfileEvolutionLog, ProjectModeLog, SpendLedger are append-only — never updated, never deleted (compliance requirement per product brief §11.3).
  • Audit retention. AuditArtifact.retentionUntil is computed at write time from project compliance mode; a separate retention cron prunes expired artifacts (lands in Sprint 7).
  • Indices on every read pattern. Per technical spec §3 — (projectId, status), (projectId, finalBucket), (projectId, createdAt DESC), etc.

Models (14)

| # | Model | Purpose | Layer | | --- | --------------------- | --------------------------------------------------------- | ------------- | | 1 | Project | Multi-tenant root | A (Profile) | | 2 | ProjectProfile | Domain ontology, risk weights, critical flows, glossary | A | | 3 | IngestedDoc | Source docs that fed the Profile | A | | 4 | ProfileEvolutionLog | Append-only audit of every Profile change | A | | 5 | QARun | One discovery pass | B/C | | 6 | RawSignal | What a Discovery route emits before triage | B/C | | 7 | QATicket | The structured bug ticket | D | | 8 | QAFixAttempt | One Claude dispatch + outcome | E | | 9 | ClassificationTrust | Per-classification rolling 30-day trust score | F | | 10 | RAGCorpus | Successful past fixes for in-context examples | F | | 11 | AuditArtifact | Persistent evidence (screenshots, videos, prompts, diffs) | cross-cutting | | 12 | Policy | Risk-tier rules, classification overrides, thresholds | safety | | 13 | ProjectModeLog | Append-only mode-change audit | safety | | 14 | SpendLedger | Per-event $ spend (Anthropic, storage, etc.) | cost |

Detail: see prisma/schema.prisma and technical spec §3.

Status

Scaffolded in QAP-005 (Sprint 1). Schema is complete; the Prisma client gets imported by @derwinjs/core and @derwinjs/api starting in Sprint 2.