create-ilorb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1528 @@
1
+ // What each product installs: one ProductSpec per product. Everything that differs between Chat and Widgets lives HERE (names of
2
+ // Worker/D1, secrets the product Worker receives, vars, migrations, build before deploy, what goes into the Core, questions,
3
+ // copied folders and local mode); the steps (steps.ts) and the generation (generate.ts) only read the spec.
4
+ // The paths are those of the opera-source-code repository and stay THE SAME in the buyer's project (templates are found by
5
+ // relative path: ../../../overture-core, ../../../vendor/…).
6
+ import { randomBytes } from 'node:crypto';
7
+ /**
8
+ * Core R2 in every installation (any product): THEME_BUCKET holds the appearance logo/favicon (THEME-API.md).
9
+ * Cloud: the installer creates `<slug>-theme` and writes it into the Core's wrangler.jsonc; local: wrangler dev simulates the bucket.
10
+ */
11
+ export const CORE_R2 = [{ key: 'theme', suffix: 'theme', binding: 'THEME_BUCKET' }];
12
+ export const OPERA_VENDOR = 'vendor/opera-signal-475ec74';
13
+ /**
14
+ * Only the client/SDK PACKAGES (chat, uikit, client, protocol, server-auth…) go from the Opera vendor. The Opera chat server
15
+ * (`apps/chat`) and anything else under `apps/` NEVER go into the sold package: the buyer uses the CLOUD Opera chat
16
+ * with a TEST app of their own. The copy in vendor/…/apps is only for OUR end-to-end tests.
17
+ */
18
+ export const OPERA_VENDOR_TEMPLATES = [`${OPERA_VENDOR}/packages`, `${OPERA_VENDOR}/tsconfig.base.json`];
19
+ /** The Ilorb SDK as bundled in the Ilorb Code templates (vendor/make-ilorb-sdk.sh; imported as @ilorb/*). Chat, Consultas and Widgets use it (with the chat scope in the token since 1d00db17). */
20
+ export const ILORB_SDK = 'vendor/ilorb-sdk';
21
+ export const ILORB_SDK_TEMPLATES = [`${ILORB_SDK}/packages`, `${ILORB_SDK}/tsconfig.base.json`];
22
+ /** paths forbidden in the generated project (copyTemplates refuses them and the test checks) */
23
+ export const FORBIDDEN_TEMPLATE_RE = /^vendor\/[^/]+\/apps(\/|$)|(^|\/)apps\/chat(\/|$)/;
24
+ /** CLOUD Opera chat (the buyer uses a TEST app of their own in local mode and the production app in the cloud) */
25
+ export const OPERA_CLOUD = { chat: 'https://chat-signal.ilorb.app', rooms: 'https://api-signal.ilorb.app' };
26
+ const b64 = (n) => randomBytes(n).toString('base64');
27
+ const b64url = (n) => randomBytes(n).toString('base64url');
28
+ /** the Opera keys go along when the buyer provided them (otherwise: via the panel) */
29
+ const operaSecrets = (s) => ({
30
+ ...(s.OPERA_APP_SECRET ? { OPERA_APP_SECRET: s.OPERA_APP_SECRET } : {}),
31
+ ...(s.OPERA_CALLBACK_SECRET ? { OPERA_CALLBACK_SECRET: s.OPERA_CALLBACK_SECRET } : {}),
32
+ });
33
+ export const PRODUCTS = {
34
+ chat: {
35
+ id: 'chat',
36
+ name: 'Overture Chat',
37
+ templates: [
38
+ 'overture-core/api/workers',
39
+ 'overture-core/web/react',
40
+ 'overture-core/app/react-native',
41
+ 'overture-core/AUTH-API.md',
42
+ 'overture-chat/api/workers',
43
+ 'overture-chat/app/react-native',
44
+ // Chat pages in the Core panel (found by path; no node_modules of their own)
45
+ 'overture-chat/web/react',
46
+ ...ILORB_SDK_TEMPLATES,
47
+ ],
48
+ installDirs: ['overture-core/api/workers', 'overture-chat/api/workers', 'overture-core/web/react', 'overture-chat/app/react-native'],
49
+ d1: [
50
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
51
+ { key: 'chat', suffix: 'chat', dir: 'overture-chat/api/workers', migrations: 'migrations' },
52
+ ],
53
+ // R2 reserved for product media (Core avatar/upload in Phase 2). Chat photos stay in Opera's R2.
54
+ r2: [{ key: 'media', suffix: 'media' }],
55
+ queues: [],
56
+ api: { suffix: 'chat', dir: 'overture-chat/api/workers', d1Key: 'chat', health: '/v1/config' },
57
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
58
+ app: { dir: 'overture-chat/app/react-native', apiEnv: 'EXPO_PUBLIC_CHAT_API_URL' },
59
+ prebuild: null,
60
+ // encrypts (AES-GCM) the Opera/FCM/APNs keys the buyer stores via the panel in the Chat D1
61
+ generatedSecrets: { CHAT_SECRETS_KEY: () => b64(32) },
62
+ coreSecrets: [],
63
+ cron: null,
64
+ // read-only service route (find a person): Chat does NOT receive the ADMIN_TOKEN
65
+ workerSecrets: (s) => ({ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN, SECRETS_KEY: s.CHAT_SECRETS_KEY, ...operaSecrets(s) }),
66
+ workerVars: (a, urls) => ({
67
+ CORE_URL: urls.auth,
68
+ PRODUCT: 'chat',
69
+ OPERA_APP_ID: a.opera.appId ?? '',
70
+ OPERA_CHAT_URL: urls.opera,
71
+ OPERA_ROOMS_URL: urls.rooms,
72
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
73
+ APNS_BUNDLE_ID: a.bundleId ?? '',
74
+ }),
75
+ // the local Chat server talks to the CLOUD Opera chat using the buyer's TEST app
76
+ localDevVars: (a, s, urls) => ({
77
+ CORE_URL: urls.auth,
78
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
79
+ SECRETS_KEY: s.CHAT_SECRETS_KEY,
80
+ OPERA_APP_ID: a.opera.appId ?? '',
81
+ OPERA_APP_SECRET: s.OPERA_APP_SECRET ?? '',
82
+ ...(s.OPERA_CALLBACK_SECRET ? { OPERA_CALLBACK_SECRET: s.OPERA_CALLBACK_SECRET } : {}),
83
+ OPERA_CHAT_URL: urls.opera,
84
+ OPERA_ROOMS_URL: urls.rooms,
85
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
86
+ OPERA_TOKEN_TTL: '600',
87
+ }),
88
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
89
+ opera: true,
90
+ customDomain: false,
91
+ localPorts: ['auth', 'api', 'admin', 'app'],
92
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-chat/app/react-native/dist' },
93
+ },
94
+ // Overture Widgets (free): Opera chat and calls on any site with a <script>. NO mobile app and NO R2 (messages
95
+ // and media stay in Opera). The Worker embeds the compiled widget (web/js/build.mjs → src/generated/assets.ts).
96
+ widgets: {
97
+ id: 'widgets',
98
+ name: 'Overture Widgets',
99
+ templates: [
100
+ 'overture-core/api/workers',
101
+ 'overture-core/web/react',
102
+ // from the Core app only the pure TS packages the panel and Worker use by path (theme: tokens.ts/color.ts; i18n;
103
+ // AuthClient) — the demo app is not included: Widgets have no mobile app
104
+ 'overture-core/app/react-native/packages',
105
+ 'overture-core/app/react-native/tsconfig.base.json',
106
+ 'overture-core/AUTH-API.md',
107
+ 'overture-widgets/api/workers',
108
+ 'overture-widgets/web/js',
109
+ // pages in the Core panel (Widgets and Inbox), found by path; no node_modules of their own
110
+ 'overture-widgets/web/react',
111
+ // config.ts and theme.ts: the SAME code on the server, in the panel and in the widget
112
+ 'overture-widgets/shared',
113
+ 'overture-widgets/README.md',
114
+ ...ILORB_SDK_TEMPLATES,
115
+ ],
116
+ installDirs: ['overture-core/api/workers', 'overture-widgets/api/workers', 'overture-widgets/web/js', 'overture-core/web/react'],
117
+ d1: [
118
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
119
+ { key: 'widgets', suffix: 'widgets', dir: 'overture-widgets/api/workers', migrations: 'migrations' },
120
+ ],
121
+ r2: [],
122
+ queues: [],
123
+ api: { suffix: 'widgets', dir: 'overture-widgets/api/workers', d1Key: 'widgets', health: '/' },
124
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
125
+ app: null,
126
+ prebuild: {
127
+ id: 'build.widget',
128
+ dir: 'overture-widgets/web/js',
129
+ script: 'build.mjs',
130
+ inputs: ['overture-widgets/web/js/src', 'overture-widgets/web/js/releases', 'overture-widgets/web/js/package.json'],
131
+ output: 'overture-widgets/api/workers/src/generated/assets.ts',
132
+ },
133
+ generatedSecrets: {
134
+ // signs the visitor id (HMAC): changing it = all visitors become new
135
+ WIDGETS_VISITOR_KEY: () => 'vk_' + b64url(32),
136
+ // encrypts (AES-GCM) the Opera/push/Resend keys the Widgets panel stores in D1
137
+ WIDGETS_SECRETS_KEY: () => b64(32),
138
+ },
139
+ coreSecrets: [],
140
+ cron: null,
141
+ // CORE_SERVICE_TOKEN: Core service route (POST /v1/service/users/by-role) — NEVER the ADMIN_TOKEN
142
+ workerSecrets: (s) => ({
143
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
144
+ VISITOR_KEY: s.WIDGETS_VISITOR_KEY,
145
+ SECRETS_KEY: s.WIDGETS_SECRETS_KEY,
146
+ ...operaSecrets(s),
147
+ // e-mail to agents and to the visitor outside business hours: the same Resend key as login (if the buyer provided it)
148
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
149
+ }),
150
+ workerVars: (a, urls) => ({
151
+ CORE_URL: urls.auth,
152
+ // the snippet shown by the panel uses this address
153
+ PUBLIC_URL: urls.api,
154
+ OPERA_APP_ID: a.opera.appId ?? '',
155
+ OPERA_CHAT_URL: urls.opera,
156
+ OPERA_ROOMS_URL: urls.rooms,
157
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
158
+ // CORS for the panel routes (/v1/admin/*): only this installation's panel
159
+ CORS_ORIGINS: urls.admin,
160
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
161
+ }),
162
+ localDevVars: (a, s, urls) => ({
163
+ CORE_URL: urls.auth,
164
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
165
+ VISITOR_KEY: s.WIDGETS_VISITOR_KEY,
166
+ SECRETS_KEY: s.WIDGETS_SECRETS_KEY,
167
+ PUBLIC_URL: urls.api,
168
+ OPERA_APP_ID: a.opera.appId ?? '',
169
+ OPERA_APP_SECRET: s.OPERA_APP_SECRET ?? '',
170
+ ...(s.OPERA_CALLBACK_SECRET ? { OPERA_CALLBACK_SECRET: s.OPERA_CALLBACK_SECRET } : {}),
171
+ OPERA_CHAT_URL: urls.opera,
172
+ OPERA_ROOMS_URL: urls.rooms,
173
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
174
+ OPERA_TOKEN_TTL: '600',
175
+ CORS_ORIGINS: urls.admin,
176
+ // local: the e-mail only goes to the Worker log
177
+ EMAIL_MODE: 'log',
178
+ }),
179
+ core: { name: () => 'Overture Widgets', platforms: ['web'] },
180
+ opera: true,
181
+ customDomain: false,
182
+ localPorts: ['auth', 'api', 'admin', 'site'],
183
+ localStatic: { admin: 'overture-core/web/react/dist' },
184
+ },
185
+ // Overture Consultas: scheduling + payment + timed video. Bills through the Core PAYMENTS module
186
+ // (PAYMENTS_TOKEN product → Core; PAYMENTS_CALLBACK_SECRET signs the Core → product callback, the SAME value on both sides)
187
+ // and has the cron for reminders (24 h / 15 min), expired locks and finished consultations. Expo app for the client and
188
+ // the professional; pages in the Core panel. No R2 (the room and chat belong to Opera).
189
+ consultas: {
190
+ id: 'consultas',
191
+ name: 'Overture Consultas',
192
+ templates: [
193
+ 'overture-core/api/workers',
194
+ 'overture-core/web/react',
195
+ // from the Core app only the TS packages (theme, i18n, ui, auth) the Consultas app uses by path
196
+ 'overture-core/app/react-native/packages',
197
+ 'overture-core/app/react-native/tsconfig.base.json',
198
+ 'overture-core/AUTH-API.md',
199
+ 'overture-core/PAYMENTS-API.md',
200
+ 'overture-consultas/api/workers',
201
+ 'overture-consultas/app/react-native',
202
+ // Consultas pages in the Core panel (found by path; no node_modules of their own)
203
+ 'overture-consultas/web/react',
204
+ 'overture-consultas/README.md',
205
+ ...ILORB_SDK_TEMPLATES,
206
+ ],
207
+ installDirs: ['overture-core/api/workers', 'overture-consultas/api/workers', 'overture-core/web/react', 'overture-consultas/app/react-native'],
208
+ d1: [
209
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
210
+ { key: 'consultas', suffix: 'consultas', dir: 'overture-consultas/api/workers', migrations: 'migrations' },
211
+ ],
212
+ r2: [],
213
+ queues: [],
214
+ api: { suffix: 'consultas', dir: 'overture-consultas/api/workers', d1Key: 'consultas', health: '/' },
215
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
216
+ app: { dir: 'overture-consultas/app/react-native', apiEnv: 'EXPO_PUBLIC_CONSULTAS_API_URL' },
217
+ prebuild: null,
218
+ generatedSecrets: {
219
+ // product → Core (/v1/payments/*): only opens the payment routes (neither the ADMIN_TOKEN nor the SERVICE_TOKEN)
220
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
221
+ // Core → product: signs the payment callback (POST /v1/payments/callback)
222
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
223
+ },
224
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
225
+ cron: '* * * * *',
226
+ workerSecrets: (s) => ({
227
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
228
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
229
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
230
+ ...operaSecrets(s),
231
+ // e-mail reminders: the same Resend key as login (if the buyer provided it)
232
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
233
+ }),
234
+ workerVars: (a, urls, local) => ({
235
+ CORE_URL: urls.auth,
236
+ PRODUCT: 'consultas',
237
+ // Opera callback URL and the payment return when there is no web app
238
+ PUBLIC_URL: urls.api,
239
+ ...(urls.app ? { APP_URL: urls.app } : {}),
240
+ OPERA_APP_ID: a.opera.appId ?? '',
241
+ OPERA_CHAT_URL: urls.opera,
242
+ OPERA_ROOMS_URL: urls.rooms,
243
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
244
+ // cloud: real e-mail (Resend) and push (FCM) when the keys exist; local: only records and shows in the log
245
+ NOTIFY_MODE: local ? 'log' : 'live',
246
+ // this installation's panel (the native app sends no Origin; the local web app is added to the list)
247
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
248
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
249
+ }),
250
+ localDevVars: (a, s, urls) => ({
251
+ CORE_URL: urls.auth,
252
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
253
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
254
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
255
+ PUBLIC_URL: urls.api,
256
+ ...(urls.app ? { APP_URL: urls.app } : {}),
257
+ OPERA_APP_ID: a.opera.appId ?? '',
258
+ OPERA_APP_SECRET: s.OPERA_APP_SECRET ?? '',
259
+ ...(s.OPERA_CALLBACK_SECRET ? { OPERA_CALLBACK_SECRET: s.OPERA_CALLBACK_SECRET } : {}),
260
+ OPERA_CHAT_URL: urls.opera,
261
+ OPERA_ROOMS_URL: urls.rooms,
262
+ CALL_MEDIA: urls.callMedia ? 'on' : 'off',
263
+ OPERA_TOKEN_TTL: '600',
264
+ NOTIFY_MODE: 'log',
265
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
266
+ }),
267
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
268
+ opera: true,
269
+ customDomain: false,
270
+ localPorts: ['auth', 'api', 'admin', 'app'],
271
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-consultas/app/react-native/dist' },
272
+ },
273
+ // Overture Status: public status page + uptime monitor. NO Opera, NO mobile app and NO R2. The Worker cron
274
+ // (every minute) runs the checks, the notice queue and the cleanup; the `Probe` Durable Object is only used with REGIONS. The
275
+ // page uses the Core appearance (GET /v1/theme?product=status) and the Core's own OFL fonts (<CORE_URL>/v1/fonts/fonts.css)
276
+ // (wrangler.jsonc → assets.directory = overture-core/app/react-native/packages/theme/assets/fonts, by path).
277
+ status: {
278
+ id: 'status',
279
+ name: 'Overture Status',
280
+ templates: [
281
+ 'overture-core/api/workers',
282
+ 'overture-core/web/react',
283
+ // from the Core app only the TS packages (theme: tokens.ts/css.ts used by the page; i18n; auth) and the OFL FONTS
284
+ // (packages/theme/assets/fonts) the Core serves at /v1/fonts/
285
+ 'overture-core/app/react-native/packages',
286
+ 'overture-core/app/react-native/tsconfig.base.json',
287
+ 'overture-core/AUTH-API.md',
288
+ 'overture-core/THEME-API.md',
289
+ 'overture-status/api/workers',
290
+ // Status pages in the Core panel (found by path; no node_modules of their own)
291
+ 'overture-status/web/react',
292
+ 'overture-status/README.md',
293
+ ],
294
+ installDirs: ['overture-core/api/workers', 'overture-status/api/workers', 'overture-core/web/react'],
295
+ d1: [
296
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
297
+ { key: 'status', suffix: 'status', dir: 'overture-status/api/workers', migrations: 'migrations' },
298
+ ],
299
+ r2: [],
300
+ queues: [],
301
+ api: { suffix: 'status', dir: 'overture-status/api/workers', d1Key: 'status', health: '/v1/health' },
302
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
303
+ app: null,
304
+ prebuild: null,
305
+ // encrypts (AES-GCM) the Telegram token and webhook secrets stored by the panel; signs the "unsubscribe" links
306
+ generatedSecrets: { STATUS_SECRETS_KEY: () => b64(32) },
307
+ coreSecrets: [],
308
+ cron: '* * * * *',
309
+ // Status only checks the panel token via the Core JWKS: it does not need CORE_SERVICE_TOKEN (nor the ADMIN_TOKEN)
310
+ workerSecrets: (s) => ({
311
+ SECRETS_KEY: s.STATUS_SECRETS_KEY,
312
+ // alert and notice e-mails: the same Resend key as login (if the buyer provided it)
313
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
314
+ }),
315
+ workerVars: (a, urls, local) => ({
316
+ CORE_URL: urls.auth,
317
+ PRODUCT: 'status',
318
+ // links in e-mails and feed: the custom domain, if the buyer provided it (--status-domain); otherwise workers.dev
319
+ PUBLIC_URL: !local && a.domain ? `https://${a.domain}` : urls.api,
320
+ // cloud: alerts and notices really go out (e-mail via Resend; webhook and Telegram via the panel); local: only the queue
321
+ NOTIFY_MODE: local ? 'log' : 'live',
322
+ // cloud: refuses targets on internal networks (localhost, private IP) in monitors and webhooks
323
+ ENVIRONMENT: local ? 'dev' : 'production',
324
+ CORS_ORIGINS: urls.admin,
325
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
326
+ }),
327
+ localDevVars: (_a, s, urls) => ({
328
+ CORE_URL: urls.auth,
329
+ SECRETS_KEY: s.STATUS_SECRETS_KEY,
330
+ PUBLIC_URL: urls.api,
331
+ NOTIFY_MODE: 'log',
332
+ ENVIRONMENT: 'dev',
333
+ CORS_ORIGINS: urls.admin,
334
+ }),
335
+ core: { name: () => 'Overture Status', platforms: ['web'] },
336
+ opera: false,
337
+ customDomain: true,
338
+ localPorts: ['auth', 'api', 'admin'],
339
+ localStatic: { admin: 'overture-core/web/react/dist' },
340
+ },
341
+ // Overture Agenda: IN-PERSON scheduling (services, professionals, resources, hours, double-booking-free reservations,
342
+ // cancellation policy, reminders). NO Opera. Bills through the Core PAYMENTS module like Consultas (PAYMENTS_TOKEN and
343
+ // PAYMENTS_CALLBACK_SECRET with the SAME value in the Core and in Agenda) and finds the person via SERVICE_TOKEN when registering a
344
+ // professional. Cron every minute: reminders 24 h / 2 h, expired locks, finished reservations.
345
+ // Panel (web/react, via glob), public booking page + embed.js (web/embed, Vite → Pages `<app>-agenda` / port
346
+ // 'site' locally) and the Expo app (app/react-native, EXPO_PUBLIC_AGENDA_API_URL).
347
+ agenda: {
348
+ id: 'agenda',
349
+ name: 'Overture Agenda',
350
+ templates: [
351
+ 'overture-core/api/workers',
352
+ 'overture-core/web/react',
353
+ 'overture-core/app/react-native/packages',
354
+ 'overture-core/app/react-native/tsconfig.base.json',
355
+ 'overture-core/AUTH-API.md',
356
+ 'overture-core/PAYMENTS-API.md',
357
+ 'overture-agenda/api/workers',
358
+ // Agenda pages in the Core panel (found by glob; no node_modules of their own)
359
+ 'overture-agenda/web/react',
360
+ // the public booking page + the embed.js widget (Vite; uses the Core theme/login/i18n via alias)
361
+ 'overture-agenda/web/embed',
362
+ // the client and professional app (Expo)
363
+ 'overture-agenda/app/react-native',
364
+ ],
365
+ installDirs: ['overture-core/api/workers', 'overture-agenda/api/workers', 'overture-core/web/react', 'overture-agenda/web/embed', 'overture-agenda/app/react-native'],
366
+ d1: [
367
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
368
+ { key: 'agenda', suffix: 'agenda', dir: 'overture-agenda/api/workers', migrations: 'migrations' },
369
+ ],
370
+ r2: [],
371
+ queues: [],
372
+ api: { suffix: 'agenda', dir: 'overture-agenda/api/workers', d1Key: 'agenda', health: '/' },
373
+ pages: [
374
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
375
+ // the public booking page (web/embed/dist: index.html + assets + embed.js) on a Pages `<app>-agenda`
376
+ { key: 'site', suffix: 'agenda', dir: 'overture-agenda/web/embed' },
377
+ ],
378
+ app: { dir: 'overture-agenda/app/react-native', apiEnv: 'EXPO_PUBLIC_AGENDA_API_URL' },
379
+ webBuild: { dir: 'overture-agenda/web/embed', script: 'build', apiEnv: 'VITE_AGENDA_API_URL', metaApi: 'agenda-api' },
380
+ prebuild: null,
381
+ generatedSecrets: {
382
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
383
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
384
+ },
385
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
386
+ cron: '* * * * *',
387
+ workerSecrets: (s) => ({
388
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
389
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
390
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
391
+ // confirmation and reminder e-mails: the same Resend key as login (if the buyer provided it)
392
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
393
+ }),
394
+ workerVars: (a, urls, local) => ({
395
+ CORE_URL: urls.auth,
396
+ PRODUCT: 'agenda',
397
+ PUBLIC_URL: urls.api,
398
+ // links in e-mails and the payment return: the public booking page
399
+ ...(urls.site ? { APP_URL: urls.site } : {}),
400
+ NOTIFY_MODE: local ? 'log' : 'live',
401
+ ENVIRONMENT: local ? 'dev' : 'production',
402
+ // the panel, the booking page (and its iframe on the buyer's site) and the local web app
403
+ CORS_ORIGINS: [urls.admin, urls.site, urls.app].filter(Boolean).join(','),
404
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
405
+ }),
406
+ localDevVars: (_a, s, urls) => ({
407
+ CORE_URL: urls.auth,
408
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
409
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
410
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
411
+ PUBLIC_URL: urls.api,
412
+ ...(urls.site ? { APP_URL: urls.site } : {}),
413
+ NOTIFY_MODE: 'log',
414
+ ENVIRONMENT: 'dev',
415
+ CORS_ORIGINS: [urls.admin, urls.site, urls.app].filter(Boolean).join(','),
416
+ }),
417
+ // the client books via the app (iOS/Android) and via the public page / widget (web)
418
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
419
+ opera: false,
420
+ customDomain: false,
421
+ localPorts: ['auth', 'api', 'admin', 'app', 'site'],
422
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-agenda/app/react-native/dist', site: 'overture-agenda/web/embed/dist' },
423
+ },
424
+ // Overture Sites: the buyer's site (block pages, blog, media, contact), generated as static HTML and published to
425
+ // R2 by the panel's "Publish" (no deploy). NO Opera, NO app and NO cron. The Worker serves the site (from R2) and the
426
+ // fixed files (Workers Assets: public/, only /_a/*), and checks the panel token via the JWKS — it does not receive ADMIN_TOKEN nor
427
+ // SERVICE_TOKEN. The server imports the Core theme by relative path (packages/theme/src/tokens.ts).
428
+ sites: {
429
+ id: 'sites',
430
+ name: 'Overture Sites',
431
+ templates: [
432
+ 'overture-core/api/workers',
433
+ 'overture-core/web/react',
434
+ // the panel uses the Core TS packages by path (theme, i18n, ui, auth); the Sites server imports the theme from here
435
+ 'overture-core/app/react-native/packages',
436
+ 'overture-core/app/react-native/tsconfig.base.json',
437
+ 'overture-core/AUTH-API.md',
438
+ 'overture-sites/api/workers',
439
+ // Sites pages in the Core panel (found by path; no node_modules of their own)
440
+ 'overture-sites/web/react',
441
+ 'overture-sites/README.md',
442
+ ],
443
+ installDirs: ['overture-core/api/workers', 'overture-sites/api/workers', 'overture-core/web/react'],
444
+ d1: [
445
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
446
+ { key: 'sites', suffix: 'sites', dir: 'overture-sites/api/workers', migrations: 'migrations' },
447
+ ],
448
+ // the published versions (pub/<version>/…) and the media (media/…)
449
+ r2: [{ key: 'files', suffix: 'sites-files', binding: 'FILES' }],
450
+ queues: [],
451
+ // "/" with nothing published is 503 (Coming soon): the fixed Assets file answers 200 once the Worker is up
452
+ api: { suffix: 'sites', dir: 'overture-sites/api/workers', d1Key: 'sites', health: '/_a/site.css' },
453
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
454
+ app: null,
455
+ prebuild: null,
456
+ generatedSecrets: {},
457
+ coreSecrets: [],
458
+ cron: null,
459
+ envSecrets: ['TURNSTILE_SECRET'],
460
+ // only the OPTIONAL ones: contact e-mail (the same Resend key as login) and the captcha
461
+ workerSecrets: (s) => ({
462
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
463
+ ...(s.TURNSTILE_SECRET ? { TURNSTILE_SECRET: s.TURNSTILE_SECRET } : {}),
464
+ }),
465
+ workerVars: (a, urls, local) => ({
466
+ CORE_URL: urls.auth,
467
+ PRODUCT: 'sites',
468
+ // canonical, sitemap, og:url: the site address
469
+ PUBLIC_URL: urls.api,
470
+ NOTIFY_MODE: local ? 'log' : 'live',
471
+ ENVIRONMENT: local ? 'dev' : 'production',
472
+ CORS_ORIGINS: urls.admin,
473
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
474
+ }),
475
+ localDevVars: (_a, s, urls) => ({
476
+ CORE_URL: urls.auth,
477
+ PUBLIC_URL: urls.api,
478
+ NOTIFY_MODE: 'log',
479
+ ENVIRONMENT: 'dev',
480
+ CORS_ORIGINS: urls.admin,
481
+ ...(s.TURNSTILE_SECRET ? { TURNSTILE_SECRET: s.TURNSTILE_SECRET } : {}),
482
+ }),
483
+ core: { name: (a) => a.appName, platforms: ['web'] },
484
+ opera: false,
485
+ customDomain: false,
486
+ localPorts: ['auth', 'api', 'admin'],
487
+ localStatic: { admin: 'overture-core/web/react/dist' },
488
+ },
489
+ // Overture Starter: the base of a SaaS (organizations, members, plans and billing through the Core, API keys, a sample
490
+ // module). NO Opera. Bills through the Core PAYMENTS module (PAYMENTS_TOKEN/PAYMENTS_CALLBACK_SECRET equal in the
491
+ // two Workers); it does not receive ADMIN_TOKEN, SERVICE_TOKEN nor MASTER_KEY (the panel talks with the panel token, via the JWKS).
492
+ // The customer's WEB app is the face of the SaaS: in the cloud it goes to a Pages `<app>-app` (Expo export), whose URL becomes
493
+ // `urls.app` (the Worker's APP_URL, the app's EXPO_PUBLIC_WEB_URL, origin in the CORS of Starter and Core).
494
+ // Hourly cron: free-trial notice and end, scheduled change, period end. Record: overture-starter/INSTALADOR.md.
495
+ // Optional Ilorb team chat (one group per org) + support chat (org owner/admins ↔ the SaaS team): ILORB_* only with the key.
496
+ starter: {
497
+ id: 'starter',
498
+ name: 'Overture Starter',
499
+ templates: [
500
+ 'overture-core/api/workers',
501
+ 'overture-core/web/react',
502
+ // from the Core app only the TS packages (theme + fonts, i18n, ui, auth) the Starter app uses by path
503
+ 'overture-core/app/react-native/packages',
504
+ 'overture-core/app/react-native/tsconfig.base.json',
505
+ 'overture-core/AUTH-API.md',
506
+ 'overture-core/PAYMENTS-API.md',
507
+ 'overture-core/THEME-API.md',
508
+ 'overture-starter/api/workers',
509
+ 'overture-starter/app/react-native',
510
+ // Starter pages in the Core panel (found by path; no node_modules of their own)
511
+ 'overture-starter/web/react',
512
+ 'overture-starter/README.md',
513
+ 'overture-starter/ESTENDER.md',
514
+ // team + support chat (@ilorb/signal-server in the Worker, @ilorb/signal-chat + uikit in the app and the panel page)
515
+ ...ILORB_SDK_TEMPLATES,
516
+ ],
517
+ installDirs: ['overture-core/api/workers', 'overture-starter/api/workers', 'overture-core/web/react', 'overture-starter/app/react-native'],
518
+ d1: [
519
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
520
+ // 0001 schema · 0002 seed plans · 0003 team/support chat (org groups, their members, chat profiles)
521
+ { key: 'starter', suffix: 'starter', dir: 'overture-starter/api/workers', migrations: 'migrations' },
522
+ ],
523
+ r2: [],
524
+ queues: [],
525
+ api: { suffix: 'starter', dir: 'overture-starter/api/workers', d1Key: 'starter', health: '/' },
526
+ pages: [
527
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
528
+ { key: 'app', suffix: 'app', dir: 'overture-starter/app/react-native' },
529
+ ],
530
+ app: { dir: 'overture-starter/app/react-native', apiEnv: 'EXPO_PUBLIC_STARTER_API_URL', webEnv: 'EXPO_PUBLIC_WEB_URL' },
531
+ prebuild: null,
532
+ generatedSecrets: {
533
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
534
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
535
+ },
536
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
537
+ cron: '0 * * * *',
538
+ workerSecrets: (s) => ({
539
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
540
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
541
+ // Starter e-mails (invite, receipt, billing): the same Resend key as login, if the buyer provided it
542
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
543
+ // team/support chat: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
544
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
545
+ }),
546
+ workerVars: (a, urls, local) => ({
547
+ CORE_URL: urls.auth,
548
+ PRODUCT: 'starter',
549
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
550
+ // links in invites and e-mails + the payment return
551
+ ...(urls.app ? { APP_URL: urls.app } : {}),
552
+ NOTIFY_MODE: local ? 'log' : 'live',
553
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
554
+ // cloud: API keys ovs_live_…; local: ovs_test_…
555
+ ...(local ? {} : { ENVIRONMENT: 'production' }),
556
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
557
+ }),
558
+ localDevVars: (a, s, urls) => ({
559
+ CORE_URL: urls.auth,
560
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
561
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
562
+ ...(urls.app ? { APP_URL: urls.app } : {}),
563
+ NOTIFY_MODE: 'log',
564
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
565
+ // team/support chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
566
+ ...(a.opera.appId && s.OPERA_APP_SECRET
567
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
568
+ : {}),
569
+ }),
570
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
571
+ opera: false,
572
+ ilorbOptional: true,
573
+ customDomain: false,
574
+ localPorts: ['auth', 'api', 'admin', 'app'],
575
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-starter/app/react-native/dist' },
576
+ },
577
+ // Overture Link: shortener, dynamic QR, link-in-bio page, statistics and plans (billed by the Core, like
578
+ // Consultas: PAYMENTS_TOKEN/PAYMENTS_CALLBACK_SECRET equal in both Workers). NO Opera. R2 for bio photos (MEDIA).
579
+ // Click queue only with the paid Workers plan (question); without it clicks go in batches straight to D1. The Worker
580
+ // imports the Core theme via the alias `overture-theme` → ./theme/entry.ts → ../../../../overture-core/… (same layout in
581
+ // the buyer's project: nothing to rewrite). Hourly cron (17 min): daily salt for uniques and retention.
582
+ link: {
583
+ id: 'link',
584
+ name: 'Overture Link',
585
+ templates: [
586
+ 'overture-core/api/workers',
587
+ 'overture-core/web/react',
588
+ 'overture-core/app/react-native/packages',
589
+ 'overture-core/app/react-native/tsconfig.base.json',
590
+ 'overture-core/AUTH-API.md',
591
+ 'overture-core/PAYMENTS-API.md',
592
+ 'overture-link/api/workers',
593
+ 'overture-link/app/react-native',
594
+ // Link pages in the Core panel (found by glob; no node_modules of their own)
595
+ 'overture-link/web/react',
596
+ 'overture-link/README.md',
597
+ ],
598
+ installDirs: ['overture-core/api/workers', 'overture-link/api/workers', 'overture-core/web/react', 'overture-link/app/react-native'],
599
+ d1: [
600
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
601
+ { key: 'link', suffix: 'link', dir: 'overture-link/api/workers', migrations: 'migrations' },
602
+ ],
603
+ r2: [{ key: 'media', suffix: 'link-media', binding: 'MEDIA' }],
604
+ queues: [],
605
+ paidQueue: { key: 'clicks', suffix: 'link-clicks', binding: 'CLICKS', maxBatchSize: 100, maxBatchTimeout: 5 },
606
+ api: { suffix: 'link', dir: 'overture-link/api/workers', d1Key: 'link', health: '/' },
607
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
608
+ app: { dir: 'overture-link/app/react-native', apiEnv: 'EXPO_PUBLIC_LINK_API_URL' },
609
+ prebuild: null,
610
+ generatedSecrets: {
611
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
612
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
613
+ },
614
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
615
+ cron: '17 * * * *',
616
+ // optional, via the environment only: Cloudflare for SaaS (customer domains) and Google Safe Browsing
617
+ envSecrets: ['CF_API_TOKEN', 'CF_ZONE_ID', 'SAFE_BROWSING_KEY'],
618
+ workerSecrets: (s) => ({
619
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
620
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
621
+ ...(s.CF_API_TOKEN ? { CF_API_TOKEN: s.CF_API_TOKEN } : {}),
622
+ ...(s.CF_ZONE_ID ? { CF_ZONE_ID: s.CF_ZONE_ID } : {}),
623
+ ...(s.SAFE_BROWSING_KEY ? { SAFE_BROWSING_KEY: s.SAFE_BROWSING_KEY } : {}),
624
+ }),
625
+ workerVars: (a, urls, local) => ({
626
+ CORE_URL: urls.auth,
627
+ PRODUCT: 'link',
628
+ // short links and bio pages go out at this address: the buyer's short domain, if provided (--short-domain)
629
+ PUBLIC_URL: !local && a.domain ? `https://${a.domain}` : urls.api,
630
+ ...(urls.app ? { APP_URL: urls.app } : {}),
631
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
632
+ ENVIRONMENT: local ? 'dev' : 'production',
633
+ }),
634
+ localDevVars: (_a, s, urls) => ({
635
+ CORE_URL: urls.auth,
636
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
637
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
638
+ PUBLIC_URL: urls.api,
639
+ ...(urls.app ? { APP_URL: urls.app } : {}),
640
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
641
+ ENVIRONMENT: 'dev',
642
+ }),
643
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
644
+ opera: false,
645
+ customDomain: true,
646
+ domainFlag: 'short-domain',
647
+ localPorts: ['auth', 'api', 'admin', 'app'],
648
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-link/app/react-native/dist' },
649
+ },
650
+ // Overture Imóveis: real-estate portal (HTML site with SEO + advertiser app + moderation panel), plans paid through the
651
+ // Core (PAYMENTS_* equal) and CORE_SERVICE_TOKEN (service route). R2 for photos (MEDIA). Fonts: the site points to
652
+ // <CORE_URL>/v1/fonts/fonts.css (the Worker does not bundle .ttf). Hourly cron (17 min). Optional Ilorb chat with the agent.
653
+ imoveis: {
654
+ id: 'imoveis',
655
+ name: 'Overture Imóveis',
656
+ templates: [
657
+ 'overture-core/api/workers',
658
+ 'overture-core/web/react',
659
+ 'overture-core/app/react-native/packages',
660
+ 'overture-core/app/react-native/tsconfig.base.json',
661
+ 'overture-core/AUTH-API.md',
662
+ 'overture-core/PAYMENTS-API.md',
663
+ 'overture-core/THEME-API.md',
664
+ 'overture-imoveis/api/workers',
665
+ 'overture-imoveis/app/react-native',
666
+ // Imóveis pages in the Core panel (found by glob; no node_modules of their own)
667
+ 'overture-imoveis/web/react',
668
+ 'overture-imoveis/README.md',
669
+ // chat with the agent (@ilorb/signal-server in the Worker, @ilorb/signal-chat + uikit in the app)
670
+ ...ILORB_SDK_TEMPLATES,
671
+ ],
672
+ installDirs: ['overture-core/api/workers', 'overture-imoveis/api/workers', 'overture-core/web/react', 'overture-imoveis/app/react-native'],
673
+ d1: [
674
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
675
+ // 0001 schema · 0002 payment events · 0003 editions · 0004 chat conversations
676
+ { key: 'imoveis', suffix: 'imoveis', dir: 'overture-imoveis/api/workers', migrations: 'migrations' },
677
+ ],
678
+ r2: [{ key: 'media', suffix: 'imoveis-media', binding: 'MEDIA' }],
679
+ queues: [],
680
+ api: { suffix: 'imoveis', dir: 'overture-imoveis/api/workers', d1Key: 'imoveis', health: '/v1/health' },
681
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
682
+ app: { dir: 'overture-imoveis/app/react-native', apiEnv: 'EXPO_PUBLIC_IMOVEIS_API_URL' },
683
+ prebuild: null,
684
+ generatedSecrets: {
685
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
686
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
687
+ },
688
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
689
+ cron: '17 * * * *',
690
+ workerSecrets: (s) => ({
691
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
692
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
693
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
694
+ // chat with the agent: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
695
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
696
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
697
+ }),
698
+ workerVars: (a, urls, local) => ({
699
+ CORE_URL: urls.auth,
700
+ PRODUCT: 'imoveis',
701
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
702
+ // the site (canonical, sitemap, links)
703
+ PUBLIC_URL: urls.api,
704
+ // the advertiser app's web (links in e-mails, payment return) — local only (in the cloud the app is the store one)
705
+ ...(urls.app ? { APP_URL: urls.app } : {}),
706
+ NOTIFY_MODE: local ? 'log' : 'live',
707
+ ENVIRONMENT: local ? 'dev' : 'production',
708
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
709
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
710
+ }),
711
+ localDevVars: (a, s, urls) => ({
712
+ CORE_URL: urls.auth,
713
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
714
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
715
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
716
+ PUBLIC_URL: urls.api,
717
+ ...(urls.app ? { APP_URL: urls.app } : {}),
718
+ NOTIFY_MODE: 'log',
719
+ ENVIRONMENT: 'dev',
720
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
721
+ // chat with the agent: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
722
+ ...(a.opera.appId && s.OPERA_APP_SECRET
723
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
724
+ : {}),
725
+ }),
726
+ core: { name: (a) => a.appName, platforms: ['web', 'ios', 'android'] },
727
+ opera: false,
728
+ ilorbOptional: true,
729
+ customDomain: false,
730
+ localPorts: ['auth', 'api', 'admin', 'app'],
731
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-imoveis/app/react-native/dist' },
732
+ },
733
+ // Overture Quiz: question game (player app/web + content panel), purchases through the Core (PAYMENTS_* equal), NO
734
+ // ADMIN_TOKEN/SERVICE_TOKEN. The web game goes to Pages `<app>-app` (the same `key:'app'` as Starter). R2 for question images
735
+ // (MEDIA). Hourly cron. Record: overture-quiz/INSTALADOR.md. Optional sample questions.
736
+ quiz: {
737
+ id: 'quiz',
738
+ name: 'Overture Quiz',
739
+ templates: [
740
+ 'overture-core/api/workers',
741
+ 'overture-core/web/react',
742
+ 'overture-core/app/react-native/packages',
743
+ 'overture-core/app/react-native/tsconfig.base.json',
744
+ 'overture-core/AUTH-API.md',
745
+ 'overture-core/PAYMENTS-API.md',
746
+ 'overture-core/THEME-API.md',
747
+ 'overture-quiz/api/workers',
748
+ 'overture-quiz/app/react-native',
749
+ 'overture-quiz/web/react',
750
+ 'overture-quiz/exemplos',
751
+ 'overture-quiz/README.md',
752
+ 'overture-quiz/ESTENDER.md',
753
+ ],
754
+ installDirs: ['overture-core/api/workers', 'overture-quiz/api/workers', 'overture-core/web/react', 'overture-quiz/app/react-native'],
755
+ d1: [
756
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
757
+ { key: 'quiz', suffix: 'quiz', dir: 'overture-quiz/api/workers', migrations: 'migrations' },
758
+ ],
759
+ // the question images (the Worker reads them via the MEDIA binding)
760
+ r2: [{ key: 'media', suffix: 'quiz-media', binding: 'MEDIA' }],
761
+ queues: [],
762
+ api: { suffix: 'quiz', dir: 'overture-quiz/api/workers', d1Key: 'quiz', health: '/' },
763
+ pages: [
764
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
765
+ // the web game (expo export) — same change as Starter
766
+ { key: 'app', suffix: 'app', dir: 'overture-quiz/app/react-native' },
767
+ ],
768
+ app: { dir: 'overture-quiz/app/react-native', apiEnv: 'EXPO_PUBLIC_QUIZ_API_URL' },
769
+ prebuild: null,
770
+ generatedSecrets: {
771
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
772
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
773
+ },
774
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
775
+ // abandoned matches and cleanup of "already seen" (local: dev-local calls /__scheduled)
776
+ cron: '0 * * * *',
777
+ workerSecrets: (s) => ({ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN, PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET }),
778
+ workerVars: (_a, urls) => ({
779
+ CORE_URL: urls.auth,
780
+ PRODUCT: 'quiz',
781
+ // challenge link (/c/<code>) and payment return
782
+ ...(urls.app ? { APP_URL: urls.app } : {}),
783
+ // address of the question images
784
+ PUBLIC_URL: urls.api,
785
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
786
+ }),
787
+ localDevVars: (_a, s, urls) => ({
788
+ CORE_URL: urls.auth,
789
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
790
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
791
+ ...(urls.app ? { APP_URL: urls.app } : {}),
792
+ PUBLIC_URL: urls.api,
793
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
794
+ }),
795
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
796
+ sampleImport: { file: 'overture-quiz/exemplos/perguntas-exemplo.csv', path: '/v1/admin/import/commit', extra: { createCategories: true } },
797
+ opera: false,
798
+ customDomain: false,
799
+ localPorts: ['auth', 'api', 'admin', 'app'],
800
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-quiz/app/react-native/dist' },
801
+ },
802
+ // Overture Help Center: help center (articles, requests by e-mail/widget/center, SLA). NO Opera, NO app. The widget
803
+ // is compiled INTO the Worker (web/js/build.mjs → api/workers/src/generated/widget.ts) before deploy and local run.
804
+ // R2 for attachments (FILES). The Core's OFL fonts as static assets (/help/fonts/). Receives CORE_SERVICE_TOKEN (by-role,
805
+ // lookup) — NEVER the ADMIN_TOKEN. Record: overture-helpcenter/INSTALADOR.md. Manual step: Email Routing (see the end).
806
+ // Optional Ilorb live chat on a ticket (requester ↔ assigned agent): ILORB_* only with the key; the bundled SDK ships.
807
+ helpcenter: {
808
+ id: 'helpcenter',
809
+ name: 'Overture Help Center',
810
+ templates: [
811
+ 'overture-core/api/workers',
812
+ 'overture-core/web/react',
813
+ 'overture-core/app/react-native/packages',
814
+ 'overture-core/app/react-native/tsconfig.base.json',
815
+ 'overture-core/AUTH-API.md',
816
+ 'overture-core/THEME-API.md',
817
+ 'overture-helpcenter/api/workers',
818
+ 'overture-helpcenter/web/js',
819
+ // pages in the Core panel (found by glob; no node_modules of their own)
820
+ 'overture-helpcenter/web/react',
821
+ 'overture-helpcenter/README.md',
822
+ // live chat on a ticket (@ilorb/signal-server in the Worker, @ilorb/signal-chat in the widget's lazy chat bundle and the panel)
823
+ ...ILORB_SDK_TEMPLATES,
824
+ ],
825
+ installDirs: ['overture-core/api/workers', 'overture-helpcenter/api/workers', 'overture-helpcenter/web/js', 'overture-core/web/react'],
826
+ d1: [
827
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
828
+ // 0001 schema · 0002 live chat (ticket_chats, chat_profiles)
829
+ { key: 'helpcenter', suffix: 'helpcenter', dir: 'overture-helpcenter/api/workers', migrations: 'migrations' },
830
+ ],
831
+ // request attachments (e-mail)
832
+ r2: [{ key: 'files', suffix: 'helpcenter-files', binding: 'FILES' }],
833
+ queues: [],
834
+ api: { suffix: 'helpcenter', dir: 'overture-helpcenter/api/workers', d1Key: 'helpcenter', health: '/' },
835
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
836
+ app: null,
837
+ prebuild: {
838
+ id: 'build.helpcenter-widget',
839
+ dir: 'overture-helpcenter/web/js',
840
+ script: 'build.mjs',
841
+ // the chat bundle carries the Ilorb SDK chat client
842
+ inputs: ['overture-helpcenter/web/js/src', 'overture-helpcenter/web/js/releases', 'overture-helpcenter/web/js/package.json', `${ILORB_SDK}/packages/chat/src`],
843
+ output: 'overture-helpcenter/api/workers/src/generated/widget.ts',
844
+ },
845
+ generatedSecrets: {
846
+ // signs votes/limits (visitor hash) — changing it only resets the limits and the repeated votes
847
+ HELPCENTER_SIGNING_KEY: () => 'hck_' + b64url(32),
848
+ },
849
+ coreSecrets: [],
850
+ // SLA (about to expire/expired) and e-mails that failed: every minute
851
+ cron: '* * * * *',
852
+ // Turnstile for the public form (optional)
853
+ envSecrets: ['TURNSTILE_SECRET'],
854
+ workerSecrets: (s) => ({
855
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
856
+ SIGNING_KEY: s.HELPCENTER_SIGNING_KEY,
857
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
858
+ ...(s.TURNSTILE_SECRET ? { TURNSTILE_SECRET: s.TURNSTILE_SECRET } : {}),
859
+ // live chat: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
860
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
861
+ }),
862
+ workerVars: (a, urls, local) => ({
863
+ CORE_URL: urls.auth,
864
+ PRODUCT: 'helpcenter',
865
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
866
+ // links in e-mails, the center (/help) and the widget (/widget.js) go out at this address
867
+ PUBLIC_URL: urls.api,
868
+ // cloud: real e-mail via Resend when there is a sender; local: only records (outbox) and shows in the log
869
+ NOTIFY_MODE: local || !a.email.from ? 'log' : 'live',
870
+ // CORS only for the PANEL routes; the public ones (widget/center) accept any site by design
871
+ CORS_ORIGINS: urls.admin,
872
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
873
+ }),
874
+ localDevVars: (a, s, urls) => ({
875
+ CORE_URL: urls.auth,
876
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
877
+ SIGNING_KEY: s.HELPCENTER_SIGNING_KEY,
878
+ PUBLIC_URL: urls.api,
879
+ NOTIFY_MODE: 'log',
880
+ CORS_ORIGINS: urls.admin,
881
+ ...(s.TURNSTILE_SECRET ? { TURNSTILE_SECRET: s.TURNSTILE_SECRET } : {}),
882
+ // live chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
883
+ ...(a.opera.appId && s.OPERA_APP_SECRET
884
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
885
+ : {}),
886
+ }),
887
+ core: { name: () => 'Overture Help Center', platforms: ['web'] },
888
+ opera: false,
889
+ ilorbOptional: true,
890
+ customDomain: false,
891
+ localPorts: ['auth', 'api', 'admin'],
892
+ localStatic: { admin: 'overture-core/web/react/dist' },
893
+ },
894
+ // Overture Classificados: classifieds site with SEO (server-side HTML, sitemap, JSON-LD) + app (Expo) + moderation
895
+ // panel; featured listings paid through the Core (PAYMENTS_* equal), CORE_SERVICE_TOKEN (never the ADMIN_TOKEN), CONTACT_KEY generated.
896
+ // R2 for photos (MEDIA). The web app on Pages `<app>-app` (key 'app'). Fonts: the pages point to <CORE_URL>/v1/fonts/.
897
+ // SEO lives on the domain: --site-domain wires the domain to the Worker and PUBLIC_URL becomes it.
898
+ // Record: overture-classificados/INSTALADOR.md (with the post-install steps and the checks).
899
+ classificados: {
900
+ id: 'classificados',
901
+ name: 'Overture Classificados',
902
+ templates: [
903
+ 'overture-core/api/workers',
904
+ 'overture-core/web/react',
905
+ 'overture-core/app/react-native/packages',
906
+ 'overture-core/app/react-native/tsconfig.base.json',
907
+ 'overture-core/AUTH-API.md',
908
+ 'overture-core/PAYMENTS-API.md',
909
+ 'overture-core/THEME-API.md',
910
+ 'overture-classificados/api/workers',
911
+ 'overture-classificados/app/react-native',
912
+ // pages in the Core panel (found by glob)
913
+ 'overture-classificados/web/react',
914
+ 'overture-classificados/README.md',
915
+ // chat with the advertiser (@ilorb/signal-server in the Worker, @ilorb/signal-chat + uikit in the app)
916
+ ...ILORB_SDK_TEMPLATES,
917
+ ],
918
+ installDirs: ['overture-core/api/workers', 'overture-classificados/api/workers', 'overture-core/web/react', 'overture-classificados/app/react-native'],
919
+ d1: [
920
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
921
+ // 0001 schema + FTS5 · 0002 sample categories, fields and plans · 0003 people · 0004 confirmed e-mail · 0005 chat conversations
922
+ { key: 'classificados', suffix: 'classificados', dir: 'overture-classificados/api/workers', migrations: 'migrations' },
923
+ ],
924
+ // the listing photos (the Worker serves them at /media/*)
925
+ r2: [{ key: 'media', suffix: 'classificados-media', binding: 'MEDIA' }],
926
+ queues: [],
927
+ api: { suffix: 'classificados', dir: 'overture-classificados/api/workers', d1Key: 'classificados', health: '/v1/health' },
928
+ pages: [
929
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
930
+ // the web app (expo export)
931
+ { key: 'app', suffix: 'app', dir: 'overture-classificados/app/react-native' },
932
+ ],
933
+ app: { dir: 'overture-classificados/app/react-native', apiEnv: 'EXPO_PUBLIC_CLASSIFICADOS_API_URL' },
934
+ prebuild: null,
935
+ generatedSecrets: {
936
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
937
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
938
+ // IP digest in the contact/report limits (the IP is never stored raw) — changing it only resets the limits
939
+ CONTACT_KEY: () => 'ctk_' + b64url(32),
940
+ },
941
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
942
+ // expired listings → expired; expired featured listings
943
+ cron: '*/5 * * * *',
944
+ workerSecrets: (s) => ({
945
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
946
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
947
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
948
+ CONTACT_KEY: s.CONTACT_KEY,
949
+ // chat with the advertiser: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
950
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
951
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
952
+ }),
953
+ workerVars: (a, urls, local) => ({
954
+ CORE_URL: urls.auth,
955
+ PRODUCT: 'classificados',
956
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
957
+ // the SITE URL: canonical, sitemap, Open Graph and the photo links. With --site-domain, the domain
958
+ PUBLIC_URL: !local && a.domain ? `https://${a.domain}` : urls.api,
959
+ // payment return for the featured listing
960
+ ...(urls.app ? { APP_URL: urls.app } : {}),
961
+ // contact notice by e-mail (only for e-mail confirmed in the Core); without Resend it stays only in the app inbox
962
+ NOTIFY_MODE: local || !a.email.from ? 'log' : 'live',
963
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
964
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
965
+ }),
966
+ localDevVars: (a, s, urls) => ({
967
+ CORE_URL: urls.auth,
968
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
969
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
970
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
971
+ CONTACT_KEY: s.CONTACT_KEY,
972
+ PUBLIC_URL: urls.api,
973
+ ...(urls.app ? { APP_URL: urls.app } : {}),
974
+ NOTIFY_MODE: 'log',
975
+ CORS_ORIGINS: '*',
976
+ // chat with the advertiser: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
977
+ ...(a.opera.appId && s.OPERA_APP_SECRET
978
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
979
+ : {}),
980
+ }),
981
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
982
+ smoke: [
983
+ { path: '/v1/health', status: 200, label: 'GET /v1/health', check: (b) => b?.ok === true },
984
+ { path: '/', status: 200, label: 'GET / (o site)' },
985
+ { path: '/sitemap.xml', status: 200, label: 'GET /sitemap.xml' },
986
+ { path: '/v1/admin/listings', status: 401, label: 'GET /v1/admin/listings sem token → 401' },
987
+ { path: '/v1/promo-plans', status: 200, label: 'GET /v1/promo-plans (3 planos e formas de pagar)', check: (b) => { const x = b; return (x?.plans?.length ?? 0) === 3 && (x?.payment?.methods?.length ?? 0) > 0; } },
988
+ ],
989
+ opera: false,
990
+ ilorbOptional: true,
991
+ customDomain: true,
992
+ domainFlag: 'site-domain',
993
+ localPorts: ['auth', 'api', 'admin', 'app'],
994
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-classificados/app/react-native/dist' },
995
+ },
996
+ // Overture Delivery: stores, menu, delivery area, orders, couriers and payouts (overture-delivery/api/workers/
997
+ // README.md → "Variables and secrets"). Payment through the Core (PAYMENTS_* equal); CORE_SERVICE_TOKEN = the Delivery token
998
+ // (find the person by e-mail when registering a store — lookup verifiedOnly). Cron every minute (orders with expired
999
+ // payment; local: dev-local calls /__scheduled, as in Consultas). Expo app for the customer and the courier. No R2/Opera.
1000
+ // Optional Ilorb order chat (customer, store, courier after accepting the ride): ILORB_* only with the key.
1001
+ delivery: {
1002
+ id: 'delivery',
1003
+ name: 'Overture Delivery',
1004
+ templates: [
1005
+ 'overture-core/api/workers',
1006
+ 'overture-core/web/react',
1007
+ 'overture-core/app/react-native/packages',
1008
+ 'overture-core/app/react-native/tsconfig.base.json',
1009
+ 'overture-core/AUTH-API.md',
1010
+ 'overture-core/PAYMENTS-API.md',
1011
+ 'overture-core/THEME-API.md',
1012
+ 'overture-delivery/api/workers',
1013
+ 'overture-delivery/app/react-native',
1014
+ // pages in the Core panel (found by glob; no node_modules of their own)
1015
+ 'overture-delivery/web/react',
1016
+ 'overture-delivery/README.md',
1017
+ // order chat (@ilorb/signal-server in the Worker, @ilorb/signal-chat + uikit in the app)
1018
+ ...ILORB_SDK_TEMPLATES,
1019
+ ],
1020
+ installDirs: ['overture-core/api/workers', 'overture-delivery/api/workers', 'overture-core/web/react', 'overture-delivery/app/react-native'],
1021
+ d1: [
1022
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
1023
+ // 0001 schema · 0002 editions · 0003 store photo · 0004 order chat conversations
1024
+ { key: 'delivery', suffix: 'delivery', dir: 'overture-delivery/api/workers', migrations: 'migrations' },
1025
+ ],
1026
+ r2: [],
1027
+ queues: [],
1028
+ api: { suffix: 'delivery', dir: 'overture-delivery/api/workers', d1Key: 'delivery', health: '/' },
1029
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
1030
+ app: { dir: 'overture-delivery/app/react-native', apiEnv: 'EXPO_PUBLIC_DELIVERY_API_URL' },
1031
+ prebuild: null,
1032
+ generatedSecrets: {
1033
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
1034
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
1035
+ },
1036
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
1037
+ cron: '* * * * *',
1038
+ workerSecrets: (s) => ({
1039
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1040
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1041
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1042
+ // order chat: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
1043
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
1044
+ }),
1045
+ workerVars: (a, urls) => ({
1046
+ CORE_URL: urls.auth,
1047
+ PRODUCT: 'delivery',
1048
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
1049
+ PUBLIC_URL: urls.api,
1050
+ // payment return when the app sends no returnUrl (the web app only exists locally)
1051
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1052
+ // also limits the returnUrl
1053
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1054
+ }),
1055
+ localDevVars: (a, s, urls) => ({
1056
+ CORE_URL: urls.auth,
1057
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1058
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1059
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1060
+ PUBLIC_URL: urls.api,
1061
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1062
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1063
+ // order chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
1064
+ ...(a.opera.appId && s.OPERA_APP_SECRET
1065
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
1066
+ : {}),
1067
+ }),
1068
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
1069
+ opera: false,
1070
+ ilorbOptional: true,
1071
+ customDomain: false,
1072
+ localPorts: ['auth', 'api', 'admin', 'app'],
1073
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-delivery/app/react-native/dist' },
1074
+ readme: {
1075
+ layout: (a, p) => `overture-core/api/workers ${a.slug}-auth — login (Core Auth) + pagamentos + D1 ${a.slug}-identity
1076
+ overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas do Delivery
1077
+ overture-core/app/react-native/packages tema, i18n, componentes e login do app
1078
+ overture-delivery/api/workers ${a.slug}-delivery — API do ${p.name} + D1 ${a.slug}-delivery (cron ${p.cron})
1079
+ overture-delivery/app/react-native o app do cliente e do entregador (Expo: iOS, Android e web) — ${a.bundleId}
1080
+ overture-delivery/web/react páginas no painel (pedidos, cardápio, loja · lojas, entregadores, repasses, ajustes)
1081
+ scripts/dev-local.mjs pnpm dev`,
1082
+ run: {
1083
+ pt: '`pnpm dev` sobe o login (Core Auth, com PAGAMENTOS simulados), o Worker do Delivery (o cron dos pagamentos vencidos é chamado a cada minuto), o painel com as páginas do Delivery e o app web do cliente e do entregador. Sem Opera. Só funciona numa instalação feita com `--target local`.',
1084
+ es: '`pnpm dev` levanta el acceso (Core Auth, con PAGOS simulados), el Worker de Delivery (el cron de los pagos vencidos se llama cada minuto), el panel con las páginas de Delivery y la app web del cliente y del repartidor. Sin Opera. Solo funciona en una instalación hecha con `--target local`.',
1085
+ en: '`pnpm dev` starts the login (Core Auth, with SIMULATED payments), the Delivery Worker (the expired-payment cron is called every minute), the panel with the Delivery pages and the customer/courier web app. No Opera. Only for an installation made with `--target local`.',
1086
+ },
1087
+ },
1088
+ finalNext: ['final.next.delivery'],
1089
+ },
1090
+ // Overture Cardápio: table QR (no app, no login for whoever is at the table). The table page is the Worker itself at /m/:token
1091
+ // (the script comes from web/mesa → api/workers/src/generated/mesa.ts, compiled BEFORE the deploy). Durable Object
1092
+ // `RestaurantLive` (binding LIVE, migration v1 new_sqlite_classes — already in the template's wrangler.jsonc; the deploy creates the class)
1093
+ // for the live dining room in the panel. R2 for photos (MEDIA), cron every minute. PUBLIC_URL = the Worker URL: it goes in each table's
1094
+ // QR — changing it later invalidates the printed QRs (notice at the end). LINK_SECRET signs the table link; PAYMENTS_* equal in the
1095
+ // Core; CORE_SERVICE_TOKEN = the Cardápio token (staff by e-mail and the moderator role inside the product itself).
1096
+ cardapio: {
1097
+ id: 'cardapio',
1098
+ name: 'Overture Cardápio',
1099
+ templates: [
1100
+ 'overture-core/api/workers',
1101
+ 'overture-core/web/react',
1102
+ 'overture-core/app/react-native/packages',
1103
+ 'overture-core/app/react-native/tsconfig.base.json',
1104
+ 'overture-core/AUTH-API.md',
1105
+ 'overture-core/PAYMENTS-API.md',
1106
+ 'overture-core/THEME-API.md',
1107
+ 'overture-cardapio/api/workers',
1108
+ // the table page (no framework): the build writes api/workers/src/generated/mesa.ts
1109
+ 'overture-cardapio/web/mesa',
1110
+ // pages in the Core panel (found by glob; no node_modules of their own)
1111
+ 'overture-cardapio/web/react',
1112
+ 'overture-cardapio/README.md',
1113
+ ],
1114
+ installDirs: ['overture-core/api/workers', 'overture-cardapio/api/workers', 'overture-cardapio/web/mesa', 'overture-core/web/react'],
1115
+ d1: [
1116
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
1117
+ { key: 'cardapio', suffix: 'cardapio', dir: 'overture-cardapio/api/workers', migrations: 'migrations' },
1118
+ ],
1119
+ r2: [{ key: 'media', suffix: 'cardapio-media', binding: 'MEDIA' }],
1120
+ queues: [],
1121
+ api: { suffix: 'cardapio', dir: 'overture-cardapio/api/workers', d1Key: 'cardapio', health: '/health' },
1122
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
1123
+ app: null,
1124
+ prebuild: {
1125
+ id: 'build.mesa',
1126
+ dir: 'overture-cardapio/web/mesa',
1127
+ script: 'build.mjs',
1128
+ inputs: ['overture-cardapio/web/mesa/src', 'overture-cardapio/web/mesa/package.json'],
1129
+ output: 'overture-cardapio/api/workers/src/generated/mesa.ts',
1130
+ },
1131
+ generatedSecrets: {
1132
+ // signs each table's link (the QR) and the WebSocket ticket: changing it = all printed QRs stop opening
1133
+ LINK_SECRET: () => 'lnk_' + b64url(32),
1134
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
1135
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
1136
+ },
1137
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
1138
+ // forgotten calls and orders, expired charges
1139
+ cron: '* * * * *',
1140
+ workerSecrets: (s) => ({
1141
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1142
+ LINK_SECRET: s.LINK_SECRET,
1143
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1144
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1145
+ }),
1146
+ workerVars: (_a, urls, local) => ({
1147
+ CORE_URL: urls.auth,
1148
+ PRODUCT: 'cardapio',
1149
+ // the Worker URL: goes in each table's QR and in the payment return (changing it later invalidates the QRs)
1150
+ PUBLIC_URL: urls.api,
1151
+ // the table page is served by this Worker (same origin): only the panel needs CORS
1152
+ CORS_ORIGINS: urls.admin,
1153
+ ENVIRONMENT: local ? 'dev' : 'production',
1154
+ }),
1155
+ localDevVars: (_a, s, urls) => ({
1156
+ CORE_URL: urls.auth,
1157
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1158
+ LINK_SECRET: s.LINK_SECRET,
1159
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1160
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1161
+ PUBLIC_URL: urls.api,
1162
+ CORS_ORIGINS: urls.admin,
1163
+ ENVIRONMENT: 'dev',
1164
+ }),
1165
+ core: { name: (a) => a.appName, platforms: ['web'] },
1166
+ opera: false,
1167
+ customDomain: false,
1168
+ localPorts: ['auth', 'api', 'admin'],
1169
+ localStatic: { admin: 'overture-core/web/react/dist' },
1170
+ readme: {
1171
+ layout: (a, p) => `overture-core/api/workers ${a.slug}-auth — login (Core Auth) + pagamentos + D1 ${a.slug}-identity
1172
+ overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas do Cardápio
1173
+ overture-core/app/react-native/packages tema (a página da mesa usa as cores e as fontes daqui), i18n e login
1174
+ overture-cardapio/api/workers ${a.slug}-cardapio — API + a página da mesa (/m/…) + D1 ${a.slug}-cardapio + R2 ${a.slug}-cardapio-media + Durable Object do salão ao vivo (cron ${p.cron})
1175
+ overture-cardapio/web/mesa a página da mesa (compilada para dentro do Worker)
1176
+ overture-cardapio/web/react páginas no painel (salão ao vivo, cardápio, mesas e QR, restaurante, restaurantes e planos)
1177
+ scripts/dev-local.mjs pnpm dev`,
1178
+ run: {
1179
+ pt: '`pnpm dev` sobe o login (Core Auth, com PAGAMENTOS simulados), o Worker do Cardápio (a página da mesa em `http://localhost:<porta da api>/m/…`, as fotos no R2 local, o salão ao vivo no Durable Object local, o cron chamado a cada minuto) e o painel com as páginas do Cardápio. Sem app e sem Opera. Os QRs apontam para o endereço do Worker (`PUBLIC_URL`): na nuvem, troque o endereço ANTES de imprimir — trocar depois invalida os QRs. Só funciona numa instalação feita com `--target local`.',
1180
+ es: '`pnpm dev` levanta el acceso (Core Auth, con PAGOS simulados), el Worker del Menú (la página de la mesa en `http://localhost:<puerto de la api>/m/…`, las fotos en el R2 local, el salón en vivo en el Durable Object local, el cron llamado cada minuto) y el panel con las páginas del Menú. Sin app y sin Opera. Los QR apuntan a la dirección del Worker (`PUBLIC_URL`): en la nube, cambia la dirección ANTES de imprimir — cambiarla después invalida los QR. Solo funciona en una instalación hecha con `--target local`.',
1181
+ en: '`pnpm dev` starts the login (Core Auth, with SIMULATED payments), the Menu Worker (the table page at `http://localhost:<api port>/m/…`, photos in the local R2, the live floor in the local Durable Object, the cron called every minute) and the panel with the Menu pages. No app and no Opera. The QR codes point to the Worker address (`PUBLIC_URL`): in the cloud, change the address BEFORE printing — changing it later invalidates the QR codes. Only for an installation made with `--target local`.',
1182
+ },
1183
+ },
1184
+ finalNext: ['final.next.cardapio', 'final.next.cardapioQr'],
1185
+ },
1186
+ // Overture Shop: online store without live (overture-shop/api/workers/README.md). The Worker is the API AND the STOREFRONT (server
1187
+ // HTML, web/html imported by path); photos in R2 (MEDIA); cron every minute (stock locks and expired
1188
+ // charges). Checkout through the Core (PAYMENTS_* equal); CORE_SERVICE_TOKEN = the Shop token; never the ADMIN_TOKEN. Expo app
1189
+ // for the customer; the web app goes to Pages `<app>-app`. The storefront and the web app call the Core from the browser at checkout
1190
+ // (/v1/auth/start and /verify): both URLs go into the Core's settings.corsOrigins (coreCorsApi). No fonts step.
1191
+ shop: {
1192
+ id: 'shop',
1193
+ name: 'Overture Shop',
1194
+ templates: [
1195
+ 'overture-core/api/workers',
1196
+ 'overture-core/web/react',
1197
+ 'overture-core/app/react-native/packages',
1198
+ 'overture-core/app/react-native/tsconfig.base.json',
1199
+ 'overture-core/AUTH-API.md',
1200
+ 'overture-core/PAYMENTS-API.md',
1201
+ 'overture-core/THEME-API.md',
1202
+ 'overture-shop/api/workers',
1203
+ // the storefront (data → HTML functions) the Worker imports by path
1204
+ 'overture-shop/web/html',
1205
+ 'overture-shop/app/react-native',
1206
+ // pages in the Core panel (found by glob; no node_modules of their own)
1207
+ 'overture-shop/web/react',
1208
+ 'overture-shop/README.md',
1209
+ ],
1210
+ installDirs: ['overture-core/api/workers', 'overture-shop/api/workers', 'overture-core/web/react', 'overture-shop/app/react-native'],
1211
+ d1: [
1212
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
1213
+ { key: 'shop', suffix: 'shop', dir: 'overture-shop/api/workers', migrations: 'migrations' },
1214
+ ],
1215
+ r2: [{ key: 'media', suffix: 'shop-media', binding: 'MEDIA' }],
1216
+ queues: [],
1217
+ api: { suffix: 'shop', dir: 'overture-shop/api/workers', d1Key: 'shop', health: '/v1/health' },
1218
+ pages: [
1219
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
1220
+ // the customer app on the web (expo export)
1221
+ { key: 'app', suffix: 'app', dir: 'overture-shop/app/react-native' },
1222
+ ],
1223
+ app: { dir: 'overture-shop/app/react-native', apiEnv: 'EXPO_PUBLIC_SHOP_API_URL' },
1224
+ prebuild: null,
1225
+ generatedSecrets: {
1226
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
1227
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
1228
+ },
1229
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
1230
+ cron: '* * * * *',
1231
+ workerSecrets: (s) => ({
1232
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1233
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1234
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1235
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
1236
+ }),
1237
+ workerVars: (a, urls, local) => ({
1238
+ CORE_URL: urls.auth,
1239
+ PRODUCT: 'shop',
1240
+ // the storefront (canonical, sitemap, e-mail links)
1241
+ PUBLIC_URL: urls.api,
1242
+ // order e-mails via Resend only with a sender; without it they stay recorded (notifications)
1243
+ NOTIFY_MODE: local || !a.email.from ? 'log' : 'live',
1244
+ ENVIRONMENT: local ? 'dev' : 'production',
1245
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1246
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
1247
+ }),
1248
+ localDevVars: (_a, s, urls) => ({
1249
+ CORE_URL: urls.auth,
1250
+ CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
1251
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1252
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1253
+ PUBLIC_URL: urls.api,
1254
+ NOTIFY_MODE: 'log',
1255
+ ENVIRONMENT: 'dev',
1256
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1257
+ }),
1258
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
1259
+ coreCorsApi: true,
1260
+ smoke: [
1261
+ { path: '/v1/health', status: 200, label: 'GET /v1/health', check: (b) => b?.ok === true },
1262
+ { path: '/', status: 200, label: 'GET / (a vitrine)' },
1263
+ { path: '/v1/admin/orders', status: 401, label: 'GET /v1/admin/orders sem token → 401' },
1264
+ ],
1265
+ opera: false,
1266
+ customDomain: false,
1267
+ localPorts: ['auth', 'api', 'admin', 'app'],
1268
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-shop/app/react-native/dist' },
1269
+ readme: {
1270
+ layout: (a, p) => `overture-core/api/workers ${a.slug}-auth — login (Core Auth) + pagamentos + D1 ${a.slug}-identity
1271
+ overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas da Loja
1272
+ overture-core/app/react-native/packages tema (a vitrine usa as cores e as fontes daqui), i18n, componentes e login
1273
+ overture-shop/api/workers ${a.slug}-shop — API + a vitrine + D1 ${a.slug}-shop + R2 ${a.slug}-shop-media (cron ${p.cron})
1274
+ overture-shop/web/html a vitrine (páginas HTML que o Worker serve)
1275
+ overture-shop/app/react-native o app do cliente (Expo: iOS, Android e web → Pages ${a.slug}-app) — ${a.bundleId}
1276
+ overture-shop/web/react páginas no painel (visão, pedidos, produtos, clientes, cupons, frete, avaliações, planilhas, configurações)
1277
+ scripts/dev-local.mjs pnpm dev`,
1278
+ run: {
1279
+ pt: '`pnpm dev` sobe o login (Core Auth, com PAGAMENTOS simulados), o Worker da Loja (a vitrine em `http://localhost:<porta da api>/`, as fotos no R2 local, o cron chamado a cada minuto), o painel com as páginas da Loja e o app web do cliente. Os e-mails dos pedidos ficam gravados (NOTIFY_MODE=log). Sem Opera. Na nuvem: R2 `{media}`, o app web no Pages `{app}`, e a vitrine e o app web entram nas origens do Core (o checkout entra pelo navegador). Só funciona numa instalação feita com `--target local`.',
1280
+ es: '`pnpm dev` levanta el acceso (Core Auth, con PAGOS simulados), el Worker de la Tienda (la vitrina en `http://localhost:<puerto de la api>/`, las fotos en el R2 local, el cron llamado cada minuto), el panel con las páginas de la Tienda y la app web del cliente. Los e-mails de los pedidos quedan grabados (NOTIFY_MODE=log). Sin Opera. En la nube: R2 `{media}`, la app web en el Pages `{app}`, y la vitrina y la app web entran en los orígenes del Core (el checkout entra por el navegador). Solo funciona en una instalación hecha con `--target local`.',
1281
+ en: '`pnpm dev` starts the login (Core Auth, with SIMULATED payments), the Shop Worker (the storefront at `http://localhost:<api port>/`, photos in the local R2, the cron called every minute), the panel with the Shop pages and the customer web app. Order e-mails are only recorded (NOTIFY_MODE=log). No Opera. In the cloud: R2 `{media}`, the web app on the `{app}` Pages, and the storefront and the web app join the Core origins (checkout signs in from the browser). Only for an installation made with `--target local`.',
1282
+ },
1283
+ },
1284
+ finalNext: ['final.next.shop'],
1285
+ },
1286
+ // Overture Faturas: quotes, invoices, recurrence and customer portal for small businesses (README → "Installer").
1287
+ // ⚠ Does NOT issue official tax invoices: the installer and the texts never promise that. The Worker serves the public links
1288
+ // (quote, invoice, portal — PUBLIC_URL) and the Core theme by path (theme/entry.ts). R2 for files (FILES:
1289
+ // PDFs, attachments), hourly cron (23 min: overdue, recurring, reminders). Plan paid through the Core (PAYMENTS_*
1290
+ // equal). No CORE_SERVICE_TOKEN (does not find people in the Core) and never the ADMIN_TOKEN. Expo app for the business.
1291
+ faturas: {
1292
+ id: 'faturas',
1293
+ name: 'Overture Faturas',
1294
+ templates: [
1295
+ 'overture-core/api/workers',
1296
+ 'overture-core/web/react',
1297
+ 'overture-core/app/react-native/packages',
1298
+ 'overture-core/app/react-native/tsconfig.base.json',
1299
+ 'overture-core/AUTH-API.md',
1300
+ 'overture-core/PAYMENTS-API.md',
1301
+ 'overture-core/THEME-API.md',
1302
+ 'overture-faturas/api/workers',
1303
+ 'overture-faturas/app/react-native',
1304
+ // pages in the Core panel (found by glob; no node_modules of their own)
1305
+ 'overture-faturas/web/react',
1306
+ 'overture-faturas/README.md',
1307
+ ],
1308
+ installDirs: ['overture-core/api/workers', 'overture-faturas/api/workers', 'overture-core/web/react', 'overture-faturas/app/react-native'],
1309
+ d1: [
1310
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
1311
+ { key: 'faturas', suffix: 'faturas', dir: 'overture-faturas/api/workers', migrations: 'migrations' },
1312
+ ],
1313
+ r2: [{ key: 'files', suffix: 'faturas-files', binding: 'FILES' }],
1314
+ queues: [],
1315
+ api: { suffix: 'faturas', dir: 'overture-faturas/api/workers', d1Key: 'faturas', health: '/' },
1316
+ pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
1317
+ app: { dir: 'overture-faturas/app/react-native', apiEnv: 'EXPO_PUBLIC_FATURAS_API_URL' },
1318
+ prebuild: null,
1319
+ generatedSecrets: {
1320
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
1321
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
1322
+ },
1323
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
1324
+ cron: '23 * * * *',
1325
+ workerSecrets: (s) => ({
1326
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1327
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1328
+ ...(s.RESEND_API_KEY ? { RESEND_API_KEY: s.RESEND_API_KEY } : {}),
1329
+ }),
1330
+ workerVars: (a, urls, local) => ({
1331
+ CORE_URL: urls.auth,
1332
+ PRODUCT: 'faturas',
1333
+ // public links (quote, invoice, customer portal) go out at this address
1334
+ PUBLIC_URL: urls.api,
1335
+ // plan payment return (the web app only exists locally)
1336
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1337
+ // e-mails via Resend only with a sender; without it, recorded in notifications
1338
+ NOTIFY_MODE: local || !a.email.from ? 'log' : 'live',
1339
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1340
+ ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
1341
+ }),
1342
+ localDevVars: (_a, s, urls) => ({
1343
+ CORE_URL: urls.auth,
1344
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1345
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1346
+ PUBLIC_URL: urls.api,
1347
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1348
+ NOTIFY_MODE: 'log',
1349
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1350
+ }),
1351
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
1352
+ opera: false,
1353
+ customDomain: false,
1354
+ localPorts: ['auth', 'api', 'admin', 'app'],
1355
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-faturas/app/react-native/dist' },
1356
+ readme: {
1357
+ layout: (a, p) => `overture-core/api/workers ${a.slug}-auth — login (Core Auth) + pagamentos + D1 ${a.slug}-identity
1358
+ overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas do Faturas
1359
+ overture-core/app/react-native/packages tema (os links públicos e os PDFs usam as cores daqui), i18n, componentes e login
1360
+ overture-faturas/api/workers ${a.slug}-faturas — API + links públicos (orçamento, fatura, portal) + D1 ${a.slug}-faturas + R2 ${a.slug}-faturas-files (cron ${p.cron})
1361
+ overture-faturas/app/react-native o app da empresa (Expo: iOS, Android e web) — ${a.bundleId}
1362
+ overture-faturas/web/react páginas no painel (visão, empresas, documentos, planos, ajustes)
1363
+ scripts/dev-local.mjs pnpm dev
1364
+
1365
+ O Faturas faz orçamentos, faturas e cobranças; ele NÃO emite nota fiscal oficial (NF-e/NFS-e ou equivalente do país).`,
1366
+ run: {
1367
+ pt: '`pnpm dev` sobe o login (Core Auth, com PAGAMENTOS simulados), o Worker do Faturas (os links públicos em `http://localhost:<porta da api>/…`, os PDFs no R2 local, o cron de hora em hora em `/__scheduled`), o painel com as páginas do Faturas e o app web da empresa. Os e-mails ficam gravados (NOTIFY_MODE=log). Sem Opera. Só funciona numa instalação feita com `--target local`.',
1368
+ es: '`pnpm dev` levanta el acceso (Core Auth, con PAGOS simulados), el Worker de Facturas (los enlaces públicos en `http://localhost:<puerto de la api>/…`, los PDF en el R2 local, el cron de cada hora en `/__scheduled`), el panel con las páginas de Facturas y la app web de la empresa. Los e-mails quedan grabados (NOTIFY_MODE=log). Sin Opera. Solo funciona en una instalación hecha con `--target local`.',
1369
+ en: '`pnpm dev` starts the login (Core Auth, with SIMULATED payments), the Invoices Worker (public links at `http://localhost:<api port>/…`, PDFs in the local R2, the hourly cron at `/__scheduled`), the panel with the Invoices pages and the company web app. E-mails are only recorded (NOTIFY_MODE=log). No Opera. Only for an installation made with `--target local`.',
1370
+ },
1371
+ },
1372
+ finalNext: ['final.next.faturas', 'final.next.faturasNoFiscal'],
1373
+ },
1374
+ // Overture Cursos: recorded courses (README → "For the installer"). Video and PDFs in R2 (FILES, multipart upload up to 2 GB),
1375
+ // delivered by signed link (VIDEO_SIGNING_KEY, ≥ 32, generated; changing it = open links stop) — not DRM. The
1376
+ // PDF certificate uses the Core's OFL fonts by path (rules Data **/*.ttf in the template's wrangler.jsonc). Sales and
1377
+ // subscription through the Core (PAYMENTS_* equal); no CORE_SERVICE_TOKEN and never the ADMIN_TOKEN. Hourly cron (17 min).
1378
+ // Expo app for the student and the teacher; the web app goes to Pages `<app>-app` (APP_URL = the payment return on the web).
1379
+ // Optional Ilorb class chat (one invite-only group per live course; teacher + students with access): ILORB_* only with the key.
1380
+ cursos: {
1381
+ id: 'cursos',
1382
+ name: 'Overture Cursos',
1383
+ templates: [
1384
+ 'overture-core/api/workers',
1385
+ 'overture-core/web/react',
1386
+ // the Core app packages: theme, i18n, ui, auth — and the fonts the certificate embeds
1387
+ 'overture-core/app/react-native/packages',
1388
+ 'overture-core/app/react-native/tsconfig.base.json',
1389
+ 'overture-core/AUTH-API.md',
1390
+ 'overture-core/PAYMENTS-API.md',
1391
+ 'overture-core/THEME-API.md',
1392
+ 'overture-cursos/api/workers',
1393
+ 'overture-cursos/app/react-native',
1394
+ // pages in the Core panel (found by glob; no node_modules of their own)
1395
+ 'overture-cursos/web/react',
1396
+ 'overture-cursos/README.md',
1397
+ // class chat (@ilorb/signal-server in the Worker, @ilorb/signal-chat + uikit in the app)
1398
+ ...ILORB_SDK_TEMPLATES,
1399
+ ],
1400
+ installDirs: ['overture-core/api/workers', 'overture-cursos/api/workers', 'overture-core/web/react', 'overture-cursos/app/react-native'],
1401
+ d1: [
1402
+ { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
1403
+ // 0001 schema · 0002 editions · 0003 class chat (course groups and their members)
1404
+ { key: 'cursos', suffix: 'cursos', dir: 'overture-cursos/api/workers', migrations: 'migrations' },
1405
+ ],
1406
+ r2: [{ key: 'files', suffix: 'cursos-files', binding: 'FILES' }],
1407
+ queues: [],
1408
+ api: { suffix: 'cursos', dir: 'overture-cursos/api/workers', d1Key: 'cursos', health: '/v1/health' },
1409
+ pages: [
1410
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
1411
+ // the student app on the web (expo export)
1412
+ { key: 'app', suffix: 'app', dir: 'overture-cursos/app/react-native' },
1413
+ ],
1414
+ app: { dir: 'overture-cursos/app/react-native', apiEnv: 'EXPO_PUBLIC_CURSOS_API_URL' },
1415
+ prebuild: null,
1416
+ generatedSecrets: {
1417
+ PAYMENTS_TOKEN: () => 'pay_' + b64url(24),
1418
+ PAYMENTS_CALLBACK_SECRET: () => 'pcb_' + b64url(32),
1419
+ // signs the video/PDF links (≥ 32): changing it = all open links stop immediately
1420
+ VIDEO_SIGNING_KEY: () => 'vsk_' + b64url(32),
1421
+ },
1422
+ coreSecrets: ['PAYMENTS_TOKEN', 'PAYMENTS_CALLBACK_SECRET'],
1423
+ cron: '17 * * * *',
1424
+ workerSecrets: (s) => ({
1425
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1426
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1427
+ VIDEO_SIGNING_KEY: s.VIDEO_SIGNING_KEY,
1428
+ // class chat: the Ilorb App secret, only when the buyer has the key (otherwise the chat stays off)
1429
+ ...(s.OPERA_APP_SECRET ? { ILORB_APP_SECRET: s.OPERA_APP_SECRET } : {}),
1430
+ }),
1431
+ workerVars: (a, urls) => ({
1432
+ CORE_URL: urls.auth,
1433
+ PRODUCT: 'cursos',
1434
+ ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
1435
+ // this Worker: signed video links, certificate /verify, payment return
1436
+ PUBLIC_URL: urls.api,
1437
+ // the web app: payment return on the web
1438
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1439
+ VIDEO_URL_TTL: '7200',
1440
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1441
+ }),
1442
+ localDevVars: (a, s, urls) => ({
1443
+ CORE_URL: urls.auth,
1444
+ PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
1445
+ PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
1446
+ VIDEO_SIGNING_KEY: s.VIDEO_SIGNING_KEY,
1447
+ PUBLIC_URL: urls.api,
1448
+ ...(urls.app ? { APP_URL: urls.app } : {}),
1449
+ VIDEO_URL_TTL: '7200',
1450
+ CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1451
+ // class chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
1452
+ ...(a.opera.appId && s.OPERA_APP_SECRET
1453
+ ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
1454
+ : {}),
1455
+ }),
1456
+ core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
1457
+ opera: false,
1458
+ ilorbOptional: true,
1459
+ customDomain: false,
1460
+ localPorts: ['auth', 'api', 'admin', 'app'],
1461
+ localStatic: { admin: 'overture-core/web/react/dist', app: 'overture-cursos/app/react-native/dist' },
1462
+ readme: {
1463
+ layout: (a, p) => `overture-core/api/workers ${a.slug}-auth — login (Core Auth) + pagamentos + D1 ${a.slug}-identity
1464
+ overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas dos Cursos
1465
+ overture-core/app/react-native/packages tema, i18n, componentes, login — e as fontes OFL do certificado em PDF
1466
+ overture-cursos/api/workers ${a.slug}-cursos — API + links assinados do vídeo + /verify + D1 ${a.slug}-cursos + R2 ${a.slug}-cursos-files (cron ${p.cron})
1467
+ overture-cursos/app/react-native o app do aluno e do professor (Expo: iOS, Android e web → Pages ${a.slug}-app) — ${a.bundleId}
1468
+ overture-cursos/web/react páginas no painel (visão, cursos, matrículas, certificados, professores, cupons, ajustes)
1469
+ scripts/dev-local.mjs pnpm dev`,
1470
+ run: {
1471
+ pt: '`pnpm dev` sobe o login (Core Auth, com PAGAMENTOS simulados), o Worker dos Cursos (vídeos e PDFs no R2 local, o cron de hora em hora em `/__scheduled`), o painel com as páginas dos Cursos e o app web do aluno. Sem Opera. Na nuvem: R2 `{files}` (o vídeo mora lá — ativar o R2 pede forma de pagamento mesmo na faixa grátis) e o app web no Pages `{app}`. A proteção do vídeo é link assinado + marca d\'água, não DRM. Só funciona numa instalação feita com `--target local`.',
1472
+ es: '`pnpm dev` levanta el acceso (Core Auth, con PAGOS simulados), el Worker de Cursos (videos y PDF en el R2 local, el cron de cada hora en `/__scheduled`), el panel con las páginas de Cursos y la app web del alumno. Sin Opera. En la nube: R2 `{files}` (el video vive ahí — activar el R2 pide forma de pago incluso en la capa gratis) y la app web en el Pages `{app}`. La protección del video es enlace firmado + marca de agua, no DRM. Solo funciona en una instalación hecha con `--target local`.',
1473
+ en: '`pnpm dev` starts the login (Core Auth, with SIMULATED payments), the Courses Worker (videos and PDFs in the local R2, the hourly cron at `/__scheduled`), the panel with the Courses pages and the student web app. No Opera. In the cloud: R2 `{files}` (the video lives there — enabling R2 asks for a payment method even on the free tier) and the web app on the `{app}` Pages. Video protection is a signed link + watermark, not DRM. Only for an installation made with `--target local`.',
1474
+ },
1475
+ },
1476
+ finalNext: ['final.next.cursos'],
1477
+ },
1478
+ };
1479
+ /** custom domain (status.empresa.com): host only, no scheme or path */
1480
+ export const DOMAIN_RE = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
1481
+ /** What is NEVER copied from the templates package (dependencies, builds, local state, secrets, screenshots). */
1482
+ export const COPY_EXCLUDE = new Set([
1483
+ 'node_modules', '.wrangler', 'dist', '.expo', 'web-build', 'coverage', 'screenshots', '.e2e-state', '.git',
1484
+ '.dev.vars', '.env', '.env.local', '.DS_Store', '.turbo', '.vite',
1485
+ ]);
1486
+ export const COPY_EXCLUDE_RE = [/\.log$/, /^\.env\..*(?<!\.example)$/, /\.tsbuildinfo$/];
1487
+ export const LOCALES = ['pt', 'es', 'en', 'ar'];
1488
+ /** what a new installation gets by default (owner, 13/11/2026): English + Portuguese; es/ar stay available via --languages */
1489
+ export const DEFAULT_LOCALES = ['en', 'pt'];
1490
+ // ─── names ──────────────────────────────────────────────────────────────────────────────────
1491
+ /** "Meu Chat Ação!" → "meu-chat-acao" (Worker/D1/Pages name: lowercase, digits and hyphen). */
1492
+ export function slugify(name, max = 40) {
1493
+ const s = name
1494
+ .normalize('NFKD')
1495
+ .replace(/[̀-ͯ]/g, '')
1496
+ .toLowerCase()
1497
+ .replace(/[^a-z0-9]+/g, '-')
1498
+ .replace(/^-+|-+$/g, '')
1499
+ .slice(0, max)
1500
+ .replace(/-+$/g, '');
1501
+ if (!s)
1502
+ return 'app';
1503
+ return /^[a-z]/.test(s) ? s : `app-${s}`.slice(0, max);
1504
+ }
1505
+ const FREE_MAIL = new Set([
1506
+ 'gmail.com', 'googlemail.com', 'hotmail.com', 'outlook.com', 'live.com', 'yahoo.com', 'yahoo.com.br', 'icloud.com',
1507
+ 'me.com', 'proton.me', 'protonmail.com', 'bol.com.br', 'uol.com.br', 'terra.com.br', 'exemplo.com', 'example.com', 'aol.com', 'gmx.com',
1508
+ ]);
1509
+ const seg = (s) => {
1510
+ const v = s.toLowerCase().replace(/[^a-z0-9]/g, '');
1511
+ return v ? (/^[a-z]/.test(v) ? v : `a${v}`) : '';
1512
+ };
1513
+ /** com.empresa.app — from the owner's e-mail domain (reversed) + the app name. Webmail → com.<app>.app */
1514
+ export function suggestBundleId(ownerEmail, slug) {
1515
+ const domain = ownerEmail.split('@')[1]?.toLowerCase() ?? '';
1516
+ const app = seg(slug) || 'app';
1517
+ if (!domain || FREE_MAIL.has(domain))
1518
+ return `com.${app}.app`;
1519
+ const parts = domain.split('.').filter(Boolean);
1520
+ // registrable domain reversed: acme.com → com.acme ; acme.com.br → br.com.acme ; mail.acme.io → io.acme
1521
+ const take = parts.length >= 3 && parts[parts.length - 2].length <= 3 ? 3 : 2;
1522
+ const reg = parts.slice(-take).reverse().map(seg).filter(Boolean);
1523
+ return [...(reg.length >= 2 ? reg : ['com', ...reg]), app].join('.');
1524
+ }
1525
+ /** Applies to iOS (bundleIdentifier) and Android (package): ≥2 parts, each starts with a letter, only [a-z0-9_]. */
1526
+ export const BUNDLE_RE = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/;
1527
+ export const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
1528
+ export const HEX_RE = /^#?[0-9a-fA-F]{6}$/;