Skip to main content
By the end of this guide you’ll have a running Cloudflare Worker that serves a JSON health-check endpoint and a typed D1 database route — deployed to Cloudflare’s global network. You’ll write the whole thing in TypeScript with full binding type safety from your first line of code.
1

Create a new Worker project

Scaffold a new Cloudflare Workers project using the official create-cloudflare CLI, then move into the project directory.
When prompted, choose “Hello World” Worker and TypeScript. Skip Git initialisation if you prefer.
2

Install Blaze

Add Blaze to your project with your preferred package manager.
3

Write your Worker

Replace the contents of src/index.ts with the following. This example defines an Env type that mirrors your wrangler.toml bindings, creates a typed app, registers two routes, and exports the Cloudflare Workers fetch handler.
src/index.ts
4

Add wrangler.toml bindings

Open wrangler.toml and declare your D1 database binding. Replace your-database-id with the ID from npx wrangler d1 create myapp.
wrangler.toml
The binding value here must match the key you used in your Env type (DB).
5

Run locally

Start the local development server with hot-reload. Wrangler emulates the full Workers runtime including D1, KV, and other bindings.
Visit http://localhost:8787 to see your health-check response, and http://localhost:8787/users/1 to test the D1 route.
6

Deploy

When you’re ready to go live, deploy to Cloudflare’s global network with a single command.
Wrangler prints the deployed URL — your Worker is now live at the edge.
This quickstart covers the essentials to get you moving. For the full API — including sub-routers, middleware composition, error handling, and every req/res method — see the Core Concepts documentation.