Ctrl K
ComunidadGuías…

wrangler.jsonc

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
{
	"$schema": "node_modules/wrangler/config-schema.json",

	// 🚫 DO NOT run `npx wrangler deploy` / `wrangler deploy` by hand.
	//
	// This project uses @cloudflare/vite-plugin. `npm run build` writes
	// .wrangler/deploy/config.json, which redirects wrangler to
	// build/server/wrangler.json (`main: index.js`, `assets.directory: ../client`,
	// `no_bundle: true`). A bare `wrangler deploy` therefore follows that redirect
	// and uploads whatever is already sitting in build/ WITHOUT running a build —
	// it silently ships a stale artifact: no error, no warning. This has really
	// happened once.
	//
	// ✅ Use one of the supported entry points instead:
	//   npm run deploy                 everyday redeploy (build + remote migrations + deploy)
	//   npm run setup / bash deploy.sh first-time deploy + resource creation
	//   npm run deploy:full            build + deploy + apply remote migrations
	//
	// ⚠️ Do not add a `build.command` here hoping to catch the mistake above.
	//    Under the Cloudflare Vite plugin that field is ignored — the plugin
	//    deletes `config["build"]` when it generates the config. The official
	//    Custom builds docs mark it "Not applicable if you're using the
	//    Cloudflare Vite plugin".
	//
	// ✅ The line of defence lives in the generated config instead: every
	//    `npm run build` injects a freshness assertion into
	//    build/server/wrangler.json, so a stale bare `wrangler deploy` fails
	//    loudly. See scripts/deploy-freshness-guard.mjs (and the injector in
	//    scripts/inject-deploy-guard.mjs).

	"name": "mailboxes",
	"compatibility_date": "2025-11-28",
	"main": "./workers/app.ts",
	"observability": {
		"enabled": true
	},
	"compatibility_flags": [
		"nodejs_compat"
	],
	// Admin credentials are created by the first-run setup wizard and stored
	// in D1 (see migrations/0011_admins.sql), so there are deliberately no
	// credential vars here. Passwords are stored as salted PBKDF2-SHA256
	// hashes — see workers/lib/password.ts.
	// send_email binding removed — uses Resend API instead, which works on Workers Free plan.
	"r2_buckets": [
		{
			"binding": "BUCKET",
			"bucket_name": "mailboxes",
			"preview_bucket_name": "mailboxes"
		}
	],
	"ai": {
		"binding": "AI"
	},
	"d1_databases": [
		{
			"binding": "DB",
			"database_name": "mailboxes-db",
			// All-zero placeholder. Deploy to Cloudflare provisions a D1 database
			// and rewrites this id in the user's clone. `npm run setup` treats it
			// as unset and writes the real id for an existing database of this
			// name — leave that local rewrite uncommitted.
			"database_id": "00000000-0000-0000-0000-000000000000",
			"preview_database_id": "local",
			"migrations_dir": "migrations"
		}
	]
}