Melon-dbMelon-db

PRD compliance matrix

Mapping workspace PRDs and RFCs to implementation status across packages and apps.

This page tracks how Melon-db implementation compares to the product requirements in .cursor/rules/ (prd-1 through prd-4, db-core, db-query, db-prisma, package-roles, file-layout). prd-4 describes a future sliding-window retention subsystem — not part of v1 core. For shipped phase history see Roadmap.

Legend: Done · Partial · Deferred (intentional v1 limit) · Gap (not scheduled / needs decision)


Executive summary

BucketExamples
DoneCore engine, SQLite, sync, codemods, hasMany includes, Q.on / relationFilters, observeQuery precision, walkthroughs
PartialMango/Prisma surfaces, testkit helpers, devtools (Plan/params), playground-web, hook/schema typing
DeferredSQL SELECT JOIN shaping, full schema codemods, background sync
GapgetChangedCollections, sliding window (prd-4), Supabase/REST backends, npm alpha / open-source release

@melon-db/db

RequirementStatusNotes
Schema + createMelonSchemaDoneGeneric schema preserves collection keys
AST + prepare/validate/planDone
StorageAdapter contractDone
createDatabase, collections, CRUD, observeDone
In-memory adapterDoneIn core; re-exported from testkit
Serialized write queueDone
belongsTo includes (engine)DoneloadIncludes
hasMany includes (engine)DonePost-fetch batch load; global limit on child query
relationFilters / Q.on filtersDoneSQLite IN subquery; in-memory applyRelationFilters
Sync APIs on DBDoneBeyond minimal db-core
collection.query(builder => …)DoneVia @melon-db/db-query bridge
observeQuery on in-memoryPartialEngine ChangeEmitter fallback
getChangedCollectionsGapNot on any adapter; outbox used for sync
Read blocked during writeGapWrites serialized; reads do not wait on queue

@melon-db/db-sqlite + @melon-db/db-sqlite-native

RequirementStatusNotes
AST → SQLDone
Node / Bun / Expo / RNDone
TransactionsDone
observeQuery + triggersDonePhase 27–29; Phase 33 cross-collection relationFilters + field-aware invalidation
BenchmarksDone
iOS/Android JSI + TurboModuleDone
SQL joins / partial selectDeferredcapabilities.joins: false; includes via post-fetch
getChangedCollectionsGap
Unified createSqliteAdapter({ jsi })PartialJSI via createJsiSqliteAdapter export

@melon-db/db-query

RequirementStatusNotes
QueryBuilder + createQueryFactoryDone
byId / byForeignKeyDone
resolveCollectionQueryDoneBuilder → AST for collections
findMany / findFirst / count + builderDoneSame CollectionQueryInput as query()
Schema-driven inferencePartialFactory accepts schema; no field inference yet
Builder .not()DoneMirrors and / or nesting
Hook/schema typing without assertionsPartialresolveCollectionQuery overloads; collection keys via generics

@melon-db/db-query-mango

RequirementStatusNotes
createMangoCompilerDone
Core Mango operatorsDone
mode: one / countDoneMangoQuery.mode
normalizeMangoQueryDoneMangoNormalizer
$contains, null checksPartialLimited operator map
Operator matrix docPartialSee package README

@melon-db/db-react

RequirementStatusNotes
Provider + core hooksDone
useMangoQuery, useFindMany, useFindFirstDone
useFindMany + fluent builderDoneuseFluentQuery helper
useRecordDonePrimary-key observe + useRecordState
Hook loading/error stateDoneuseQueryState, useFindManyState, useFluentQueryState, useRecordState
Sync hooks in this packagePartialConvenience; package-roles boundary drift
Hook/schema typing without assertionsPartialisPreparedQuery guards; UseQueryOptions select generic

@melon-db/db-prisma

RequirementStatusNotes
Prisma schema importDoneimportPrismaSchema on ./node
compilePrismaQuery + clientDone
select / include in compilerDonebelongsTo includes only
CLI melon-prismaDonepackage.json bin
observeMany on clientPartialCodegen re-exports hooks
emitZodGap

@melon-db/db-devtools, @melon-db/db-testkit, @melon-db/db-codemods

PackageStatusMain gap
devtoolsPartialPlan + SQL params in UI; Retention tab stub (prd-4)
testkitPartialNo Jest helpers / fake clock
codemodsDonemigrate-schema spike; Q.on → relationFilters when schema passed to translator

@melon-db/sync + @melon-db/sync-server

RequirementStatusNotes
Pull/push, checkpoint, retry, conflictsDone
Postgres reference backendDone
merging sync stateDeferredSee Phase 29+ decisions
Persistent multi-job queueDeferred
Supabase / REST recipesGap
Sliding window / local prune (prd-4)GapBuilds on pull/push + outbox; not a sync-server replacement
React hooksN/AIn @melon-db/db-react

Sliding window (prd-4)

Future retention subsystem from prd-4.mdc — org-aware download windows, safe local pruning, and diagnostics. Not scheduled for v1.

