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

@durable-streams/server

v0.1.6

Published

Node.js reference server implementation for Durable Streams

Readme

@durable-streams/server

Node.js reference server implementation for the Durable Streams protocol.

Installation

npm install @durable-streams/server

Overview

This package provides a reference implementation of the Durable Streams protocol for Node.js. It supports both in-memory and file-backed storage modes, making it suitable for development, testing, and production workloads.

For a standalone binary option, see the Caddy-based server.

Quick Start

import { DurableStreamTestServer } from "@durable-streams/server"

const server = new DurableStreamTestServer({
  port: 4437,
  host: "127.0.0.1",
})

await server.start()
console.log("Server running on http://127.0.0.1:4437")

Storage Modes

In-Memory (Default)

Fast, ephemeral storage for development and testing:

import { DurableStreamTestServer, StreamStore } from "@durable-streams/server"

const store = new StreamStore()
const server = new DurableStreamTestServer({
  port: 4437,
  store,
})

File-Backed

Persistent storage with streams stored as log files and LMDB for metadata:

import {
  DurableStreamTestServer,
  FileBackedStreamStore,
} from "@durable-streams/server"

const store = new FileBackedStreamStore({
  path: "./data/streams",
})
const server = new DurableStreamTestServer({
  port: 4437,
  store,
})

Registry Hooks

Track stream lifecycle events (creation, deletion):

import {
  DurableStreamTestServer,
  createRegistryHooks,
} from "@durable-streams/server"

const server = new DurableStreamTestServer({
  port: 4437,
  hooks: createRegistryHooks({
    registryPath: "__registry__",
  }),
})

The registry maintains a system stream that tracks all stream creates and deletes, useful for building admin UIs or monitoring.

API

DurableStreamTestServer

interface TestServerOptions {
  port?: number
  host?: string
  store?: StreamStore | FileBackedStreamStore
  hooks?: StreamLifecycleHook[]
  cors?: boolean
  cursorOptions?: CursorOptions
}

class DurableStreamTestServer {
  constructor(options?: TestServerOptions)
  start(): Promise<void>
  stop(): Promise<void>
  readonly port: number
  readonly baseUrl: string
}

StreamStore

In-memory stream storage:

class StreamStore {
  create(path: string, contentType: string, options?: CreateOptions): Stream
  get(path: string): Stream | undefined
  delete(path: string): boolean
  append(path: string, data: Uint8Array, seq?: string): void
  read(path: string, offset: string): ReadResult
}

FileBackedStreamStore

File-backed persistent storage (log files for streams, LMDB for metadata) with the same interface as StreamStore.

Exports

export { DurableStreamTestServer } from "./server"
export { StreamStore } from "./store"
export { FileBackedStreamStore } from "./file-store"
export { encodeStreamPath, decodeStreamPath } from "./path-encoding"
export { createRegistryHooks } from "./registry-hook"
export {
  calculateCursor,
  handleCursorCollision,
  generateResponseCursor,
  DEFAULT_CURSOR_EPOCH,
  DEFAULT_CURSOR_INTERVAL_SECONDS,
  type CursorOptions,
} from "./cursor"
export type {
  Stream,
  StreamMessage,
  TestServerOptions,
  PendingLongPoll,
  StreamLifecycleEvent,
  StreamLifecycleHook,
} from "./types"

Testing Your Implementation

Use the conformance test suite to validate protocol compliance:

import { runConformanceTests } from "@durable-streams/server-conformance-tests"

runConformanceTests({
  baseUrl: "http://localhost:4437",
})

License

Apache-2.0