Installation
Scaffold a Base workspace, start the development server, and see your worker respond.
By the end of this tutorial you'll have a working Base project on your machine, a development server running, and a worker answering requests at http://localhost:3000.
Base is a modular framework for building Cloudflare Worker–based applications. You define services, resolvers, and entities with decorators; the framework wires them together through dependency injection and dispatches platform events (HTTP requests, queue messages, cron triggers) to your code.
Prerequisites
- Node.js 22 or newer. Check with
node --version. If you use nvm,nvm install 22. - git (optional, recommended). With git initialized, the scaffold wires up a pre-commit formatting hook, and deploys ship exactly what's committed.
- No Cloudflare account needed. Local development runs entirely on your machine; you only need an account when you deploy.
Create a workspace
One command scaffolds a complete workspace with a starter worker and installs its dependencies:
Then finish the setup it prints. If you're using git (recommended):
What you got
A Base workspace holds one or more workers. A worker is simply a directory with a settings.ts — the single source of truth shared by the CLI and the runtime. The scaffold gives you one worker named app:
We'll walk through the interesting files in the next tutorial. For now, let's run it.
Start the development server
From the workspace root:
This reads workers/app/settings.ts, resolves your configuration, and starts wrangler's local dev server on the port your settings declare: 3000 for the scaffolded worker.
The base CLI is the front door for everything — scaffolding, developing, testing, database migrations, and deploys. npx base <command> runs the copy installed in your workspace's node_modules; the scaffolded npm run base -- <command> script is equivalent, so use whichever you prefer.
Say hello
Open http://localhost:3000 in your browser, or:
The starter worker also has a parameterized route:
What just happened
wrangler dev is running your worker in a local Cloudflare Workers runtime — the same engine your code will run on in production. Base booted from your settings.ts, discovered the HelloWorldService class by its @HttpService decorator, and bound its @HttpRoute methods as live routes. Edit a file and the server reloads automatically.
Next: Your First Worker — read the code you just ran, then build a JSON API of your own.