RequirementStatusNotes
Window definition model (per org / entity)GapServer-sourced config via app API
Effective window computationGapPure-function policy engine
Record eligibility (in-window / protected / prune-eligible)GapProtect unsynced + relational deps
Prune planner + executorGapPost-sync + pressure modes
sync_window_state + local_prune_ledger tablesGapPhase 1 in prd-4
Pressure modes (normal / low-storage / emergency)Gap
Background maintenance (NetInfo, background fetch)GapOpportunistic + resume
Retention observability (devtools / support UI)GapDevtools Retention tab stub only
Devtools integrationPartialPlaceholder tab; full UI with Phase 31+

Package home (TBD): @melon-db/sync extension or @melon-db/sync-retention — sync packages must not depend on query-layer packages per package-roles.


Apps

Featureplayground-rnplayground-rn-devplayground-webdocsplayground-node
SQLite / storageExpoNative JSIIn-memoryIn-memory live UINode SQLite
CRUD + reactiveYesYesYesYesYes
Delete in UIPartialYesYesYes—
Mango / Prisma / relations demos—Demos screenFluent queryDocs + walkthrough—
Devtools panel—YesYesToggle in playground—
BenchmarksNoDev screen—Static JSONNode benches
Sync + backend demosClient onlyClient—Sync playgroundHTTP + Postgres scripts

Alpha release and open source (prd-1)

Pre-GA work required before publishing @melon-db/* to npm and opening the GitHub repository. Phase 34 implements the release engineering and adoption plumbing; a couple items remain manual (npm org creation + flipping GitHub public).

RequirementStatusNotes
GitHub: private → publicGapManual: flip visibility, enable branch protection + secret scanning
Community filesDoneRoot LICENSE, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, templates
Secret / history hygieneDone.gitignore tightened for local artifacts; manual scan recommended before public
npm org @melon-dbGapManual: create org, invite maintainers, enforce 2FA
Per-package publish metadataDonefiles, exports, publishConfig.access: public, license, repository, aligned versions
Monorepo publish workflowDonerelease.yml + tooling/release/publish.ts (topological order, --tag alpha)
Alpha versioning policyDoneLockstep 0.1.0-alpha.0 + alpha dist-tag
npm provenance / trusted publishPartialWorkflow supports token publish; switch to OIDC when npm org is configured
Dependency & supply-chain securityDoneRelease workflow runs bun audit and smoke from packed tarballs
Security disclosure processDoneSECURITY.md
Release notes & changelogDoneRoot CHANGELOG.md; use GitHub Releases for tags
Install docs for consumersDoneGetting started includes npm/Bun install
Support / SLA for alphaDoneAlpha support policy + issue templates
  1. Legal & repo hygiene (before public GitHub)

    • Choose and add a LICENSE.
    • Add CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.
    • Enable branch protection, required status checks, and secret scanning / Dependabot.
    • Confirm no credentials in git history, .env examples, or CI logs.
  2. npm organization & package prep

    • Create npm org @melon-db; add maintainers with 2FA.
    • For each publishable package under packages/*: verify name, version, description, repository, license, files / exports, and "publishConfig": { "access": "public" }.
    • Run bun run build and smoke tests from packed tarballs (npm pack / bun pm pack) — not only workspace links.
  3. Alpha release

    • Publish with dist-tag alpha (e.g. @melon-db/db@0.1.0-alpha.0).
    • Tag monorepo release in GitHub; attach release notes listing packages and known limitations (v1 limitations).
    • Update Getting started and package pages with non-workspace install instructions.
  4. Security hardening (ongoing)

    • CI: audit on PR + before publish.
    • Document supported React Native / Expo versions and native setup boundaries.
    • Review third-party native dependencies and pin where necessary.
  5. Path to GA (post-alpha)

    • Stable 1.0.0 criteria aligned with prd-1 Milestone 5 (API freeze, migration docs, benchmark publication).
    • Promote dist-tag from alpha → latest only after acceptance criteria met.

Package home: release automation likely lives in root CI + tooling/ scripts; individual packages stay publishable units per package-roles.


Phase 29+ decisions

Product decisions recorded here (not blockers for phases 0–28):

ItemDecisionRationale
getChangedCollectionsDeferSync uses outbox + getLocalChanges; adapter hook when sync needs incremental adapter scans
SQL SELECT JOIN / partial selectDeferIncludes remain post-fetch; see ADR-011
Per-parent nested take on includesDeferGlobal child limit only in v1
Sync merging stateDeferApply path is synchronous; add when merge UI needs distinct phase
@melon-db/db-react → @melon-db/sync depAcceptDX for useSync; split only if publishing react without sync
playground-webPartialIn-memory Vite app; full web SQLite adapter still deferred
Read-during-write blockingDeferSerialized writes sufficient for v1; revisit if readers observe torn state
Sliding window subsystem (prd-4)DeferPhase 31+; policy foundation before prune executor
Alpha / open-source releaseNext (Phase 34)Public GitHub + npm @melon-db alpha; see Alpha release and open source

PRD source index

FileFocus
prd-1.mdcProduct vision, sync, RN, hooks, GA checklist, open source / npm alpha
prd-2.mdcAST-first multi-surface queries
prd-3.mdcTypeScript interface contracts
prd-4.mdcFuture sliding-window retention, prune ledger, org-aware scope
db-core.mdc@melon-db/db + @melon-db/db-sqlite
db-query.mdcFluent builder + React
db-prisma.mdcPrisma layer
package-roles.mdcPer-package milestones