镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

OpenWorkers

OpenWorkers is an open-source serverless platform for running JavaScript, TypeScript and Rust (WebAssembly) workers, with built-in bindings for databases, key-value storage, and object storage.

Repositories

Core Runtime

Repository Description Language
openworkers-runner Serves HTTP, runs workers and crons, stores the logs Rust
openworkers-task-executor Standalone executor (fetch only) Rust
openworkers-core Shared types and traits Rust

Runtimes

Repository Description Language
openworkers-runtime-v8 V8 JavaScript runtime (production) Rust
openworkers-runtime-wasm WebAssembly components on wasmtime (wasi:http) Rust
openworkers-runtime-jsc JavaScriptCore runtime Rust
openworkers-runtime-quickjs QuickJS runtime Rust
openworkers-runtime-boa Boa runtime Rust
openworkers-runtime-nova Nova runtime (experimental) Rust
openworkers-conformance Cross-engine conformance suite, one recorded oracle Rust

Worker SDKs & Adapters

Repository Description Language
openworkers-worker Rust guest SDK, API-compatible with worker 0.8 Rust
workers-types TypeScript types for the worker runtime TypeScript
adapter-sveltekit Deploy SvelteKit apps as workers (SSR) TypeScript
adapter-static Deploy static sites as workers TypeScript

V8 Libraries

Repository Description Language
rusty-v8 V8 bindings and prebuilt binaries Rust
serde-v8 Serde integration for V8 values Rust
glue-v8 Rust to V8 binding macros Rust

Platform Services

Repository Description Language
openworkers-api Dashboard and REST API (SvelteKit) TypeScript/Bun
openworkers-cli Admin/infra tool Rust
postgate Multi-tenant HTTP proxy for PostgreSQL Rust
openworkers-infra Docker Compose deployment -

Archived

Repository Replaced by
openworkers-scheduler openworkers-runner v1.15.0 (crons)
openworkers-logs openworkers-runner v1.15.0 (log storage, SSE)
openworkers-dash openworkers-api (dashboard UI)
openworkers-runtime-deno openworkers-runtime-v8
openworkers-scheduler-js openworkers-runner v1.15.0 (crons)

Frontend

Repository Description Language
openworkers-website Documentation & website SvelteKit

Standalone V8 Runtime

Don't need the full platform? Use openworkers-runtime-v8 as a standalone JavaScript runtime in your Rust application:

use openworkers_core::{Event, HttpRequest, Script};
use openworkers_runtime_v8::Worker;

#[tokio::main]
async fn main() {
    let code = r#"
        addEventListener('fetch', (event) => {
            event.respondWith(new Response('Hello from V8!'));
        });
    "#;

    let script = Script::new(code);
    let mut worker = Worker::new(script, None).await.unwrap();

    let (event, rx) = Event::fetch(HttpRequest::get("http://localhost/"));
    worker.exec(event).await.unwrap();

    let response = rx.await.unwrap();
    println!("Status: {}", response.status);
}

Add to your Cargo.toml:

[dependencies]
openworkers-runtime-v8 = { git = "https://github.com/openworkers/openworkers-runtime-v8", tag = "v0.15.0" }
openworkers-core = { git = "https://github.com/openworkers/openworkers-core", tag = "v0.15.0" }
tokio = { version = "1", features = ["full"] }

See openworkers-runtime-v8 for full documentation. See openworkers-task-executor for a complete implementation example.

Architecture

        clients (HTTP, HTTPS)
                 |
     +-----------+-----------+
     |        runner         |
     |                       |
     |  every worker, api    |
     |  included; crons;     |
     |  console logs         |
     +-----------+-----------+
                 |
     +-----------+-----------+
     |      PostgreSQL       |
     +-----------------------+

One runner per platform database. The database holds the workers, the cron schedules and the console logs.

The dashboard and the API are one worker, openworkers-api, on the platform itself (dogfooding); postgate is then optional, since the workerized api reaches the database through its runtime binding.

Features

Worker Runtime

  • JavaScript/TypeScript execution via V8
  • Rust workers as native WebAssembly components (wasm32-wasip2), with a workers-rs-compatible SDK
  • Web-standard APIs: fetch(), Request, Response, Headers, crypto, TextEncoder/Decoder
  • Streaming support: ReadableStream, WritableStream
  • Console logging with structured output

Bindings

Workers can access platform resources through bindings:

export default {
  async fetch(request, env) {
    // Key-Value Storage (native JSON support)
    await env.KV.put("session", { userId: 123 }, { expiresIn: 3600 });
    const session = await env.KV.get("session");

    // Database (PostgreSQL)
    const users = await env.DB.query("SELECT * FROM users WHERE id = $1", [
      session.userId,
    ]);

    // Static Assets (S3/R2)
    const asset = await env.ASSETS.fetch("/images/logo.png");

    return new Response("Hello World");
  },
};

Database

  • Multi-tenant isolation via PostgreSQL schemas
  • SQL validation blocks dangerous operations (system tables, schema escapes)
  • BYOD support: Bring Your Own Database with direct connection strings

Scheduled Events (Cron)

export default {
  async scheduled(event, env) {
    // Runs on schedule
    console.log(`Cron triggered at ${event.scheduledTime}`);
  },
};

Security

  • V8 Isolates: Each worker runs in an isolated V8 context
  • No credential exposure: Workers only see binding names, never secrets
  • SQL validation: Queries are parsed and validated before execution
  • Schema isolation: Multi-tenant databases use SET search_path for isolation
  • Path sanitization: Object storage paths are sanitized to prevent traversal attacks

Getting Started

Prerequisites

  • Rust 1.85+
  • Bun 1.0+
  • PostgreSQL 15+

Quick Start

# Clone repositories
git clone https://github.com/openworkers/openworkers-runner.git
git clone https://github.com/openworkers/openworkers-api.git

# Start the runner
cd openworkers-runner && cargo run --features v8

# Start the API dev loop (in another terminal)
cd openworkers-api && bun install && bun run dev

For a full self-hosted platform, follow openworkers-infra's GETTING_STARTED.

Design Principles

  1. Database is the single source of truth: All components read from/write to PostgreSQL. No local state.

  2. API is userland: The API is designed to run as a worker on the platform itself (dogfooding).

  3. CLI is the infra tool: All infrastructure operations (migrations, setup) go through the CLI.

  4. Security by design: Credentials never reach the JavaScript sandbox.

  5. Cloudflare Workers compatible: API compatibility with Cloudflare Workers where possible.

License

MIT, across the organization.

Contributing

Contributions are welcome - open an issue or a pull request on the relevant repository.


Built with Rust, TypeScript, Claude Code, and a lot of love.

Pinned Loading

  1. openworkers-runtime-v8 openworkers-runtime-v8 Public

    Rust 91 5

  2. openworkers-runner openworkers-runner Public

    Rust 234 5

  3. openworkers-core openworkers-core Public

    Rust 31 1

  4. postgate postgate Public

    Multi-tenant HTTP proxy for PostgreSQL with SQL validation

    Rust 28 1

Repositories

Showing 10 of 35 repositories

Sponsors

  • @eocx

Top languages

Loading…

Most used topics

Loading…