Skip to content

OpenWorkers

OpenWorkers is an open-source serverless platform for running JavaScript/TypeScript workers. Deploy functions that scale automatically (soon™), with built-in bindings for databases, key-value storage, and object storage.

Repositories

Core Runtime

RepositoryDescriptionLanguage
openworkers-runnerCore worker execution engineRust
openworkers-task-executorStandalone executor (fetch only)Rust
openworkers-runtime-v8V8 JavaScript runtimeRust
openworkers-coreShared types and traitsRust

V8 Libraries

RepositoryDescriptionLanguage
rusty-v8V8 bindings (fork with Locker support)Rust
serde-v8Serde integration for V8 valuesRust
glue-v8Rust to V8 binding macrosRust

Platform Services

RepositoryDescriptionLanguage
openworkers-apiUser-facing REST APITypeScript/Bun
openworkers-schedulerCron job schedulerRust
openworkers-logsLog ingestion (NATS) + SSE streamingRust
openworkers-cliAdmin/infra toolRust
postgateMulti-tenant HTTP proxy for PostgreSQLRust

Frontend

RepositoryDescriptionLanguage
openworkers-dashUser dashboardAngular
openworkers-websiteDocumentation & websiteSvelteKit

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]asyncfnmain(){let code = r#" addEventListener('fetch', (event) => { event.respondWith(new Response('Hello from V8!')); }); "#;let script = Script::new(code);letmut 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 = "0.8"openworkers-core = "0.8"tokio = { version = "1", features = ["full"] }

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

Architecture

 ┌─────────────────┐
│ nginx (proxy) │
└────────┬────────┘
│
┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┬╌╌╌╌╌╌╌─┴──┬───────────────┐
╎ ╎ │ │
╎ ╎ │ sse/ws │ http
┌╌╌╌╌╌╌╌╌┸╌╌╌╌╌╌╌┐ ┌╌╌╌┸╌╌╌┐ ┌────┸────┐ ┌─────┸───────┐
╎ dashboard ╎ ╎ api ╎ │ logs * │ │ runner * │
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘ └╌╌╌┬╌╌╌┘ └────┰────┘ └─────┰───────┘
╎ │ │
╎ │ │
┌╌╌╌╌╌╌╌╌┸╌╌╌╌╌╌╌╌┐ │ ┌────────┸────────┐
╎ postgate * ╎ └──────┥ nats │
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘ └────────┰────────┘
│
│
┌─────────────────┐ ┌──────┴───────┐
* ─────┥ PostgreSQL │ │ scheduler * │
└─────────────────┘ └──────────────┘

Single database. Components marked with * connect to PostgreSQL.

Note that dashboard and api can now be run directly as workers (postgate is in that case optional too as workerized api has runtime bindings to database).

Services logs and scheduler are not required for the core runtime but provide additional functionality (log streaming and cron jobs).

Features

Worker Runtime

  • JavaScript/TypeScript execution via V8
  • 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:

exportdefault{asyncfetch(request,env){// Key-Value Storage (native JSON support)awaitenv.KV.put("session",{userId: 123},{expiresIn: 3600});constsession=awaitenv.KV.get("session");// Database (PostgreSQL)constusers=awaitenv.DB.query("SELECT * FROM users WHERE id = $1",[session.userId,]);// Static Assets (S3/R2)constasset=awaitenv.ASSETS.fetch("/images/logo.png");returnnewResponse("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)

exportdefault{asyncscheduled(event,env){// Runs on scheduleconsole.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.75+
  • Bun 1.0+
  • PostgreSQL 15+
  • NATS Server

Quick Start

# Clone repositories
git clone https://github.com/openworkers/openworkers-runner.git
git clone https://github.com/openworkers/openworkers-api.git
# Start the runnercd openworkers-runner && cargo run
# Start the API (in another terminal)cd openworkers-api && bun install && bun run dev

See individual repository READMEs for detailed setup instructions.

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 License - see LICENSE for details.

Contributing

Contributions are welcome! Please read our Contributing Guide before submitting a PR.


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

Pinned Loading

  1. openworkers-runtime-v8openworkers-runtime-v8Public

    Rust 85 5

  2. openworkers-runneropenworkers-runnerPublic

    Rust 220 4

  3. openworkers-coreopenworkers-corePublic

    Rust 27 1

  4. postgatepostgatePublic

    Multi-tenant HTTP proxy for PostgreSQL with SQL validation

    Rust 25 1

Repositories

Showing 10 of 31 repositories

Sponsors

  • @eocx

Top languages

Loading…

Most used topics

Loading…