Get Started
For most front-end applications, you'll want to use a framework. Workers supports number of popular frameworks that come with ready-to-use components, a pre-defined and structured architecture, and community support. View framework specific guides to get started using a framework.
Alternatively, you may prefer to build your website from scratch if:
- You're interested in learning by implementing core functionalities on your own.
- You're working on a simple project where you might not need a framework.
- You want to optimize for performance by minimizing external dependencies.
- You require complete control over every aspect of the application.
- You want to build your own framework.
This guide will instruct you through setting up and deploying a static site or a full-stack application without a framework on Workers.
This guide will instruct you through setting up and deploying a static site on Workers.
C3 (create-cloudflare-cli
) ↗ is a command-line tool designed to help you set up and deploy new applications to Cloudflare. Open a terminal window and run C3 to create your Worker project:
For setup, select the following options:
- For What would you like to start with?, choose
Hello World example
. - For Which template would you like to use?, choose
Hello World - Assets-only
. - For Which language do you want to use?, choose
TypeScript
. - For Do you want to use git for version control?, choose
Yes
. - For Do you want to deploy your application?, choose
No
(we will be making some changes before deploying).
After setting up your project, change your directory by running the following command:
After you have created your Worker, run the wrangler dev
in the project directory to start a local server. This will allow you to preview your project locally during development.
Your project can be deployed to a *.workers.dev
subdomain or a Custom Domain, from your own machine or from any CI/CD system, including Cloudflare's own.
The wrangler deploy
will build and deploy your project. If you're using CI, ensure you update your "deploy command" configuration appropriately.
This guide will instruct you through setting up and deploying dynamic and interactive server-side rendered (SSR) applications on Cloudflare Workers.
When building a full-stack application, you can use any Workers bindings, including assets' own, to interact with resources on the Cloudflare Developer Platform.
C3 (create-cloudflare-cli
) ↗ is a command-line tool designed to help you set up and deploy new applications to Cloudflare.
Open a terminal window and run C3 to create your Worker project:
For setup, select the following options:
- For What would you like to start with?, choose
Hello World example
. - For Which template would you like to use?, choose
Hello World - Worker with Assets
. - For Which language do you want to use?, choose
TypeScript
. - For Do you want to use git for version control?, choose
Yes
. - For Do you want to deploy your application?, choose
No
(we will be making some changes before deploying).
After setting up your project, change your directory by running the following command:
After you have created your Worker, run the wrangler dev
in the project directory to start a local server. This will allow you to preview your project locally during development.
With your new project generated and running, you can begin to write and edit your project:
- The
src/index.ts
file is populated with sample code. Modify its content to change the server-side behavior of your Worker. - The
public/index.html
file is populated with sample code. Modify its content, or anything else inpublic/
, to change the static assets of your Worker.
Then, save the files and reload the page. Your project's output will have changed based on your modifications.
Your project can be deployed to a *.workers.dev
subdomain or a Custom Domain, from your own machine or from any CI/CD system, including Cloudflare's own.
The wrangler deploy
will build and deploy your project. If you're using CI, ensure you update your "deploy command" configuration appropriately.