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.exampleto.env.dev.task init
Note
- The
.env.devfile 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 setupInstall NPM dependencies.
task npm:installUpdate NPM dependencies.
task npm:updateStart vite dev server.
task upBuild and start vite preview server.
task up:previewStop and remove the container.
task downView container logs.
task logsGenerate wrangler types.
task wrangler:typesDeploy to Cloudflare Workers.
task wrangler:deployImportant
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_KEYImportant
- This requires the
CLOUDFLARE_API_TOKENto be set in the.envfile. - You will be prompted to enter the secret value.
Run biome format with safe fixes.
task biome:format:fixRun biome lint with safe fixes.
task biome:lint:fixRun 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@v3but has thewranglerVersionexplicitly set to match the version in thepackage.json(v4). - By default, the
release.ymlhasWRANGLER_QUIETset totrueandSHOW_DEPLOYMENT_URLset tofalse, which will hide the deployment URL from the logs.
- The action uses
- βοΈ Pre-commit.
- π Task (optional)
Run pre-commit install or task precommit:install to install the pre-commit hooks.
This repository comes with a MIT license.