Skip to main content

Cloudflare Workers

Scaffold a Cloudflare Workers workspace with TypeScript.

You can run this directly from an empty location; scaffold starter base is not a prerequisite. Nova creates the monorepo root and the first Workers workspace together.

Why Use This Command?

  • Installs Wrangler with Cloudflare Workers types and TypeScript so you can run wrangler dev against the edge runtime right away.
  • Auto-detects monorepo or workspace mode so the same command works whether you're starting fresh or adding to an existing project.
  • Provides dev, check, build, deploy, and clean script groups whose top-level commands delegate to adjacent name:* steps through Nova's script runner; the child steps run Wrangler and TypeScript directly.

Requirements

  • Node.js runtime — Use any Node.js LTS release.
  • Empty directory (monorepo mode) or monorepo root (workspace mode) — The command auto-detects which mode to use.

Usage

Options

FlagDescription
-d, --dry-runRun without writing any files.
--name <name>Project slug when creating a new monorepo; omit at an existing root.
--non-interactiveRequire every answer as a flag and do not open prompts.
--workspace-name <name>Workspace directory name.
--output <dir>Output directory.

Output Structure

text
{project-slug}/
├── package.json
├── nova.config.json
├── turbo.json
├── apps/
│   └── {workspace-name}/
│       ├── package.json
│       ├── wrangler.toml
│       ├── tsconfig.json
│       └── src/
│           └── index.ts
└── packages/

Config Fields

FieldDescription
project.name.slugRequired in workspace mode and used to derive the package and registered workspace name. In monorepo mode, written from --name or the project-name answer.
project.name.titleWritten in monorepo mode, title-cased from the project slug.
workspacesA workspaces entry is written for the new workspace: name ({projectSlug}-app-{workspaceName}), role (app), and policy (freezable).

How It Works

Interactive Wizard

When run without flags, the command walks you through an interactive wizard:

Monorepo mode (no package.json found):

  1. Project name — Enter a slug for your monorepo (e.g. my-worker).
  2. Workspace name — Enter a slug for the workspace directory (default: workers).
  3. Where should the project be created? — Choose between creating a new directory or building in the current working directory.
  4. Output directory — If creating a new directory, confirm the path (default: ./{project-name}).
  5. Run generators — Optionally run project-level generators (.editorconfig, .gitignore, LICENSE, etc.).

Workspace mode (package.json with workspaces found):

  1. Workspace name — Enter a slug for the workspace directory (default: workers).
  2. Output directory — Confirm the workspace path (default: ./apps/{workspace-name}).

Nova reads the project slug from the root nova.config.json; it does not ask you to rename the project or package.

Non-Interactive Mode

Agents and automation should add --non-interactive. A new monorepo needs --name, --workspace-name, and --output. An existing monorepo needs only --workspace-name and --output; omit --name because Nova reads the root project slug.

Naming, Registration, and Safety

For project slug my-worker and workspace slug worker, Nova uses my-worker-app-worker for both the package name and Wrangler service name, and writes the same identity to nova.config.json. If the root workspaces globs do not include the selected output, Nova adds that exact relative path to the root package.json.

Before writing, Nova requires a readable root package.json and nova.config.json, keeps the output inside the monorepo, rejects duplicate paths and names, and lists any template files it would overwrite. --dry-run performs these checks without changing the project.

Next Steps

After scaffolding, consider running generators to add essential project files like .editorconfig, .gitignore, LICENSE, and README.md.