# Blaze ## Docs - [What is Blaze? Express-style Framework for CF Workers](https://wemstudios.mintlify.app/introduction.md): Learn what Blaze is and why it exists: an Express-compatible, zero-dependency web framework built natively for Cloudflare Workers. - [Quickstart: Build Your First Blaze Worker in 5 Minutes](https://wemstudios.mintlify.app/quickstart.md): Build and deploy your first Cloudflare Worker with Blaze in under 5 minutes. Install the package, define routes, and export the fetch handler. - [Installing Blaze in Your Cloudflare Workers Project](https://wemstudios.mintlify.app/installation.md): Install Blaze with npm, yarn, or pnpm, configure TypeScript, and import the middleware subpaths you need. Zero runtime dependencies included. - [Blaze App: createApp, Routing, and CF Workers Export](https://wemstudios.mintlify.app/core/app.md): createApp() is Blaze's entry point. Register routes, mount middleware, handle errors, and export the fetch handler for Cloudflare Workers. - [BlazeRequest: Accessing Params, Body, and CF Bindings](https://wemstudios.mintlify.app/core/request.md): BlazeRequest extends the Web Platform Request with Cloudflare bindings, route params, query helpers, body parsers, and metadata — all type-safe. - [BlazeResponse: Sending JSON, HTML, Streams, and More](https://wemstudios.mintlify.app/core/response.md): BlazeResponse provides Express-style res.json(), res.send(), res.html(), res.stream(), and res.redirect() methods on top of the Web Platform Response. - [Blaze Router: Sub-Routers, Trie Matching, and Patterns](https://wemstudios.mintlify.app/core/router.md): Blaze's TrieRouter delivers O(log n) route matching. Compose your app with sub-routers, wildcard patterns, and per-router middleware stacks. - [Error Handling in Blaze: BlazeError and app.onError](https://wemstudios.mintlify.app/core/error-handling.md): Blaze uses Express-style 4-argument error handlers. Throw BlazeError for structured HTTP errors, or use app.onError() for a global error boundary. - [Blaze Middleware: Built-in Modules and Custom Handlers](https://wemstudios.mintlify.app/middleware/overview.md): Blaze ships 12 tree-shakeable middleware modules using the Express (req, res, next) convention. Any Express middleware works unchanged in Blaze. - [Authentication Middleware: Bearer, Basic Auth, and JWT](https://wemstudios.mintlify.app/middleware/auth.md): Three authentication middleware modules for Blaze: bearerAuth for API tokens, basicAuth for credentials, and jwtAuth for HS256/RS256 JWT verification. - [CORS Middleware in Blaze: Origins, Preflight, Credentials](https://wemstudios.mintlify.app/middleware/cors.md): Configure cross-origin resource sharing in Blaze with cors(). Supports dynamic origins, preflight handling, credentials, and maxAge configuration. - [Sliding-Window Rate Limiting for Cloudflare Workers](https://wemstudios.mintlify.app/middleware/rate-limit.md): Add sliding-window rate limiting to your Blaze Worker using Cloudflare KV. Configure per-route limits, custom key functions, and response headers. - [Response Caching, Compression, and ETags in Blaze Workers](https://wemstudios.mintlify.app/middleware/caching.md): Cache responses with Cloudflare's Cache API and compress them with gzip or deflate using Blaze's built-in cache(), compress(), and etag() middleware. - [Utility Middleware: Logger, Request ID, Timeout, and Headers](https://wemstudios.mintlify.app/middleware/utilities.md): Blaze utility middleware for logging, request IDs, timeouts, and security headers — all operational concerns for production Cloudflare Workers APIs. - [Using Cloudflare KV Namespaces in Blaze via req.env](https://wemstudios.mintlify.app/bindings/kv.md): Access Cloudflare KV namespaces directly via req.env in any Blaze handler. Read, write, list, and delete key-value pairs with full TypeScript types. - [Querying Cloudflare D1 in Blaze: SQLite at the Edge](https://wemstudios.mintlify.app/bindings/d1.md): Use Cloudflare D1 (SQLite at the edge) in Blaze via req.env.DB. Prepare parameterized queries, batch statements, and access typed rows in every handler. - [Storing and Serving Files with Cloudflare R2 in Blaze](https://wemstudios.mintlify.app/bindings/r2.md): Upload, retrieve, and delete objects in Cloudflare R2 directly from Blaze route handlers using req.env.R2. Includes streaming, metadata, and ETag support. - [Durable Objects in Blaze: Stateful Workers at the Edge](https://wemstudios.mintlify.app/bindings/durable-objects.md): Access Cloudflare Durable Objects from Blaze via req.env. Forward requests to named DO instances for stateful logic like chat rooms and presence. - [Cloudflare Queues in Blaze: Producing and Consuming Messages](https://wemstudios.mintlify.app/bindings/queues.md): Send messages to Cloudflare Queues from Blaze routes and process them in a batch consumer handler. Decouples background work from HTTP responses. - [Workers AI in Blaze: Text Generation and Streaming](https://wemstudios.mintlify.app/bindings/ai.md): Call Cloudflare Workers AI models from Blaze route handlers via req.env.AI. Supports text generation, streaming SSE responses, and multiple model families. - [TypeScript Integration: Env Types and Handlers in Blaze](https://wemstudios.mintlify.app/guides/typescript.md): Define your Env type once with createApp() and get fully typed req.env, req.params, and handler signatures across your entire Blaze Worker. - [Testing Blaze Workers with Vitest and Mock Environments](https://wemstudios.mintlify.app/guides/testing.md): Test Blaze Workers without a real Cloudflare runtime. Pass synthetic Request objects and a mock Env to app.fetch() and assert on the Response. - [Recommended Project Structure for Blaze Cloudflare Workers](https://wemstudios.mintlify.app/guides/project-structure.md): Organize a Blaze Worker with feature-based sub-routers, a shared types directory, and dedicated middleware files that grow cleanly with your project. - [Blaze Router Benchmarks, Bundle Size, and Cold Start Tips](https://wemstudios.mintlify.app/guides/performance.md): Blaze's TrieRouter matches routes in O(log n) time with a ~11 KB gzipped bundle. Learn how to minimize cold starts on Cloudflare's v8 isolate model.