QR Code Generator supports two local development modes. The Astro dev server gives you fast hot-reload during day-to-day coding, while the Wrangler preview mode builds the project and runs it inside a local simulation of the Cloudflare Workers runtime — useful for catching any edge-case differences before you deploy.Documentation 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.
Prerequisites
You need Node.js v24 and pnpm installed before cloning the project. The exact Node.js version is pinned in.nvmrc (v24.15.0); using a version manager such as nvm or fnm ensures you match it precisely.
Getting Started
Start the dev server
The
dev script generates Wrangler type declarations first, then starts the Astro development server with hot module replacement.Open the app in your browser
Navigate to http://localhost:4321. The server reloads automatically as you edit source files.
Available Scripts
| Script | Command | Description |
|---|---|---|
dev | wrangler types && astro dev | Generates Cloudflare type bindings and starts the Astro dev server on port 4321 |
start | wrangler types && astro dev | Alias for dev — identical behavior |
build | wrangler types && astro check && astro build | Type-checks the project and produces a production build |
preview | pnpm build && wrangler dev | Builds the app, then serves it locally using the Wrangler Workers runtime |
publish | pnpm build && wrangler deploy | Builds and deploys the app to Cloudflare Workers |
check | wrangler types && astro check | Runs Wrangler type generation and Astro’s TypeScript type checker |
lint | eslint . | Lints all source files with ESLint |
test | vitest run | Runs the full test suite once |
test:coverage | vitest run --coverage | Runs the suite with V8 coverage instrumentation and writes a report to coverage/ |
format | prettier --write . | Formats all source files with Prettier |
astro | astro | Direct access to the Astro CLI |
wrangler | wrangler | Direct access to the Wrangler CLI |
Wrangler Preview Mode
The Astro dev server uses Vite under the hood and does not emulate the Cloudflare Workers runtime. To verify runtime-specific behavior — such as how bindings and environment variables are resolved — use the preview script instead:pnpm build first (which includes type-checking via astro check) and then hands the output to wrangler dev, which spins up a local Workers runtime. The app is served on a Wrangler-assigned port rather than 4321.
TypeScript Path Aliases
The project configures severalpaths aliases in tsconfig.json to avoid deep relative imports across the codebase:
@lib and @app-types aliases (without the /* wildcard, as Vite’s alias resolver handles the prefix match) via its own resolve.alias config so tests can import shared utilities the same way as production code.
Code Quality
The project enforces consistent style and type safety through three complementary tools.Linting
ESLint is configured with the@eslint/js, eslint-plugin-astro, and typescript-eslint plugins. Run it across the entire codebase with:
dist/, .astro/, coverage/, worker-configuration.d.ts) and disables the no-undef rule in favour of TypeScript’s own undefined-identifier checking.
Formatting
Prettier handles all formatting. Three plugins are active:prettier-plugin-astro for .astro files, prettier-plugin-organize-imports for automatic import ordering, and prettier-plugin-tailwindcss for class-name sorting. The key style settings are:
Type Checking
To run Wrangler’s type generation (which producesworker-configuration.d.ts from wrangler.jsonc) together with Astro’s full TypeScript check: