QR Code Generator runs entirely on Cloudflare Workers via theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dadu0699/qr-code/llms.txt
Use this file to discover all available pages before exploring further.
@astrojs/cloudflare adapter. You have two paths to production: a one-command manual deploy using the Wrangler CLI, or a fully automated CI/CD pipeline powered by the included GitHub Actions workflow that verifies your code before every release.
Prerequisites
Before deploying, make sure you have the following in place:- A Cloudflare account with Workers enabled
- Wrangler CLI installed (
wrangleris included as a project dev dependency) - A Cloudflare API token (
CF_API_TOKEN) with Workers deployment permissions - Your Cloudflare account ID (
CF_ACCOUNT_ID), found in the Cloudflare dashboard sidebar
Manual Deployment
Use the following steps to build and deploy the project to Cloudflare Workers from your local machine.Authenticate with Cloudflare
Log in to Cloudflare via Wrangler. This opens a browser window to complete OAuth.
pnpm publish in this project is not the standard npm registry publish command — it is a custom script defined in package.json that runs pnpm build && wrangler deploy. It will not publish any package to a registry.Local Preview with Wrangler
To simulate the Cloudflare Workers runtime on your local machine before deploying, use thepreview script. This builds the project and starts a local Wrangler dev server that mirrors the production Workers environment.
http://localhost:8787 by default. Unlike pnpm dev (which uses Astro’s Vite dev server), pnpm preview runs inside the actual Workerd runtime, making it the most accurate way to test Workers-specific behaviour such as environment bindings and compatibility flags.
CI/CD with GitHub Actions
The repository ships with a GitHub Actions workflow at.github/workflows/ci.yml that automates verification and deployment on every push to main.
Workflow overview
The pipeline contains two jobs that run sequentially:verify — Type-check, lint, test, and build
Runs on every push to main and every pull request. The job fails fast if any step does not pass, preventing broken code from reaching the deploy step.
| Step | Command |
|---|---|
| Type check | pnpm check |
| Lint | pnpm lint |
| Test | pnpm test |
| Build | pnpm build |
deploy — Deploy to Cloudflare Workers
Runs only on pushes to main (not on pull requests), and only after verify succeeds. It uses cloudflare/wrangler-action@v3 to deploy without requiring a local Wrangler login.
deploy job also uses a concurrency group (deploy-${{ github.ref }}) with cancel-in-progress: true, so a new push to main while a deploy is running will cancel the in-flight deploy and start a fresh one.
Required GitHub Secrets
Add the following secrets to your repository under Settings → Secrets and variables → Actions:| Secret | Description |
|---|---|
CF_API_TOKEN | Cloudflare API token with Workers deployment permissions |
CF_ACCOUNT_ID | Your Cloudflare account ID |
Wrangler Configuration Reference
Thewrangler.jsonc file at the project root controls how Wrangler builds and deploys the worker.
| Setting | Value | Description |
|---|---|---|
name | qr-code | The name of the Cloudflare Worker |
main | @astrojs/cloudflare/entrypoints/server | Worker entry point provided by the Astro Cloudflare adapter |
compatibility_date | 2026-04-21 | Workers runtime compatibility snapshot date |
compatibility_flags | ["nodejs_compat"] | Enables Node.js built-in API compatibility in the Workers runtime |
assets.directory | ./dist/client | Static assets directory served by the Workers Assets binding |
Observability
Logs and distributed traces are enabled by default inwrangler.jsonc. Both are persisted to Cloudflare and sampled at 100% (head_sampling_rate: 1), meaning every request is captured.