Skip to content

DX: unify SQLite client import surface or explicitly keep separate node/browser packages #48

Open

Description

@marcus-pousette

Summary

Decide whether TreeCRDT should expose a single SQLite client import surface across Node and browser, or explicitly keep separate packages for the two runtimes.

The underlying client APIs are now much closer than when this issue was opened, but the package/import story is still split between @treecrdt/sqlite-node and @treecrdt/wa-sqlite.

Current state

  • Node uses @treecrdt/sqlite-node.
  • Browser / wa-sqlite uses @treecrdt/wa-sqlite.
  • There is no unified @treecrdt/sqlite meta-package today.
  • The high-level client surfaces are already intentionally aligned more closely than before.

Decision to make

Choose one direction:

Option A: Unified import surface

Create a small meta-package (for example @treecrdt/sqlite) that re-exports the right implementation for each environment.

Possible shapes:

  • one import that resolves differently in Node vs browser via conditional exports
  • explicit subpaths such as @treecrdt/sqlite/node and @treecrdt/sqlite/browser

Option B: Keep separate packages

Keep @treecrdt/sqlite-node and @treecrdt/wa-sqlite as the long-term public entrypoints, and document that decision clearly.

If we choose this, this issue can close after docs are updated.

Work if we choose Option A

  • Pick package name and public surface.
  • Implement the meta-package or subpath exports.
  • Verify bundler behavior so browser builds do not pull Node-only dependencies and Node builds do not pull wa-sqlite browser assets.
  • Verify TypeScript resolution in both environments.
  • Update docs/examples to recommend the unified import when appropriate.

Acceptance criteria

  • The public import story is explicit and documented.
  • Browser builds do not accidentally include Node-only dependencies.
  • Node usage does not require wa-sqlite browser assets.
  • The chosen import surface matches the already-aligned client semantics across runtimes.

Activity

  1. marcus-pousette commented on Apr 22, 2026

    @marcus-pousette
    CollaboratorAuthor

    Rewrite proposal for current scope:

    This issue is still open, but the original wording is now partially stale.

    What changed since opening it:

    • there is still no unified meta-package such as @treecrdt/sqlite
    • the import story is still split between @treecrdt/sqlite-node and @treecrdt/wa-sqlite
    • however, the two runtimes are now much closer at the API level: the Node package already exposes a high-level createTreecrdtClient(...) surface specifically to match the wa-sqlite client shape

    So the remaining question is no longer “make the APIs behave identically” so much as:

    • do we still want one import surface for SQLite-backed TreeCRDT clients?
    • if yes, should that be a true meta-package, or explicit subpaths such as /node and /browser?
    • can we verify bundler behavior so browser builds do not accidentally pull Node-only deps and vice versa?

    Suggested rewrite:

    • keep the issue open
    • narrow it to the import/package DX decision plus bundler verification
    • remove the implication that the node/browser client APIs are still fundamentally divergent
  2. changed the title [-]DX: Add unified SQLite driver package (conditional exports node vs wa-sqlite) + verify tree-shaking/bundle size[/-] [+]DX: unify SQLite client import surface or explicitly keep separate node/browser packages[/+] on Apr 22, 2026
  3. marcus-pousette commented on May 5, 2026

    @marcus-pousette
    CollaboratorAuthor

    Implementation is in #140. It chooses the explicit-package direction (@treecrdt/sqlite-node for Node and @treecrdt/wa-sqlite for browser) instead of adding a @treecrdt/sqlite meta-package, and documents that import surface in a central SQLite clients guide plus package READMEs. The PR uses Fixes #48, so this issue should close automatically once #140 is reviewed and merged.

  4. added
    documentation
    area:sqlite
    area:api
    on Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiarea:sqlitedocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions