Init

Scaffold a new Cluster project with ccp init.

Init

ccp init creates a new project with everything you need to develop and deploy a function.

Usage

ccp init my-app

ccp init <name> creates ./<name>/, scaffolds the chosen template, and runs bun i (or npm i if Bun isn't installed) to install dependencies. The target directory must not already exist.

In a TTY, omitting <name> prompts you for one. In headless mode (CCP_HEADLESS=1 or when stdout isn't a TTY), the positional argument is required.

ccp init errors if you're already inside a Cluster project — it walks up to $HOME looking for a .cluster/config.json and stops you before nesting a project inside another.

Templates

You'll be prompted to choose a template:

TemplateDescription
blankMinimal Request → Response handler
reactReact single-page app (Vite)
staticStatic site with a public/ directory
apiJSON API with route matching

You can also pass --template directly:

ccp init my-app --template blank
ccp init my-app --template react
ccp init my-app --template static
ccp init my-app --template api

Generated Files

FilePurpose
index.tsYour handler function
package.jsonScripts for dev and deploy
tsconfig.jsonTypeScript config (ESNext, strict)
.cluster/config.jsonLinks to your remote function and organization
CLUSTER.mdQuick reference for commands and available APIs
.gitignoreIgnores .cluster/, node_modules/, dist/, .env

The static template also generates:

FilePurpose
public/index.htmlStarter HTML page
globals.d.tsTypeScript types for the __pages global

Linking

If you're logged in, ccp init will offer to create a function and link it to your project. This writes the function_id and organization_id to .cluster/config.json so that ccp deploy works without prompting.

Skipping Prompts

-y (or --yes) accepts all defaults — uses the blank template, skips linking, and still runs the dependency install:

ccp init my-app -y

Combine with --no-install to also skip bun i / npm i:

ccp init my-app -y --no-install

If you skip linking during init, you can always link later:

ccp link

For scripted and CI use, see Headless Mode.

Config File

The .cluster/config.json file ties your local project to a remote function:

{
  "function_id": "abc-123",
  "organization_id": "org-456",
  "index": "index.ts",
  "client": null,
  "assets": null
}
FieldDescription
function_idID of the remote function (set by link or first deploy)
organization_idID of the owning organization
indexEntry point file
clientClient-side script path (optional)
assetsPublic directory for static assets (e.g., "public")

On this page