This is a Container starter template to demonstrate deploying a static frontend with a load-balanced and stateless containerized backend.
Outside of this repo, you can start a new project with this template using C3 (the create-cloudflare
CLI):
npm create cloudflare@latest -- --template=mikenomitch/static-frontend-container-backend
First, run:
npm install
# or
yarn install
# or
pnpm install
# or
bun install
Then run the development server (using the package manager of your choice):
npm run dev
Open http://localhost:8787 with your browser to see the result.
You can start editing your Worker by modifying src/index.ts
, you can start
editing your Container backend by editing the content of container_src
,
and you can start editing assets in /dist
.
You can also use one of the many frontend frameworks that work on Cloudflare.
Command | Action |
---|---|
npm run deploy |
Deploy your application to Cloudflare |
To learn more about Containers, take a look at the following resources:
- Container Documentation - learn about Containers
- Beta Information - learn about the Containers Beta
- Container Class - learn about the Container helper class
Your feedback and contributions are welcome!