Skip to content
gingerhendrixPublic

Repository files navigation

Streamsy

An Effect implementation of the Durable Streams protocol: typed stream refs, checkpointed projections, SQLite storage, and hosts for Bun and Cloudflare.

Documentation: streamsy.dev

Packages

Package What it gives you
@streamsy/core Protocol, typed refs, stream services, memory Layer, HTTP app, remote client
@streamsy/storage SQLite storage for Bun and Durable Objects
@streamsy/projection Checkpointed projections with named stream, rows and value outputs
@streamsy/serve HttpRouter routes, Bun and Cloudflare hosts, action delivery

All four packages share one version. effect 4 is a peer dependency. See docs/releasing.md for the release process.

Quick start

bun add @streamsy/core effect
import { Effect, Schema, Stream } from "effect";
import { MemoryStorage, Streamsy } from "@streamsy/core";

class Events extends Streamsy.json<Events>()("Readme/Events", "events", {
  params: {},
  schema: Schema.String,
}) {}
const program = Effect.gen(function* () {
  const events = yield* Events;
  yield* events.create({});
  yield* events.append({}, ["hello"]);
  return yield* events.read({}).pipe(Stream.runCollect);
});
await Effect.runPromise(program.pipe(Effect.provide(MemoryStorage.layer(Streamsy.group(Events)))));

Read the tutorial for the path from a typed stream address to a served projection.

Examples

  • Memory server: the smallest Bun host, backed by one process-local memory store and exercised with curl.
  • Issue tracker: a complete application with conditional writes, SQLite persistence, and live browser collections.
  • Hacker News newest: a Bun server, a projection, and a browser client on the official Durable Streams client.
  • Bugsy: an issue tracker with five workspace inputs in two checkpointed SQLite projections, with output streams and HTTP routes.
  • Hex board: a whole game board kept as fold state in the checkpoint transaction, with SQLite restart tests.
  • Fold agent: an agent loop whose durable log lives in Streamsy and fences competing writers by offset.

Development

bun install
bun run typecheck
bun run lint
bun run test:unit
bun run test:conformance

License

MIT

Releases

Packages

Contributors

Languages