Skip to content

Project init

Create the smallest Layeron project that can compile, run locally, and produce Cloudflare Worker runtime types.

Terminal window
layer init [directory] [options]

layer init writes these files in the target directory:

  • layeron.config.ts
  • src/app.ts
  • tsconfig.json
  • worker-configuration.d.ts

The command uses Wrangler to generate worker-configuration.d.ts. Layeron removes its temporary Wrangler config after generation. Successful init leaves no new .wrangler directory in the project.

OptionValueNotes
--dir<path>Alias for --directory.
--directory<path>Initialization directory.
--name<slug>Alias for --project-name.
--project-name<slug>Project slug.
-h, --helpShow help.

The project name must be a slug made from letters, numbers, hyphens, or underscores. Layeron refuses to overwrite generated project files.

Terminal window
layer init demo-api --name demo-api

If layer init reports that a file already exists, choose an empty directory or move the listed file before running the command again.