Repository navigation
Expand file tree
/
Copy pathwrangler.jsonc
More file actions
126 lines (126 loc) · 6.15 KB
/
Copy pathwrangler.jsonc
File metadata and controls
126 lines (126 loc) · 6.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
"$schema": "node_modules/wrangler/config-schema.json",
"main": "./custom-worker.ts",
"name": "zapiszprzepis",
"compatibility_date": "2025-05-05",
"compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
// Smart Placement (#464 item 1): a recipe render makes ~a dozen round trips to Supabase
// while the Worker runs at the edge, far from the DB. "smart" lets Cloudflare place the
// Worker close to the DB so each round trip is cheaper — it helps every DB-chatty route,
// not just the recipe page. Provisional: keep it only if the before/after TTFB measurement
// in #464 shows a win for this Supabase region; revert the key if it does not help.
"placement": { "mode": "smart" },
// The id of the deployed Worker version, read by the guest page cache (src/lib/html-cache.ts)
// so a page cached before a deploy is never served after it (its /_next/static files are gone).
"version_metadata": { "binding": "CF_VERSION_METADATA" },
// Workers Logs (dashboard → zapiszprzepis → Observability): keeps console output
// and each request's outcome, so "[auth] getUser failed" lines and requests that
// hit the CPU limit (error 1102) can be read after the fact, not only live.
"observability": { "enabled": true },
// All handled by custom-worker.ts -> scheduled(), dispatched on which fired:
// 30 3 — dump the recipe tables to R2 (the free Supabase plan has no backups)
// 0 4 — keep-alive ping, so the project is not paused after a week idle
// */5 — failover watchdog: re-send stale pending shares to the secondary
// Inngest account (#580 phase 3; off until INNGEST_EVENT_KEY_2 is set)
"triggers": {
"crons": ["30 3 * * *", "0 4 * * *", "*/5 * * * *"]
},
// Daily recipe backup target (custom-worker.ts -> backupToR2). The bucket
// must exist on the account before deploying — wrangler refuses a binding
// to a missing bucket (error 10085). Objects expire after 90 days via a
// lifecycle rule on the bucket, so storage stays bounded.
"r2_buckets": [
{
"binding": "BACKUPS",
"bucket_name": "zapiszprzepis-backups"
},
// Recipe photos (src/lib/image-store.ts). Public through the custom domain
// img.zapiszprzepis.pl; Supabase Storage no longer holds them (free-plan quota).
{
"binding": "IMAGE_BUCKET",
"bucket_name": "zapiszprzepis-images"
},
// Phase 2 guest-read cache (#445, #545): OpenNext's incremental cache. The bucket
// must exist before deploying (owner step 1 of the Phase 2 runbook, 10085 otherwise).
{
"binding": "NEXT_INC_CACHE_R2_BUCKET",
"bucket_name": "zapiszprzepis-inc-cache"
}
],
// Phase 2 tag cache (#445, #545): D1 database for revalidateTag. The database_id comes
// from `wrangler d1 create zapiszprzepis-tag-cache --location weur` (owner step 2.1).
"d1_databases": [
{
"binding": "NEXT_TAG_CACHE_D1",
"database_name": "zapiszprzepis-tag-cache",
"database_id": "5f37a869-33f7-48a0-8886-e817169a6373"
}
],
// Per-account cap on the paid Exa web search (src/lib/exa-rate-limit.ts):
// 5 searches a minute, keyed by user id. namespace_id is any account-unique id.
// Per-account cap on paid recipe extraction (src/lib/extraction-rate-limit.ts):
// 5 runs a minute across add, /share, refresh and retry. period may only be 10 or 60.
"ratelimits": [
{
"name": "EXA_SEARCH_LIMIT",
"namespace_id": "1001",
"simple": { "limit": 5, "period": 60 }
},
{
"name": "EXTRACTION_LIMIT",
"namespace_id": "1002",
"simple": { "limit": 5, "period": 60 }
},
// Staff MCP endpoint (src/lib/staff/mcp): 60 calls a minute per token, and the same
// cap per client address before the token is even looked up (keys "token:<id>" and
// "ip:<address>"). Nothing to create in Cloudflare: namespace_id only has to be unique in the account.
{
"name": "MCP_LIMIT",
"namespace_id": "1003",
"simple": { "limit": 60, "period": 60 }
},
// Anonymous usage counter (src/app/api/e): 120 events a minute per client address.
// The address is only the limiter's transient key; it is never stored. Nothing to
// create in Cloudflare: namespace_id only has to be unique in the account.
{
"name": "USAGE_LIMIT",
"namespace_id": "1004",
"simple": { "limit": 120, "period": 60 }
}
],
"assets": {
"directory": ".open-next/assets",
"binding": "ASSETS"
},
// Cloudflare Images: OpenNext resizes /_next/image through this binding and
// returns the original photo when it is missing (#357).
"images": {
"binding": "IMAGES"
},
// Workers AI: Whisper transcribes a Facebook video's narration when its caption
// has no method (#767, src/lib/transcribe-audio.ts). Free plan: 10,000 neurons a
// day, ~140 per three-minute reel. Nothing to create in Cloudflare. Workers AI
// always runs remotely, also under `pnpm dev`; `remote: true` says so.
"ai": {
"binding": "AI",
"remote": true
},
"vars": {
"NEXT_PUBLIC_SUPABASE_URL": "https://wvrlgddgdddwmgzbvtij.supabase.co",
"NEXT_PUBLIC_SUPABASE_ANON_KEY": "sb_publishable_49CjHG7pAqYIFe7roJDZdA_5c_jBzj2",
// First-party usage counter (.ai/specs/2026-10-30-first-party-usage-analytics.md).
// "1" turns on both the browser beacon and the /api/e writer; on since the owner
// approved the privacy-policy wording (2026-11-02). NEXT_PUBLIC_* values are inlined
// at `next build`, so the same value must also be set as a Workers Builds build
// variable (dashboard → Settings → Build → Variables and secrets); this runtime
// copy alone does not switch the bundled code.
"NEXT_PUBLIC_USAGE_ANALYTICS": "1",
"NEXT_PUBLIC_SITE_URL": "https://zapiszprzepis.pl",
// OAuth sign-in buttons on /login (E01-S12): parseOAuthProviders reads this
// comma-separated list; a listed name shows its button and lets the server
// action use it. Facebook is enabled now that the Meta app is published Live
// (business verification passed). Both providers must stay configured in the
// Supabase dashboard (Authentication → Providers) with their redirect URLs.
"AUTH_OAUTH_PROVIDERS": "google,facebook"
}
}