Example Projects Using denoland/celld: 16 Ready-to-Run Demos

The celld repository includes 16 production-ready example projects in the examples/ directory, each demonstrating specific Durable Object API capabilities from basic Workers to WebSockets, databases, and Wasm.

Every example is a standalone Wrangler-compatible project that deploys with a single celld deploy . command. Whether you're building stateless edge handlers or complex multi-step workflows, these samples provide copy-paste starting points for the celld runtime.

What Are the celld Example Projects?

The examples/ directory contains curated projects that progressively expose celld's surface area. Each example is a complete, runnable application—not snippets—stored in its own subdirectory with index.js and configuration files.

As implemented in denoland/celld, the examples cover:

  • Core Worker patterns (fetch handlers, routing, bodies)
  • Storage backends (SQLite, D1, KV, R2)
  • Real-time features (WebSocket server/client, alarms)
  • Advanced capabilities (vector search, Wasm, RPC, workflows)

All examples support celld dev for local testing and celld deploy . for production deployment to an S3-compatible bucket.

Stateless Worker Examples

Hello: Minimal Fetch Handler

examples/hello/index.js shows the simplest possible celld Worker:

export default {
  async fetch(request, env) {
    return new Response("Hello from cells! url=" + request.url, { status: 200 });
  },
};

This demonstrates the entry point signature all celld Workers use: an object with a fetch method receiving request and env parameters.

Webapi: Platform APIs in Workers

examples/webapi/index.js exercises standard Web Platform APIs (fetch, Headers, URL) inside the celld runtime, confirming compatibility with browser-standard patterns.

Body: Streaming Request Handling

examples/body/index.js handles streaming request bodies and custom response construction—essential for upload endpoints or proxy services.

Storage and Database Examples

Counter: SQLite-Backed Durable Object

examples/counter/index.js implements the canonical Durable Object pattern: persistent state backed by SQLite with LTX log replication. This shows how celld maintains strong consistency across geographic regions.

KV: Key-Value CRUD Operations

examples/kv/index.js demonstrates the KV binding with full CRUD:

export default {
  async fetch(request, env) {
    const key = new URL(request.url).pathname.slice(1);
    if (!key) return new Response("Use /KEY.", { status: 400 });

    if (request.method === "PUT") {
      await env.VALUES.put(key, request.body);
      return new Response(null, { status: 204 });
    }

    if (request.method === "DELETE") {
      await env.VALUES.delete(key);
      return new Response(null, { status: 204 });
    }

    const value = await env.VALUES.get(key);
    return value === null
      ? new Response("Not found.", { status: 404 })
      : new Response(value);
  },
};

D1: Cloudflare D1 Integration

examples/d1/index.js builds a guestbook application using D1, Celld's SQLite-compatible database service for complex relational queries.

R2: Object Storage Operations

examples/r2/index.js exercises read, write, and delete operations against R2 buckets—celld's S3-compatible object storage.

Specialized Data Examples

examples/vectordb/index.js showcases the vec0 extension for embedding-powered nearest-neighbor search, implemented as a per-Durable-Object index for color lookup scenarios.

Async: Timers and Alarms

examples/async/index.js combines setTimeout-based delays with asynchronous storage operations, demonstrating non-blocking patterns in long-lived Durable Objects.

WebSocket and Real-Time Examples

Wsecho: WebSocket Server with Hibernation

examples/wsecho/index.js implements an echo server that hibernates idle sockets—a celld optimization that frees memory while preserving connection state.

Wsclient: Outbound WebSocket Connections

examples/wsclient/index.js shows a Durable Object acting as a client to external WebSocket servers, enabling bidirectional real-time bridges.

Alarm: Scheduled Tasks

examples/alarm/index.js configures Durable Object alarms for time-based execution without external triggers.

Cron: Periodic Triggers

examples/cron/index.js demonstrates cron-like scheduled execution for recurring background work.

Architecture Pattern Examples

Router: Worker-to-DO Routing

examples/router/index.js implements clean separation between stateless Workers and stateful Durable Objects, with request routing logic that scales horizontally.

RPC: Method-Call Style Communication

examples/rpc/index.js replaces raw HTTP with ergonomic JavaScript RPC, letting callers invoke DO methods as if they were local functions.

Workflow: Multi-Step Durable Processing

examples/workflow/index.js chains multiple durable steps into a single logical job with fault tolerance and exactly-once execution semantics.

Advanced: WebAssembly Integration

Wasm: Rust-Compiled Durable Object

examples/wasm/README.md documents building a Durable Object from Rust-compiled WebAssembly. Unlike other examples, this requires a build step:


# Per the wasm example README

cargo build --target wasm32-wasi --release
celld deploy .

This enables compute-intensive workloads or reuse of existing Rust libraries in the celld environment.

Deploying Any Example

The deployment pattern is identical across all 16 projects:

cd examples/counter  # or any example directory

celld deploy . --bucket s3://my-cells-bucket

For local development without cloud resources:

celld dev

This starts a local celld node serving the example directly.

Key Example Files Reference

File Path Purpose
examples/README.md Master index of all examples with descriptions
examples/hello/index.js Minimal starting point
examples/counter/index.js SQLite DO state pattern
examples/kv/index.js KV binding reference
examples/wsecho/index.js WebSocket hibernation
examples/wsclient/index.js Outbound WebSocket client
examples/router/index.js Worker/DO routing architecture
examples/r2/index.js Object storage patterns
examples/d1/index.js Relational database integration
examples/vectordb/index.js Vector search implementation
examples/rpc/index.js RPC-over-HTTP pattern
examples/workflow/index.js Multi-step durable jobs
examples/wasm/README.md WebAssembly build instructions

Summary

  • 16 complete example projects ship with denoland/celld in the examples/ directory
  • Each example is a deployable Wrangler project using celld deploy . --bucket s3://...
  • Coverage spans stateless Workers, SQLite DOs, databases, WebSockets, vector search, RPC, workflows, and Wasm
  • Local development via celld dev requires no cloud bucket
  • All source files follow consistent patterns that transfer directly to production applications

Frequently Asked Questions

Where are the celld example projects located?

All example projects live in the examples/ directory at the root of the denoland/celld repository. Each subdirectory contains a complete, runnable application with index.js and any required configuration.

Do I need Cloudflare to run celld examples?

No. The examples work with any S3-compatible bucket using celld deploy . --bucket s3://.... For local development, celld dev runs examples without any cloud dependency.

Which example should I start with as a beginner?

Begin with examples/hello/index.js for the simplest Worker pattern, then progress to examples/counter/index.js to understand Durable Object state. The examples/README.md file lists all examples in recommended learning order.

Can I use these examples in production?

Yes. The examples are production-grade patterns extracted from real celld usage. They include proper error handling, hibernation for WebSockets, and SQLite transaction patterns suitable for high-traffic deployments.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →