A modular framework for building Cloudflare Worker–based applications.
base lets you build a Cloudflare Worker as a set of declarative modules. You define services, GraphQL resolvers, queue processors, scheduled tasks, RPC services, and ORM entities with decorators; the framework wires them together through a dependency-injection container and dispatches platform events — HTTP requests, queue messages, cron triggers, WebSocket events — to your code. Through a platform-delegate abstraction, the same app model also runs on Node (minus Cloudflare-specific bindings), which is how the test suite runs.
You write a class, decorate it, register it in a module, and add the module to a worker:
decorated class module worker
@OrmTable / @HttpService / BaseModule.create({ BaseSettings.modules: [
@GqlResolver / @RpcService / ──► settings: { ──► AccountModule,
@WorkerQueueProcessor / orm.entities, BillingModule, ...
@ScheduledExecutable / graphql.resolvers, ]
@EventBusListener router.services,
rpc.procedures, ... } })
At runtime, BaseWorker.create(settings) exports the standard Cloudflare Worker shape (fetch / queue / scheduled). The first event boots a DI container, flattens your modules into an application manifest, validates that every registered class carries its decorator, and binds your routes. Each subsequent event runs in a fresh scoped child container that resolves the handler, runs middleware, validates input, and returns a Response.
- Declarative modules — compose an app from decorated services, resolvers, processors, and entities.
- Dependency injection — a scope hierarchy (
@global → @worker → {@request | @queue | @scheduled | @websocket}) with@Singleton/@WorkerScoped/@ContainerScopedlifetimes. - GraphQL, RPC, HTTP, queues, scheduled tasks, WebSockets — first-class dispatchers for each, with one consistent validation path.
- ORM — decorator-defined entities backed by Drizzle, with CLI-driven migrations.
- Runs on Cloudflare or Node — a platform delegate makes the identical app model target both.
- A CLI (
base) to scaffold, build, run, test, and deploy workers.
This is an npm workspaces monorepo.
| Package | Description |
|---|---|
@system-inc/base-foundation |
Core framework: DI, modules, routing, ORM, GraphQL, queue, scheduled, validation |
@system-inc/base-cli |
The base CLI for building, running, and deploying workers |
@system-inc/base-client |
RPC and HTTP-error client for browsers and workers |
@system-inc/base-common |
Pure, environment-agnostic utility helpers |
@system-inc/base-lint |
Shared ESLint config and custom rules |
The examples/ workspace holds runnable example workers that double as integration-test fixtures.
Requires Node.js >= 22.12. Local development needs no Cloudflare account; deploying does.
Scaffold a workspace with a starter worker and run it:
npx @system-inc/base-cli workspace create my-app cd my-app git init && npm run prepare # wires up the pre-commit format hook npm run base -- develop -w app # local dev server (wrangler dev)
A worker is a directory under workers/ containing a settings.ts that exports a BaseSettings — the single source of truth shared by the CLI and the runtime. The starter worker comes with a working HTTP service to build from:
@Injectable() @HttpService() export class HelloWorldService { constructor( @Inject(GreetingService) private readonly greetingService: GreetingService, ) {} @HttpRoute('GET', '/') helloWorld(): Response { return new Response(this.greetingService.greet()); } }
Grow the app by adding modules to the worker's BaseSettings.modules, and deploy when ready:
npm run base -- deploy -w app --environment Production
Adding Base to an existing project instead? Install the packages directly — every module is a per-file subpath import, no barrel:
npm install @system-inc/base-foundation @system-inc/base-common @system-inc/base-client npm install -D @system-inc/base-cli @system-inc/base-lint
- Getting started — a six-part tutorial from scaffold to deployed worker with a database, GraphQL, and RPC.
- Guides — ~50 focused guides covering modules, the ORM, GraphQL, the CLI, security, and multi-worker composition; start at the documentation index.
- CLI command reference — the full command set (
develop,test,deploy,bundle,orm,graphql,workspace, ...). examples/— complete, runnable workers that double as integration-test fixtures.
Contributions are welcome! Please read the Contributing Guide — it covers repo setup, the development workflow, running the example workers, and the conventions PRs are held to — along with our Code of Conduct. To report a security issue, see the Security Policy.
Licensed under the Apache License 2.0. Copyright © 2026 System, Inc.