Prisma Streams is a Bun + TypeScript implementation of the Durable Streams HTTP protocol.
Use index.md for the full documentation map.
Every stream has a profile.
- If no profile is declared when the stream is created, it is treated as
generic. evlogis the built-in request-log profile for canonical wide events, redaction,requestId/traceIdrouting-key defaults, and automatic default schema/search/rollup installation.genericmeans a plain durable stream with optional user-managed schema validation.metricsis the built-in metrics profile for canonical interval summaries, default search/rollups, and object-store-native metrics companions.state-protocolis the built-in live/touch profile for JSON State Protocol streams.- Profiles define stream semantics; schemas define payload shape.
See stream-profiles.md.
This repository currently contains two server modes:
fullmode: a self-hosted server with SQLite WAL storage, segmenting, upload, and index maintenancelocalmode: an embedded single-SQLite server intended for trusted local development workflows, especiallynpx prisma dev
Full mode today has two different durability points:
- append ACK means the write is durable in local SQLite
- object-store durability happens only after segment upload plus manifest publication
--bootstrap-from-r2 rebuilds published stream history and metadata from
object storage. It does not restore transient local SQLite state
such as the unuploaded WAL tail, producer dedupe state, or runtime live/template
state.
A stream becomes recoverable from object storage after its first manifest is published.
Not implemented today:
- an object-store-acked mode that would only ACK after persistence to R2
- a cluster quorum mode that would only ACK after a storage quorum accepts the write
- The publishable npm surfaces are intentionally split:
@prisma/streams-localexportsstartLocalDurableStreamsServerand its server types@prisma/streams-local/internal/daemonexists for Prisma CLI integration and is intentionally internal@prisma/streams-serveris the Bun-only full server package, CLI, and package Compute entrypoint
See conformance.md for current compatibility status, verification commands, and known gaps.
Full server startup requires an explicit auth mode.
- Use
--auth-strategy api-keywithAPI_KEYfor built-in authentication on every request. - Use
--no-authonly behind a trusted reverse proxy, API gateway, VPN boundary, or other authenticated perimeter. - Treat the local development server as a loopback-only tool for trusted local workflows.
See security.md and auth.md.
- Bun
>=1.3.6for the full self-hosted server and repository workflows - Bun
>=1.2.0or Node.js>=22for the published@prisma/streams-localpackage
bun install
# Full server (self-hosted pipeline)
bun run src/server.ts --object-store local --no-auth
# Local development server
bun run src/local/cli.ts start --name default --port 8080
# Status / stop / reset
bun run src/local/cli.ts status --name default
bun run src/local/cli.ts stop --name default
bun run src/local/cli.ts reset --name defaultNotes:
- Full server startup requires
--object-store local|r2and exactly one auth mode:--no-author--auth-strategy api-key. - Prisma Compute deployments from npm should follow the package-based flow in the top-level README.md.
- Repository Compute bundle deployments can use
src/compute/entry.ts, which injects--object-store r2for the server entrypoint and--auto-tunewhenDS_MEMORY_LIMIT_MBis set. Compute deployments still need an explicit auth mode. - If deploying from this repository with a prebuilt artifact, use
bun run build:compute-bundleand deploy that artifact with--skip-buildso worker-thread entrypoints such assegmenter_worker.tsandprocessor_worker.tsare included. - Full mode binds to
127.0.0.1by default. SetDS_HOST=0.0.0.0if you intentionally want a non-loopback bind inside a trusted network boundary. - Local mode is designed for development and Prisma CLI integration, not hostile-network deployment.
- The default local data root remains under
envPaths("prisma-dev").data/durable-streams/for compatibility with the Prisma development workflow.
The supported package import for local development integration is:
import { startLocalDurableStreamsServer } from "@prisma/streams-local";
const server = await startLocalDurableStreamsServer({
name: "default",
hostname: "127.0.0.1",
port: 0,
});
console.log(server.exports.http.url);
console.log(server.exports.sqlite.path);
await server.close();The published @prisma/streams-local surface is built to run on Bun >=1.2.0
and Node >=22. The full self-hosted server remains Bun-only.
The local embedded runtime always applies the built-in 1024 MB auto-tune
preset for cache and concurrency budgets. It does not enable the process-level
memory pressure guard, because embedded callers may share a larger host
Node/Bun process whose RSS is not owned by Streams.
The package smoke tests cover the local Live path under both host runtimes:
bun run test:node-local-packagebun run test:bun-local-package
@prisma/streams-local/internal/daemon is exported for Prisma CLI integration, but it is intentionally internal and does not carry the same compatibility guarantee as @prisma/streams-local.
More detail is in local-dev.md.
The full server is started via:
bun run src/server.ts --object-store local --no-authPublished CLI package:
bunx --package @prisma/streams-server prisma-streams-server --object-store local --no-authBind control:
DS_HOST=127.0.0.1 PORT=8080 bun run src/server.ts --object-store local --no-authAPI key auth:
API_KEY=replace-with-at-least-10-characters \
bun run src/server.ts --object-store local --auth-strategy api-keyOptional flags:
--stats--hist--bootstrap-from-r2--auto-tune[=MB]
Local MockR2:
bun run src/server.ts --object-store local --no-authReal R2:
DURABLE_STREAMS_R2_BUCKET=your-bucket \
DURABLE_STREAMS_R2_ACCOUNT_ID=your-account-id \
DURABLE_STREAMS_R2_ACCESS_KEY_ID=your-access-key \
DURABLE_STREAMS_R2_SECRET_ACCESS_KEY=your-secret \
API_KEY=replace-with-at-least-10-characters \
bun run src/server.ts --object-store r2 --auth-strategy api-keyPrisma Compute deployment from the published npm package is documented in the top-level README.md.
Repository prebuild for Prisma Compute deployments:
bun run build:compute-bundle
PRISMA_API_TOKEN=... \
bunx @prisma/compute-cli compute deploy \
--service your-service-id \
--path .compute-build/bundle \
--entrypoint compute/entry.js \
--skip-buildsrc/compute/entry.ts has the same Compute argv behavior as the package
Compute entrypoint, but is intended for repository-built artifacts.
Compute demo deployment with Studio and the evlog generator:
bun run build:compute-demo-bundle
PRISMA_API_TOKEN=... \
bunx @prisma/compute-cli deploy \
--service your-service-id \
--skip-build \
--path .compute-demo-build/bundle \
--entrypoint compute/demo_entry.jsThat artifact starts the normal Streams server plus:
/studiofor the streams-only Prisma Studio UI/generatefor a bulk evlog ingest page with a stream-name field defaulting todemo-appand1k,10k, and100kactions
See compute-demo.md.
Compute verification demo:
bun run demo:compute-verify --url https://your-service.cdg.prisma.buildThe Compute verification workload uses large mixed-entropy binary rows so
segmenting still cuts by DS_SEGMENT_MAX_BYTES under the compression-aware
seal heuristic. That avoids needing a tiny DS_SEGMENT_TARGET_ROWS override
just to force cuts for an overly compressible demo payload.
bun run typecheck
bun run check:result-policy
bun test
bun run test:conformance:local
bun run test:conformance- index.md: full documentation index
- local-dev.md: local server behavior and Prisma CLI integration model
- releasing.md: build and release process for
@prisma/streams-localand@prisma/streams-server - prisma-dev-pglite-live.md: integrating local Prisma Postgres (
prisma dev) with Prisma Streams live queries - conformance.md: test commands and current upstream suite status
- auth.md: current authentication and authorization constraints
- architecture.md: system architecture
- stream-profiles.md: stream/profile/schema model
- profile-generic.md:
genericprofile reference - profile-metrics.md:
metricsprofile reference - profile-state-protocol.md:
state-protocolprofile reference - profile-evlog.md:
evlogprofile reference - indexing-architecture.md: current exact +
.col+.fts+.agg+.mblkindexing model - aggregation-rollups.md: schema-owned rollup and
_aggregatemodel - sqlite-schema.md: SQLite schema and invariants
- schemas.md: schema registry and lens behavior
- live.md: end-to-end live / touch integration guide and API semantics
- live-query-invalidation.md: SQL query-family matrix for exact vs coarse live invalidation
- metrics.md: shipped metrics profile and metrics query model
- gharchive-demo.md: self-contained GH Archive demo for ingestion, search, and aggregates
- recovery-integrity-runbook.md: recovery and operational runbook
This repository now includes: