Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nickruigrok/baseflare/llms.txt
Use this file to discover all available pages before exploring further.
defineConfig is exported from baseflare/server and is intended for exclusive use in baseflare.config.ts at the root of your project. It validates every field in the configuration object at module load time — throwing a descriptive Error for any invalid value — and returns the object typed as BaseflareConfig. The config is consumed by both the CLI (for Cloudflare resource naming, Worker bundling, and deployment) and by the runtime (for CORS handling and request limits).
Signature
BaseflareConfig Fields
A non-empty project name slug. Used to name every Cloudflare resource Baseflare
manages: the D1 database, the Worker script, and related resources are named
bf-{project}-{env}. Must be a non-empty string after trimming whitespace.Path to the functions directory, relative to the project root. The CLI scans
this directory to discover
query, mutation, action, and their internal
variants when auto-generating the Worker entry point.Default: 'baseflare'Packages to exclude from Worker bundling. Entries must be non-empty strings.
Use this to prevent large Node.js-only packages from being bundled into the
Worker when they are supplied by the Cloudflare runtime or are truly unused
at runtime.
CORS configuration. See
BaseflareCorsConfig below.Request limit configuration. See
BaseflareLimitsConfig below.Middleware array. Must be an array if provided. (Planned feature — the
middleware pipeline is not yet implemented.)
Cloudflare Worker settings. See
BaseflareWorkerConfig below.BaseflareCorsConfig
An array of allowed origins. Each entry must be a non-empty string. Pass
['*'] to allow all origins (not recommended in production).Example: ['https://myapp.com', 'http://localhost:5173']Preflight response cache duration in seconds, sent as the
Access-Control-Max-Age header. Must be a non-negative integer.Example: 86400 (24 hours)BaseflareLimitsConfig
A positive integer cap on the number of rows returned by a single
.collect() call. Queries that would return more rows are truncated to this
limit. Useful for protecting against accidental full-table scans in production.A non-empty string describing the maximum allowed request body size for file
uploads. The string is parsed by the runtime; use familiar size notation such
as
'10mb' or '50kb'.BaseflareWorkerConfig
The Cloudflare Workers compatibility date in
YYYY-MM-DD format. Controls
which breaking changes in the Workers runtime are enabled. Passed directly to
wrangler.toml during deployment.Example: '2026-04-08'Additional Cloudflare Workers compatibility flags to enable. Each entry must
be a non-empty string.
nodejs_compat is always injected by Baseflare regardless of what you list
here. You do not need to include it explicitly.Validation
defineConfig validates all fields immediately at module load time. Any violation throws an Error with a descriptive message pointing at the offending field:
| Field | Validation rule |
|---|---|
project | Non-empty string after trimming |
functions | Non-empty string if provided |
external | All entries must be non-empty strings |
cors.origins | All entries must be non-empty strings |
cors.maxAge | Non-negative integer |
limits.maxQueryResults | Positive integer |
limits.maxUploadSize | Non-empty string |
worker.compatibilityDate | Matches /^\d{4}-\d{2}-\d{2}$/ |
worker.compatibilityFlags | Array of non-empty strings |
"Unknown option" error, preventing configuration typos from going unnoticed.