This is a development setup with docker compose for the Vite React Template.
Tip
While this example shows the Vite React template, the principles on how to use Docker Compose can be applied for any other template as well.
-
Copy
.env.dev.example
to.env.dev
.task init
Note
- The
.env.dev
file is used for development purposes, and can include variables/secrets likeCLOUDFLARE_API_TOKEN
, and will not be parsed for wrangler types.
-
Install dependencies before starting the container.
task npm:install
-
Start the container.
task up
-
Access the UI at
http://localhost:8789
.
🚀 TLDR
Initialize the project, install dependencies, and start the container.
task setup
Install NPM dependencies.
task npm:install
Update NPM dependencies.
task npm:update
Start vite dev server.
task up
Build and start vite preview server.
task up:preview
Stop and remove the container.
task down
View container logs.
task logs
Generate wrangler types.
task wrangler:types
Deploy to Cloudflare Workers.
task wrangler:deploy
Important
This requires the CLOUDFLARE_API_TOKEN
to be set in the .env
file.
Upload secret.
task wrangler:secret s=<NAME_OF_SECRET>
# Example
task wrangler:secret s=API_KEY
Important
- This requires the
CLOUDFLARE_API_TOKEN
to be set in the.env
file. - You will be prompted to enter the secret value.
Run biome format with safe fixes.
task biome:format:fix
Run biome lint with safe fixes.
task biome:lint:fix
Run biome check with safe fixes.
task biome:check:fix
- The current development setup uses Vite with the
@cloudflare/vite-plugin
. - The base image for the docker compose worker service is
node:24-slim
. - There is a Github action that releases a new version of the worker when pushed to
main
(or manual workflow dispatch).- The action uses
cloudflare/wrangler-action@v3
but has thewranglerVersion
explicitly set to match the version in thepackage.json
(v4). - By default, the
release.yml
hasWRANGLER_QUIET
set totrue
andSHOW_DEPLOYMENT_URL
set tofalse
, which will hide the deployment URL from the logs.
- The action uses
This repository comes with a MIT license.