Cloudflare Docs
Pages
Edit this page on GitHub
Set theme to dark (⇧+D)

C3 (create-cloudflare CLI)

C3 (create-cloudflare-cli) is a command-line tool designed to help you set up and deploy new applications to Cloudflare. In addition to speed, it leverages officially developed templates for Workers and framework-specific setup guides to ensure each new application that you set up follows Cloudflare and any third-party best practices for deployment on the Cloudflare network.

​​ Create a new application

To get started, open a terminal window and run:

$ npm create cloudflare@latest
$ yarn create cloudflare

Running create cloudflare@latest will prompt you to install the create-cloudflare package, and lead you through a setup wizard. After you have entered the setup wizard, you will be asked which type of application you would like to create.

The list of applications includes a variety of Workers templates as well as an option to select a web framework to create a website or web application.

​​ Web frameworks

If you choose to create a new website or application using a web framework, C3 will prompt you to choose one of the following supported frameworks:

  • Analog
  • Angular
  • Astro
  • Docusaurus
  • Gatsby
  • Hono
  • Next
  • Nuxt
  • Qwik
  • React
  • Remix
  • Solid
  • Svelte
  • Vue

Select a framework and you will be prompted to install its create package which will lead you through the framework’s own setup wizard.

​​ Deploy

Once your project has been configured, you will be asked if you would like to deploy the project to Cloudflare. This is optional.

If you choose not to deploy, the project will be created for you locally, and C3 will display some helpful links for further development. Go to the newly created project folder to begin development.

If you choose to deploy, you will be asked to authenticate (if not logged in already), and your project will be deployed immediately. C3 will display your project’s URL and some helpful links.

​​ CLI Arguments

C3 collects any required input through a series of interactive prompts. You may also specify your choices via command line arguments, which will skip these prompts. To use C3 in a non-interactive context such as CI, specify all required arguments via the command line.

This is the full format of a C3 invocation alongside the possible CLI arguments:

$ npm create cloudflare@latest [--] [<DIRECTORY>] [OPTIONS] [-- <NESTED ARGS...>]
$ yarn create cloudflare [--] [<DIRECTORY>] [OPTIONS] [-- <NESTED ARGS...>]
$ pnpm create cloudflare@latest [--] [<DIRECTORY>] [OPTIONS] [-- <NESTED ARGS...>]
$ bun create cloudflare@latest [--] [<DIRECTORY>] [OPTIONS] [-- <NESTED ARGS...>]
  • DIRECTORY string optional

    • The directory where the application should be created. The name of the application is taken from the directory name.
  • NESTED ARGS.. string[] optional

    • CLI arguments to pass to eventual third party CLIs C3 might invoke (in the case of full-stack applications).
  • --type string optional

    • The type of application that should be created.

    • The possible values for this option are:

      • web-framework: A website or web application.
      • hello-world: A basic “Hello World” Cloudflare Worker.
      • hello-world-durable-object: A Durable Object and a Worker to communicate with it.
      • common: A Cloudflare Worker which implements a common example of routing/proxying functionalities.
      • scheduled: A scheduled Cloudflare Worker (triggered via Cron Triggers).
      • queues: A Cloudflare Worker which is both a consumer and produced of Queues.
      • chatgptPlugin: A ChatGPT plugin.
      • openapi: A Worker implementing an OpenAPI REST endpoint.
      • remote-template: Create a new project from a git repository.
      • pre-existing: Fetch a Worker initialized from the Cloudflare dashboard.
  • --framework string optional

    • The type of framework to use to create a web application (when using this option, --type is ignored).

    • The possible values for this option are:

      • angular
      • astro
      • docusaurus
      • gatsby
      • hono
      • next
      • nuxt
      • qwik
      • react
      • remix
      • solid
      • svelte
      • vue
  • --template string optional

    • Create a new project via an external template hosted in a git repository

    • The value for this option may be specified as any of the following:

      • user/repo
      • git@github.com:user/repo
      • https://github.com/user/repo
      • user/repo/some-template (subdirectories)
      • user/repo#canary (branches)
      • user/repo#1234abcd (commit hash)
      • bitbucket:user/repo (BitBucket)
      • gitlab:user/repo (GitLab)

      See the degit docs for more details.

      At a minimum, templates must contain the following:

      • package.json
      • wrangler.toml
      • src/ containing a worker script referenced from wrangler.toml

      See the templates folder of this repo for more examples.

  • --deploy boolean (default: true) optional

    • Deploy your application after it has been created.
  • --tsboolean (default: true) optional

    • Use TypeScript in your application.
  • --git boolean (default: true) optional

    • Initialize a local git repository for your application.
  • --open boolean (default: true) optional

    • Open with your browser the deployed application (this option is ignored if the application is not deployed).
  • -y, --accept-defaults boolean optional

    • Use all the default C3 options each can also be overridden by specifying it.
  • --auto-update boolean (default: true) optional

    • Automatically uses the latest version of C3.
  • -v, --version boolean optional

    • Show version number.
  • -h, --help boolean optional

    • Show a help message.