@react-consulting/rc-kit 0.0.0-stage → 0.13.1
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.
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/devkit/README.md +301 -0
- package/devkit/cli.test.ts +211 -0
- package/devkit/cli.ts +120 -0
- package/devkit/commands/build.ts +127 -0
- package/devkit/commands/checks.ts +123 -0
- package/devkit/commands/context.ts +47 -0
- package/devkit/commands/db.ts +154 -0
- package/devkit/commands/deploy.ts +46 -0
- package/devkit/commands/dev.ts +191 -0
- package/devkit/commands/doctor.ts +25 -0
- package/devkit/commands/kit.ts +45 -0
- package/devkit/commands/new.ts +81 -0
- package/devkit/commands/registry.ts +20 -0
- package/devkit/commands/secrets.ts +254 -0
- package/devkit/lib/args.ts +65 -0
- package/devkit/lib/audit.test.ts +405 -0
- package/devkit/lib/audit.ts +813 -0
- package/devkit/lib/config.test.ts +203 -0
- package/devkit/lib/config.ts +417 -0
- package/devkit/lib/database/index.test.ts +223 -0
- package/devkit/lib/database/index.ts +314 -0
- package/devkit/lib/database/neon.test.ts +233 -0
- package/devkit/lib/database/neon.ts +357 -0
- package/devkit/lib/database/prepare.ts +54 -0
- package/devkit/lib/deploy-config.test.ts +217 -0
- package/devkit/lib/deploy-config.ts +133 -0
- package/devkit/lib/deploy.test.ts +275 -0
- package/devkit/lib/deploy.ts +177 -0
- package/devkit/lib/dev-gateway.test.ts +128 -0
- package/devkit/lib/dev-gateway.ts +162 -0
- package/devkit/lib/dev-menu.test.ts +114 -0
- package/devkit/lib/dev-menu.ts +332 -0
- package/devkit/lib/dev-secrets.test.ts +156 -0
- package/devkit/lib/dev-secrets.ts +97 -0
- package/devkit/lib/dev.test.ts +194 -0
- package/devkit/lib/dev.ts +119 -0
- package/devkit/lib/doctor.test.ts +144 -0
- package/devkit/lib/doctor.ts +264 -0
- package/devkit/lib/env-file.test.ts +102 -0
- package/devkit/lib/env-file.ts +96 -0
- package/devkit/lib/glob.ts +31 -0
- package/devkit/lib/infisical.test.ts +208 -0
- package/devkit/lib/infisical.ts +139 -0
- package/devkit/lib/json-schema.ts +220 -0
- package/devkit/lib/jsonc.test.ts +53 -0
- package/devkit/lib/jsonc.ts +93 -0
- package/devkit/lib/kit-migrate.test.ts +215 -0
- package/devkit/lib/kit-migrate.ts +624 -0
- package/devkit/lib/kit-package.test.ts +83 -0
- package/devkit/lib/kit-package.ts +57 -0
- package/devkit/lib/kit-version.ts +22 -0
- package/devkit/lib/naming.test.ts +547 -0
- package/devkit/lib/naming.ts +796 -0
- package/devkit/lib/paths.ts +7 -0
- package/devkit/lib/process.ts +78 -0
- package/devkit/lib/project-checks.ts +86 -0
- package/devkit/lib/scaffold.test.ts +302 -0
- package/devkit/lib/scaffold.ts +315 -0
- package/devkit/lib/secrets.test.ts +101 -0
- package/devkit/lib/secrets.ts +125 -0
- package/devkit/lib/sourcemaps.test.ts +86 -0
- package/devkit/lib/sourcemaps.ts +98 -0
- package/devkit/lib/test-utils.ts +68 -0
- package/devkit/lib/workspace.ts +87 -0
- package/devkit/lib/wrangler.ts +231 -0
- package/docs/rc-config.md +93 -0
- package/package.json +86 -4
- package/presets/build.d.ts +15 -0
- package/presets/build.js +53 -0
- package/presets/vite-plus.d.ts +28 -0
- package/presets/vite-plus.js +153 -0
- package/registry/README.md +294 -0
- package/registry/public/r/avatar-stack.json +18 -0
- package/registry/public/r/avatar.json +20 -0
- package/registry/public/r/back-link.json +21 -0
- package/registry/public/r/badge.json +17 -0
- package/registry/public/r/button.json +18 -0
- package/registry/public/r/calendar-days.json +14 -0
- package/registry/public/r/calendar-popover.json +24 -0
- package/registry/public/r/calendar.json +23 -0
- package/registry/public/r/callout.json +20 -0
- package/registry/public/r/card.json +18 -0
- package/registry/public/r/character-counter.json +17 -0
- package/registry/public/r/checkbox.json +22 -0
- package/registry/public/r/choice-cards.json +22 -0
- package/registry/public/r/color-tag.json +17 -0
- package/registry/public/r/combobox.json +24 -0
- package/registry/public/r/confirm-button.json +24 -0
- package/registry/public/r/confirm-dialog.json +23 -0
- package/registry/public/r/copy-button.json +24 -0
- package/registry/public/r/date-picker.json +24 -0
- package/registry/public/r/date-range-picker.json +28 -0
- package/registry/public/r/detail-header.json +17 -0
- package/registry/public/r/detail-row.json +17 -0
- package/registry/public/r/dev-inbox-api.json +33 -0
- package/registry/public/r/dev-toolbar.json +109 -0
- package/registry/public/r/dev-tools-contract.json +15 -0
- package/registry/public/r/dialog.json +23 -0
- package/registry/public/r/empty-state.json +20 -0
- package/registry/public/r/error-state.json +23 -0
- package/registry/public/r/eyebrow.json +17 -0
- package/registry/public/r/fab.json +20 -0
- package/registry/public/r/field-error.json +17 -0
- package/registry/public/r/field-grid.json +17 -0
- package/registry/public/r/field.json +19 -0
- package/registry/public/r/file-picker.json +22 -0
- package/registry/public/r/filter-chips.json +17 -0
- package/registry/public/r/form-section.json +17 -0
- package/registry/public/r/form-sheet.json +22 -0
- package/registry/public/r/icon-button.json +23 -0
- package/registry/public/r/input.json +18 -0
- package/registry/public/r/label.json +18 -0
- package/registry/public/r/list-row.json +17 -0
- package/registry/public/r/loading-state.json +18 -0
- package/registry/public/r/localized-field.json +23 -0
- package/registry/public/r/markdown-text.json +17 -0
- package/registry/public/r/menu.json +21 -0
- package/registry/public/r/money-input.json +17 -0
- package/registry/public/r/month-day-select.json +18 -0
- package/registry/public/r/numbered-step.json +20 -0
- package/registry/public/r/page-actions.json +14 -0
- package/registry/public/r/page-header.json +17 -0
- package/registry/public/r/pending.json +17 -0
- package/registry/public/r/person-option.json +21 -0
- package/registry/public/r/popover.json +20 -0
- package/registry/public/r/progress-bar.json +17 -0
- package/registry/public/r/query-view.json +22 -0
- package/registry/public/r/registry.json +1352 -0
- package/registry/public/r/retry-button.json +21 -0
- package/registry/public/r/rich-text-editor.json +32 -0
- package/registry/public/r/save-bar.json +22 -0
- package/registry/public/r/search-input.json +23 -0
- package/registry/public/r/search-select.json +24 -0
- package/registry/public/r/section-tabs.json +17 -0
- package/registry/public/r/segmented.json +18 -0
- package/registry/public/r/select.json +23 -0
- package/registry/public/r/sheet.json +24 -0
- package/registry/public/r/skeleton.json +17 -0
- package/registry/public/r/spinner.json +20 -0
- package/registry/public/r/stale-notice.json +23 -0
- package/registry/public/r/stat-tile.json +23 -0
- package/registry/public/r/stepper.json +23 -0
- package/registry/public/r/suggestion-strip.json +21 -0
- package/registry/public/r/swatch-picker.json +22 -0
- package/registry/public/r/switch.json +21 -0
- package/registry/public/r/tabs.json +20 -0
- package/registry/public/r/textarea.json +18 -0
- package/registry/public/r/theme.json +15 -0
- package/registry/public/r/timezone-select.json +19 -0
- package/registry/public/r/toaster.json +21 -0
- package/registry/public/r/tooltip.json +17 -0
- package/registry/public/r/ui-labels.json +14 -0
- package/registry/public/r/use-copy-to-clipboard.json +20 -0
- package/registry/public/r/use-online.json +14 -0
- package/registry/public/r/use-stale-queries.json +17 -0
- package/registry/public/r/utils.json +18 -0
- package/registry/public/r/weekday-picker.json +19 -0
- package/registry/public/r/yes-no.json +20 -0
- package/registry/serve.ts +29 -0
- package/rules/architecture.md +47 -0
- package/rules/cloudflare.md +74 -0
- package/rules/code.md +12 -0
- package/rules/git.md +10 -0
- package/rules/index.md +14 -0
- package/rules/observability.md +13 -0
- package/rules/performance.md +39 -0
- package/rules/runtime.md +9 -0
- package/rules/secrets.md +11 -0
- package/rules/stack.md +33 -0
- package/rules/ui.md +23 -0
- package/runtime/ai.test.ts +106 -0
- package/runtime/ai.ts +125 -0
- package/runtime/observability/allowlists.ts +42 -0
- package/runtime/observability/anonymize.test.ts +111 -0
- package/runtime/observability/anonymize.ts +249 -0
- package/runtime/observability/browser.test.ts +46 -0
- package/runtime/observability/browser.ts +126 -0
- package/runtime/observability/server.test.ts +84 -0
- package/runtime/observability/server.ts +152 -0
- package/runtime/observability/tunnel.test.ts +276 -0
- package/runtime/observability/tunnel.ts +360 -0
- package/runtime/observability/user-agent.ts +51 -0
- package/schema/rc.config.schema.json +333 -0
- package/template/.gitattributes +1 -0
- package/template/.github/workflows/ci.yml +64 -0
- package/template/CLAUDE.md +48 -0
- package/template/README.md +50 -0
- package/template/apps/admin/.dev.vars.example +5 -0
- package/template/apps/admin/components.json +24 -0
- package/template/apps/admin/package.json +48 -0
- package/template/apps/admin/public/favicon.svg +1 -0
- package/template/apps/admin/src/components/app-shell.tsx +41 -0
- package/template/apps/admin/src/components/dev-sign-in-links.tsx +57 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-context.ts +13 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-environment-panel.tsx +105 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-list.tsx +54 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-message.tsx +104 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-inbox-panel.tsx +130 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-launcher.tsx +45 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-panel.tsx +90 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar-types.ts +11 -0
- package/template/apps/admin/src/components/dev-toolbar/dev-toolbar.tsx +61 -0
- package/template/apps/admin/src/components/dev-toolbar/development-devtools.tsx +32 -0
- package/template/apps/admin/src/components/login-form.tsx +115 -0
- package/template/apps/admin/src/components/login-sent.tsx +23 -0
- package/template/apps/admin/src/components/message-list.tsx +44 -0
- package/template/apps/admin/src/components/turnstile-challenge.tsx +140 -0
- package/template/apps/admin/src/components/ui/button.tsx +87 -0
- package/template/apps/admin/src/components/ui/callout.tsx +84 -0
- package/template/apps/admin/src/components/ui/card.tsx +48 -0
- package/template/apps/admin/src/components/ui/eyebrow.tsx +33 -0
- package/template/apps/admin/src/components/ui/field-error.tsx +24 -0
- package/template/apps/admin/src/components/ui/field.tsx +100 -0
- package/template/apps/admin/src/components/ui/input.tsx +73 -0
- package/template/apps/admin/src/components/ui/label.tsx +39 -0
- package/template/apps/admin/src/components/ui/skeleton.tsx +225 -0
- package/template/apps/admin/src/components/ui/spinner.tsx +12 -0
- package/template/apps/admin/src/components/ui/toaster.tsx +33 -0
- package/template/apps/admin/src/components/ui/tooltip.tsx +51 -0
- package/template/apps/admin/src/hooks/use-dev-inbox.ts +25 -0
- package/template/apps/admin/src/hooks/use-dev-toolbar-state.ts +48 -0
- package/template/apps/admin/src/lib/api.ts +39 -0
- package/template/apps/admin/src/lib/auth-client.ts +7 -0
- package/template/apps/admin/src/lib/dev-inbox-links.ts +66 -0
- package/template/apps/admin/src/lib/dev-tools-client.ts +54 -0
- package/template/apps/admin/src/lib/dev-tools-contract.ts +52 -0
- package/template/apps/admin/src/lib/messages.ts +5 -0
- package/template/apps/admin/src/lib/query-keys.ts +3 -0
- package/template/apps/admin/src/lib/security-headers.ts +18 -0
- package/template/apps/admin/src/lib/session.ts +27 -0
- package/template/apps/admin/src/lib/site-url.ts +7 -0
- package/template/apps/admin/src/lib/turnstile.ts +70 -0
- package/template/apps/admin/src/lib/ui-labels.tsx +182 -0
- package/template/apps/admin/src/lib/utils.ts +6 -0
- package/template/apps/admin/src/routeTree.gen.ts +109 -0
- package/template/apps/admin/src/router.tsx +29 -0
- package/template/apps/admin/src/routes/__root.tsx +56 -0
- package/template/apps/admin/src/routes/_app/index.tsx +38 -0
- package/template/apps/admin/src/routes/_app.tsx +26 -0
- package/template/apps/admin/src/routes/login.tsx +48 -0
- package/template/apps/admin/src/styles/app.css +11 -0
- package/template/apps/admin/src/worker.ts +88 -0
- package/template/apps/admin/tsconfig.json +19 -0
- package/template/apps/admin/vite.config.ts +69 -0
- package/template/apps/admin/wrangler.jsonc +92 -0
- package/template/apps/web/.env.example +1 -0
- package/template/apps/web/astro.config.ts +46 -0
- package/template/apps/web/package.json +33 -0
- package/template/apps/web/public/favicon.svg +1 -0
- package/template/apps/web/src/components/ContactForm.astro +78 -0
- package/template/apps/web/src/env.d.ts +11 -0
- package/template/apps/web/src/layouts/BaseLayout.astro +32 -0
- package/template/apps/web/src/lib/api.ts +8 -0
- package/template/apps/web/src/pages/api/messages.ts +32 -0
- package/template/apps/web/src/pages/index.astro +26 -0
- package/template/apps/web/src/pages/media/[...key].ts +4 -0
- package/template/apps/web/src/scripts/contact-form.ts +105 -0
- package/template/apps/web/src/scripts/error-reporting.ts +4 -0
- package/template/apps/web/src/scripts/turnstile.ts +177 -0
- package/template/apps/web/src/styles/global.css +11 -0
- package/template/apps/web/src/worker.ts +34 -0
- package/template/apps/web/tsconfig.json +11 -0
- package/template/apps/web/wrangler.jsonc +45 -0
- package/template/bun.lock +1925 -0
- package/template/bunfig.toml +2 -0
- package/template/gitignore +23 -0
- package/template/package.json +74 -0
- package/template/packages/api/components.json +21 -0
- package/template/packages/api/package.json +30 -0
- package/template/packages/api/src/client.ts +13 -0
- package/template/packages/api/src/cloudflare-env.d.ts +26 -0
- package/template/packages/api/src/emails/escape-html.ts +13 -0
- package/template/packages/api/src/emails/layout.ts +22 -0
- package/template/packages/api/src/emails/magic-link.ts +32 -0
- package/template/packages/api/src/emails/new-message.ts +32 -0
- package/template/packages/api/src/emails/send.ts +14 -0
- package/template/packages/api/src/lib/auth-guard.ts +16 -0
- package/template/packages/api/src/lib/auth.ts +108 -0
- package/template/packages/api/src/lib/context.ts +7 -0
- package/template/packages/api/src/lib/dev-inbox/routes.ts +77 -0
- package/template/packages/api/src/lib/dev-inbox/send.ts +57 -0
- package/template/packages/api/src/lib/dev-inbox/store.ts +185 -0
- package/template/packages/api/src/lib/dev-inbox.ts +6 -0
- package/template/packages/api/src/lib/dev-tools-contract.ts +52 -0
- package/template/packages/api/src/lib/environment.ts +17 -0
- package/template/packages/api/src/lib/turnstile.ts +33 -0
- package/template/packages/api/src/media.ts +45 -0
- package/template/packages/api/src/routes/admin-messages.ts +21 -0
- package/template/packages/api/src/routes/dev.ts +31 -0
- package/template/packages/api/src/routes/health.ts +7 -0
- package/template/packages/api/src/routes/messages.ts +58 -0
- package/template/packages/api/src/schemas.ts +18 -0
- package/template/packages/api/src/server.ts +29 -0
- package/template/packages/api/tsconfig.json +10 -0
- package/template/packages/db/migrations/0001_init.sql +79 -0
- package/template/packages/db/package.json +34 -0
- package/template/packages/db/prisma/schema.prisma +95 -0
- package/template/packages/db/prisma.config.ts +9 -0
- package/template/packages/db/scripts/migrate.ts +15 -0
- package/template/packages/db/scripts/new-migration.ts +185 -0
- package/template/packages/db/scripts/reset.ts +54 -0
- package/template/packages/db/scripts/seed.ts +44 -0
- package/template/packages/db/scripts/wrangler.ts +35 -0
- package/template/packages/db/src/d1.ts +7 -0
- package/template/packages/db/src/migration-guard.test.ts +43 -0
- package/template/packages/db/src/migration-guard.ts +51 -0
- package/template/packages/db/src/new-migration.test.ts +16 -0
- package/template/packages/db/src/scope.ts +38 -0
- package/template/packages/db/src/seed.ts +30 -0
- package/template/packages/db/src/sql.ts +42 -0
- package/template/packages/db/tsconfig.json +8 -0
- package/template/packages/shared/components.json +21 -0
- package/template/packages/shared/package.json +33 -0
- package/template/packages/shared/src/edge/origins.ts +20 -0
- package/template/packages/shared/src/edge/turnstile.ts +11 -0
- package/template/packages/shared/src/locales.ts +13 -0
- package/template/packages/shared/src/message-rules.ts +16 -0
- package/template/packages/shared/src/messages.test.ts +26 -0
- package/template/packages/shared/src/messages.ts +30 -0
- package/template/packages/shared/src/observability/build-release.ts +9 -0
- package/template/packages/shared/src/observability/error-reporting.ts +31 -0
- package/template/packages/shared/src/observability/error-tunnel.ts +20 -0
- package/template/packages/shared/src/observability/sentry-browser.ts +1 -0
- package/template/packages/shared/src/observability/server-errors.ts +74 -0
- package/template/packages/shared/src/project.ts +1 -0
- package/template/packages/shared/src/styles/rc-theme.css +138 -0
- package/template/packages/shared/src/styles/theme.css +9 -0
- package/template/packages/shared/tsconfig.json +10 -0
- package/template/rc.config.json +25 -0
- package/template/scripts/bootstrap-local.ts +42 -0
- package/template/tsconfig.base.json +20 -0
- package/template/tsconfig.json +8 -0
- package/template/tsconfig.worker.json +7 -0
- package/template/turbo.json +40 -0
- package/template/vite.config.ts +8 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "rc.config.json",
|
|
4
|
+
"description": "Configuration d'un projet lue par la CLI rc (@react-consulting/rc-kit). Des noms uniquement, jamais une valeur secrète.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["project", "prefix", "account", "apps", "infisical"],
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string" },
|
|
10
|
+
"project": {
|
|
11
|
+
"description": "Slug du projet.",
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
14
|
+
},
|
|
15
|
+
"kit": {
|
|
16
|
+
"description": "Version de @react-consulting/rc-kit attendue, en plage semver (\">=0.13.0\") ; rc refuse de tourner avec une version installée plus ancienne.",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
"prefix": {
|
|
21
|
+
"description": "Préfixe Cloudflare de 3 lettres, unique sur tous les comptes.",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^[a-z]{3}$"
|
|
24
|
+
},
|
|
25
|
+
"account": {
|
|
26
|
+
"description": "Clé de l'entité propriétaire du projet (en minuscules et tirets) : elle fixe ensemble le compte Cloudflare, l'organisation GitHub et l'organisation Sentry. check:naming vérifie que chaque wrangler.jsonc déclare le même account_id.",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
29
|
+
},
|
|
30
|
+
"apps": {
|
|
31
|
+
"description": "Workers du projet ; la clé est le rôle du Worker.",
|
|
32
|
+
"type": "object",
|
|
33
|
+
"minProperties": 1,
|
|
34
|
+
"propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
|
|
35
|
+
"additionalProperties": { "$ref": "#/$defs/app" }
|
|
36
|
+
},
|
|
37
|
+
"infisical": {
|
|
38
|
+
"description": "Projet Infisical qui porte les secrets (identifiant non secret) : rc secrets:pull lit l'environnement dev, rc secrets:push l'environnement de chaque déploiement.",
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["projectId"],
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"properties": {
|
|
43
|
+
"projectId": {
|
|
44
|
+
"description": "Identifiant (UUID) du projet Infisical.",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
47
|
+
},
|
|
48
|
+
"environments": {
|
|
49
|
+
"description": "Slug de l'environnement Infisical par clé d'environnement rc. Par défaut : dev → dev, production → prod, sinon la même clé.",
|
|
50
|
+
"type": "object",
|
|
51
|
+
"propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
|
|
52
|
+
"additionalProperties": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"sentry": {
|
|
60
|
+
"description": "Organisation et projets Sentry (noms non secrets) : scripts/upload-sourcemaps.ts y lit où envoyer les source maps de chaque app.",
|
|
61
|
+
"type": "object",
|
|
62
|
+
"required": ["org", "projects"],
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"properties": {
|
|
65
|
+
"org": {
|
|
66
|
+
"description": "Slug de l'organisation Sentry.",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
69
|
+
},
|
|
70
|
+
"url": {
|
|
71
|
+
"description": "Région Sentry, https://de.sentry.io/ par défaut.",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"pattern": "^https://"
|
|
74
|
+
},
|
|
75
|
+
"projects": {
|
|
76
|
+
"description": "Slug du projet Sentry par app (clé de apps).",
|
|
77
|
+
"type": "object",
|
|
78
|
+
"minProperties": 1,
|
|
79
|
+
"additionalProperties": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"devEnvFiles": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": { "$ref": "#/$defs/devEnvFile" }
|
|
89
|
+
},
|
|
90
|
+
"naming": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"properties": {
|
|
94
|
+
"legacy": {
|
|
95
|
+
"description": "Noms existants hors convention, tolérés par rc check:naming.",
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": { "type": "string", "minLength": 1 },
|
|
98
|
+
"uniqueItems": true
|
|
99
|
+
},
|
|
100
|
+
"externalWorkers": {
|
|
101
|
+
"description": "Workers d'un autre projet qu'un binding de service peut viser (par exemple l'admin d'une plateforme pour un site client).",
|
|
102
|
+
"type": "array",
|
|
103
|
+
"items": { "type": "string", "minLength": 1 },
|
|
104
|
+
"uniqueItems": true
|
|
105
|
+
},
|
|
106
|
+
"clients": {
|
|
107
|
+
"description": "Préfixe de chaque client d'un produit mono-tenant, par clé d'environnement Wrangler.",
|
|
108
|
+
"type": "object",
|
|
109
|
+
"propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
|
|
110
|
+
"additionalProperties": { "type": "string", "pattern": "^[a-z]{3}$" }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"dev": {
|
|
115
|
+
"description": "Services de développement lancés par rc dev.",
|
|
116
|
+
"type": "object",
|
|
117
|
+
"required": ["targets"],
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"properties": {
|
|
120
|
+
"targets": {
|
|
121
|
+
"description": "Services démarrables : la clé est le nom donné à la CLI, path le dossier du service (script dev via turbo).",
|
|
122
|
+
"type": "object",
|
|
123
|
+
"minProperties": 1,
|
|
124
|
+
"propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
|
|
125
|
+
"additionalProperties": { "$ref": "#/$defs/devTarget" }
|
|
126
|
+
},
|
|
127
|
+
"presets": {
|
|
128
|
+
"description": "Ensembles de services nommés, lancés d'un coup (rc dev web).",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
|
|
131
|
+
"additionalProperties": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": { "type": "string" },
|
|
134
|
+
"uniqueItems": true
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"defaultPreset": {
|
|
138
|
+
"description": "Préréglage présélectionné dans le menu et lancé hors terminal.",
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"bootstrap": {
|
|
142
|
+
"description": "Commande (argv) lancée avant les services, sauf avec --no-bootstrap.",
|
|
143
|
+
"type": "array",
|
|
144
|
+
"minItems": 1,
|
|
145
|
+
"items": { "type": "string" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"database": {
|
|
150
|
+
"description": "Bases du projet, pilotées par rc db:* et rc dev. La production et la dev sont toujours deux bases séparées.",
|
|
151
|
+
"type": "object",
|
|
152
|
+
"required": ["provider"],
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"properties": {
|
|
155
|
+
"provider": {
|
|
156
|
+
"description": "neon (Postgres) ou d1 (Cloudflare D1).",
|
|
157
|
+
"enum": ["neon", "d1"]
|
|
158
|
+
},
|
|
159
|
+
"envFile": {
|
|
160
|
+
"description": "Fichier env local où rc db:env écrit les chaînes de connexion. Défaut : .env.local.",
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1
|
|
163
|
+
},
|
|
164
|
+
"migrate": {
|
|
165
|
+
"description": "Commande qui applique les migrations. Défaut neon : bun x prisma migrate deploy dans packages/db ; défaut d1 : wrangler d1 migrations apply dans le dossier de d1.app.",
|
|
166
|
+
"$ref": "#/$defs/databaseCommand"
|
|
167
|
+
},
|
|
168
|
+
"seed": {
|
|
169
|
+
"description": "Commande de seed, lancée par rc db:seed.",
|
|
170
|
+
"$ref": "#/$defs/databaseCommand"
|
|
171
|
+
},
|
|
172
|
+
"neon": {
|
|
173
|
+
"description": "Projets Neon. Production : un projet à la seule branche main. Dev : un projet <production>-dev, dont main est réservée à la préproduction ; development sert à la branche git main, feature/<branche> à toute autre branche git.",
|
|
174
|
+
"type": "object",
|
|
175
|
+
"required": ["production"],
|
|
176
|
+
"additionalProperties": false,
|
|
177
|
+
"properties": {
|
|
178
|
+
"production": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"required": ["projectId", "projectName"],
|
|
181
|
+
"additionalProperties": false,
|
|
182
|
+
"properties": {
|
|
183
|
+
"projectId": {
|
|
184
|
+
"description": "Identifiant du projet Neon de production (non secret).",
|
|
185
|
+
"type": "string",
|
|
186
|
+
"pattern": "^[a-z0-9-]+$"
|
|
187
|
+
},
|
|
188
|
+
"projectName": {
|
|
189
|
+
"description": "Nom du projet Neon de production, à taper pour confirmer une commande --production.",
|
|
190
|
+
"type": "string",
|
|
191
|
+
"pattern": "^[a-z0-9-]+$"
|
|
192
|
+
},
|
|
193
|
+
"endpointId": {
|
|
194
|
+
"description": "Compute de la branche main de production (ep-…), vérifié avant toute commande --production.",
|
|
195
|
+
"type": "string",
|
|
196
|
+
"pattern": "^ep-[a-z0-9-]+$"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"devProjectName": {
|
|
201
|
+
"description": "Nom du projet Neon de dev. Défaut : <production.projectName>-dev.",
|
|
202
|
+
"type": "string",
|
|
203
|
+
"pattern": "^[a-z0-9-]+$"
|
|
204
|
+
},
|
|
205
|
+
"featureBranchTtlDays": {
|
|
206
|
+
"description": "Durée de vie d'une branche feature/*, en jours. Défaut : 14.",
|
|
207
|
+
"type": "number"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"d1": {
|
|
212
|
+
"description": "Base D1 : binding déclaré dans le wrangler.jsonc de l'app.",
|
|
213
|
+
"type": "object",
|
|
214
|
+
"required": ["app", "binding"],
|
|
215
|
+
"additionalProperties": false,
|
|
216
|
+
"properties": {
|
|
217
|
+
"app": {
|
|
218
|
+
"description": "Clé de apps qui déclare la base.",
|
|
219
|
+
"type": "string"
|
|
220
|
+
},
|
|
221
|
+
"binding": {
|
|
222
|
+
"description": "Nom du binding D1.",
|
|
223
|
+
"type": "string",
|
|
224
|
+
"pattern": "^[A-Z][A-Z0-9_]*$"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"$defs": {
|
|
232
|
+
"databaseCommand": {
|
|
233
|
+
"type": "object",
|
|
234
|
+
"required": ["command"],
|
|
235
|
+
"additionalProperties": false,
|
|
236
|
+
"properties": {
|
|
237
|
+
"command": {
|
|
238
|
+
"description": "Commande (argv), lancée avec DATABASE_URL de la base visée.",
|
|
239
|
+
"type": "array",
|
|
240
|
+
"minItems": 1,
|
|
241
|
+
"items": { "type": "string" }
|
|
242
|
+
},
|
|
243
|
+
"cwd": {
|
|
244
|
+
"description": "Dossier de la commande, relatif à la racine du projet.",
|
|
245
|
+
"type": "string",
|
|
246
|
+
"minLength": 1
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"devTarget": {
|
|
251
|
+
"type": "object",
|
|
252
|
+
"required": ["path", "label"],
|
|
253
|
+
"additionalProperties": false,
|
|
254
|
+
"properties": {
|
|
255
|
+
"path": { "type": "string", "minLength": 1 },
|
|
256
|
+
"label": {
|
|
257
|
+
"description": "Libellé affiché dans le menu.",
|
|
258
|
+
"type": "string",
|
|
259
|
+
"minLength": 1
|
|
260
|
+
},
|
|
261
|
+
"url": {
|
|
262
|
+
"description": "Adresse de dev affichée dans le menu.",
|
|
263
|
+
"type": "string",
|
|
264
|
+
"minLength": 1
|
|
265
|
+
},
|
|
266
|
+
"companions": {
|
|
267
|
+
"description": "Services lancés avec celui-ci.",
|
|
268
|
+
"type": "array",
|
|
269
|
+
"items": { "type": "string" },
|
|
270
|
+
"uniqueItems": true
|
|
271
|
+
},
|
|
272
|
+
"host": {
|
|
273
|
+
"description": "Cible qui exécute celle-ci dans son propre processus (plusieurs Workers dans un même wrangler dev) : rc dev démarre l'hôte et lui passe les cibles hébergées dans RC_DEV_HOSTED.",
|
|
274
|
+
"type": "string",
|
|
275
|
+
"minLength": 1
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"app": {
|
|
280
|
+
"type": "object",
|
|
281
|
+
"required": ["path"],
|
|
282
|
+
"additionalProperties": false,
|
|
283
|
+
"properties": {
|
|
284
|
+
"path": {
|
|
285
|
+
"description": "Dossier du Worker (contient wrangler.jsonc).",
|
|
286
|
+
"type": "string",
|
|
287
|
+
"minLength": 1
|
|
288
|
+
},
|
|
289
|
+
"dependsOn": {
|
|
290
|
+
"description": "Workers à déployer avant celui-ci.",
|
|
291
|
+
"type": "array",
|
|
292
|
+
"items": { "type": "string" },
|
|
293
|
+
"uniqueItems": true
|
|
294
|
+
},
|
|
295
|
+
"optionalSecrets": {
|
|
296
|
+
"description": "Champs de la note poussés sur ce Worker par rc secrets:push quand la note a une valeur, en plus de secrets.required.",
|
|
297
|
+
"type": "array",
|
|
298
|
+
"items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
|
|
299
|
+
"uniqueItems": true
|
|
300
|
+
},
|
|
301
|
+
"localOnlyBindings": {
|
|
302
|
+
"description": "Bindings du niveau local qu'aucun déploiement ne déclare (base d'un site de démonstration) : rc check:deploy-config ne les exige pas dans env.<nom> et refuse qu'un déploiement les déclare.",
|
|
303
|
+
"type": "array",
|
|
304
|
+
"items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
|
|
305
|
+
"uniqueItems": true
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"devEnvFile": {
|
|
310
|
+
"type": "object",
|
|
311
|
+
"required": ["path"],
|
|
312
|
+
"additionalProperties": false,
|
|
313
|
+
"properties": {
|
|
314
|
+
"path": { "type": "string", "minLength": 1 },
|
|
315
|
+
"include": {
|
|
316
|
+
"description": "Motifs glob des clés à écrire (toutes par défaut).",
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": { "type": "string", "minLength": 1 }
|
|
319
|
+
},
|
|
320
|
+
"exclude": {
|
|
321
|
+
"description": "Motifs glob des clés à ne pas écrire.",
|
|
322
|
+
"type": "array",
|
|
323
|
+
"items": { "type": "string", "minLength": 1 }
|
|
324
|
+
},
|
|
325
|
+
"generate": {
|
|
326
|
+
"description": "Clés générées sur le poste (32 octets aléatoires en base64) quand elles n'ont pas de valeur.",
|
|
327
|
+
"type": "array",
|
|
328
|
+
"items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" }
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- "docs/**"
|
|
7
|
+
- "**/*.md"
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
paths-ignore:
|
|
11
|
+
- "docs/**"
|
|
12
|
+
- "**/*.md"
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ci-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
env:
|
|
23
|
+
TURBO_TELEMETRY_DISABLED: "1"
|
|
24
|
+
|
|
25
|
+
# No build or dry-run deploy: Workers Builds builds and deploys every Worker on each push to main.
|
|
26
|
+
jobs:
|
|
27
|
+
quality:
|
|
28
|
+
name: Quality
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
timeout-minutes: 20
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
33
|
+
|
|
34
|
+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
35
|
+
with:
|
|
36
|
+
bun-version-file: package.json
|
|
37
|
+
|
|
38
|
+
- uses: voidzero-dev/setup-vp@cab1ab9eaff52d4857875f4f2c016e36af8f2c76 # v1.22.0
|
|
39
|
+
with:
|
|
40
|
+
node-version: "24"
|
|
41
|
+
cache: true
|
|
42
|
+
|
|
43
|
+
- name: Install
|
|
44
|
+
run: bun install --frozen-lockfile
|
|
45
|
+
|
|
46
|
+
- name: Restore turbo cache
|
|
47
|
+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
|
48
|
+
with:
|
|
49
|
+
path: .turbo/cache
|
|
50
|
+
key: turbo-${{ runner.os }}-${{ github.sha }}
|
|
51
|
+
restore-keys: |
|
|
52
|
+
turbo-${{ runner.os }}-
|
|
53
|
+
|
|
54
|
+
- name: Generate Prisma client
|
|
55
|
+
run: bun run db:generate
|
|
56
|
+
|
|
57
|
+
- name: Lint
|
|
58
|
+
run: bun run lint
|
|
59
|
+
|
|
60
|
+
- name: Typecheck
|
|
61
|
+
run: bun run check:types
|
|
62
|
+
|
|
63
|
+
- name: Test
|
|
64
|
+
run: bun run test
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@node_modules/@react-consulting/rc-kit/rules/index.md
|
|
2
|
+
|
|
3
|
+
# RC Template
|
|
4
|
+
|
|
5
|
+
Projet généré depuis le modèle de `@react-consulting/rc-kit` : un site public et un back office sur Cloudflare Workers, l'API vit dans l'admin (duo de `rules/architecture.md`).
|
|
6
|
+
|
|
7
|
+
## Structure
|
|
8
|
+
|
|
9
|
+
```txt
|
|
10
|
+
apps/web Worker tpl-web-* — site Astro (SSR) ; accueil + formulaire de contact relayé à l'admin
|
|
11
|
+
apps/admin Worker tpl-admin-* — back office TanStack Start, API Elysia /api/*, Better Auth /api/auth/*, médias R2 /media/* ; seul à lire D1, R2 et les secrets
|
|
12
|
+
|
|
13
|
+
packages/api app Elysia (routes, schémas TypeBox, Better Auth, e-mails, boîte de dev), client Eden
|
|
14
|
+
packages/db schéma Prisma (D1), migrations SQL, scripts locaux migrate / seed / reset
|
|
15
|
+
packages/shared origines et ports, clés Turnstile publiques, contrat des messages (Zod), locales, thème CSS (tokens)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Le site lit tout par le binding `API` (`apps/web/src/lib/api.ts`). Le formulaire poste sur `POST /api/messages` du site, qui valide le contrat (`@tpl/shared/messages`) et relaie au binding ; `GET /media/*` est relayé de la même façon.
|
|
19
|
+
- L'admin route lui-même `/media/*`, `/api/auth/*` et `/api/*` (`apps/admin/src/worker.ts`) et crée un client Prisma par requête depuis `DB` (`withPrismaClient`) ; le reste du code le lit par `prisma` de `packages/api/src/lib/context.ts`.
|
|
20
|
+
- Erreurs (Sentry, `rules/observability.md`) : chaque Worker est enveloppé par `withErrorTracking` et relaie le navigateur par `POST /api/telemetry/errors` ; couche mince dans `packages/shared/src/observability/`, inactive hors production.
|
|
21
|
+
- Thème : `packages/shared/src/styles/theme.css` relie les tokens sémantiques à la palette (neutre par défaut), importé par les deux apps.
|
|
22
|
+
|
|
23
|
+
## Commandes
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bun install
|
|
27
|
+
bun run bootstrap:local # apps/admin/.dev.vars, client Prisma, migrations D1 locales, données de démo
|
|
28
|
+
bun dev # rc secrets:pull puis web http://localhost:4321 + admin http://localhost:3000
|
|
29
|
+
bun run lint # rc check:naming, rc check:deploy-config, vp lint, vp fmt --check
|
|
30
|
+
bun run check:types
|
|
31
|
+
bun run test
|
|
32
|
+
bun run build
|
|
33
|
+
bun run db:generate # après une modification de packages/db/prisma/schema.prisma
|
|
34
|
+
bun run db:migrate:new <nom> # écrit packages/db/migrations/NNNN_<nom>.sql par diff du schéma
|
|
35
|
+
bun run db:migrate # local ; ALLOW_MIGRATE_ON=production bun run db:migrate production pour la prod
|
|
36
|
+
bun run db:seed # données de démo, local uniquement
|
|
37
|
+
bun run deploy # rc deploy all : admin puis web
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Spécificités
|
|
41
|
+
|
|
42
|
+
- Connexion au back office par magic link uniquement (`packages/api/src/lib/auth.ts`) : seules les adresses de la var `ADMIN_EMAILS` reçoivent un lien, la réponse est identique pour les autres et un hook refuse la création de tout autre compte.
|
|
43
|
+
- En local, se connecter par la dev toolbar (bouton « Dev » de l'admin) : onglet Environnement, « Lien de connexion », puis « Me connecter » dans la boîte mail.
|
|
44
|
+
- Chaque message reçu notifie les `ADMIN_EMAILS` (boîte de dev en local).
|
|
45
|
+
- Registre `@rc` : `apps/admin/components.json` pointe sur `http://localhost:4873/r/{name}.json`, servi par `bunx rc registry`.
|
|
46
|
+
- Copies du registre : `apps/admin` (`components/ui`, `components/dev-toolbar`, hooks et lib de la barre), `packages/api` (`@rc/dev-inbox-api` dans `src/lib/dev-inbox`) et `packages/shared` (`@rc/theme` → `src/styles/rc-theme.css`, surchargé par `theme.css`). Mise à jour : `bunx shadcn@latest add @rc/<nom> --overwrite` dans le dossier concerné, puis relire le diff.
|
|
47
|
+
- L'action « Lien de connexion » de la barre de dev est propre au projet : `apps/admin/src/components/dev-sign-in-links.tsx` et la route `/api/dev/accounts`.
|
|
48
|
+
- Production : domaine `example.com`, clé Turnstile `TURNSTILE_SITE_KEY` (`packages/shared/src/edge/turnstile.ts`) et id D1 de `apps/admin/wrangler.jsonc` sont des placeholders (voir README).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# RC Template
|
|
2
|
+
|
|
3
|
+
Modèle de départ de `@react-consulting/rc-kit` : site public Astro et back office TanStack Start sur Cloudflare Workers, API Elysia, Better Auth (magic link), Prisma sur D1, Base UI, Vite+. Il suit les règles de `rules/` du kit.
|
|
4
|
+
|
|
5
|
+
## Créer un projet
|
|
6
|
+
|
|
7
|
+
Choisir d'abord un préfixe de 3 lettres qu'aucun autre projet n'utilise, puis, depuis un projet où `@react-consulting/rc-kit` est installé :
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bunx rc new <slug> --name <slug> --prefix <pfx> --title "<Titre>" --account <entité> --account-id <id du compte Cloudflare> --sentry-org <organisation Sentry>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`rc new` copie ce dossier (sans `node_modules` ni état local) et remplace les jetons du modèle : préfixe Cloudflare, `account_id`, scope npm des workspaces, slug du projet et titre ; `@react-consulting/rc-kit` est déclaré à la version qui a lancé `rc new`. Le nouveau projet est ensuite autonome : ce README et le CLAUDE.md lui appartiennent.
|
|
14
|
+
|
|
15
|
+
## Premiers pas
|
|
16
|
+
|
|
17
|
+
1. **Installer et démarrer en local**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun install
|
|
21
|
+
bun run bootstrap:local # .dev.vars, client Prisma, migrations D1 locales, données de démo
|
|
22
|
+
bun dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Site sur http://localhost:4321, back office sur http://localhost:3000. Le lien de connexion arrive dans la dev toolbar (bouton « Dev » de l'admin).
|
|
26
|
+
|
|
27
|
+
2. **Projet Infisical** : créer le projet `<slug>` (ou demander son identifiant), avec les environnements `dev` et `prod`, et y mettre une clé par variable de `apps/admin/.dev.vars.example` (`BETTER_AUTH_SECRET`, `TURNSTILE_SECRET_KEY`) et de `secrets.required` d'`apps/admin/wrangler.jsonc`. Écrire l'identifiant dans `infisical.projectId` de `rc.config.json`. `bun dev` écrit ensuite les secrets de l'environnement `dev` par `rc secrets:pull` (CLI `infisical`, connectée par `infisical login`).
|
|
28
|
+
|
|
29
|
+
3. **Ressources Cloudflare** sur le compte Cloudflare de l'entité (celui de `account_id`), nommées selon la convention :
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bunx wrangler d1 create <pfx>-d1-prod # reporter l'id dans env.production de apps/admin/wrangler.jsonc, activer la réplication en lecture
|
|
33
|
+
bunx wrangler r2 bucket create <pfx>-media-prod
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Créer aussi le widget Turnstile `<pfx>-turnstile` (hostnames du site et de l'admin), reporter sa clé publique dans `packages/shared/src/edge/turnstile.ts` et son secret dans l'environnement `prod` du projet Infisical, puis activer le domaine d'envoi de `EMAIL_FROM` dans Cloudflare Email Service.
|
|
37
|
+
|
|
38
|
+
4. **Domaine** : remplacer `example.com` dans `packages/shared/src/edge/origins.ts` et dans `env.production` des deux `wrangler.jsonc` (routes, `PUBLIC_SITE_URL`, `ADMIN_URL`, `EMAIL_FROM`), ainsi que `ADMIN_EMAILS`.
|
|
39
|
+
|
|
40
|
+
5. **Sentry** : créer les projets `<pfx>-admin` et `<pfx>-web` dans l'organisation de `sentry.org` (`rc.config.json`), coller le DSN de chacun dans `SENTRY_DSN`, `SENTRY_TUNNEL_DSNS` et `VITE_SENTRY_DSN` / `PUBLIC_SENTRY_DSN` d'`env.production` de son `wrangler.jsonc`, puis mettre `SENTRY_AUTH_TOKEN` dans l'environnement `prod` d'Infisical et en variable de build Workers Builds des deux Workers.
|
|
41
|
+
|
|
42
|
+
6. **Mise en production**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bun run secrets:push admin production
|
|
46
|
+
ALLOW_MIGRATE_ON=production bun run db:migrate production
|
|
47
|
+
bun run deploy # admin puis web
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Commandes et conventions du projet : [CLAUDE.md](./CLAUDE.md).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Written by `rc secrets:pull` from the Infisical project's dev environment, or by `bun run bootstrap:local`.
|
|
2
|
+
# Better Auth: `openssl rand -base64 32`.
|
|
3
|
+
BETTER_AUTH_SECRET=
|
|
4
|
+
# Cloudflare's always-passing Turnstile test secret.
|
|
5
|
+
TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles/app.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {
|
|
22
|
+
"@rc": "http://localhost:4873/r/{name}.json"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tpl/admin",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "MIMALLOC_ALLOW_THP=0 vp dev",
|
|
8
|
+
"build": "vp build",
|
|
9
|
+
"build:cloudflare": "rc ci:only migrate:cloudflare && bun --cwd=../../packages/db run db:generate && vp build && rc sentry:sourcemaps --app admin --directory dist/client --delete-maps && rc sentry:sourcemaps --app admin --directory dist/server",
|
|
10
|
+
"check:types": "tsgo --noEmit --pretty false",
|
|
11
|
+
"migrate:cloudflare": "ALLOW_MIGRATE_ON=\"$CLOUDFLARE_ENV\" bun --cwd=../../packages/db run db:migrate \"$CLOUDFLARE_ENV\"",
|
|
12
|
+
"deploy:cloudflare": "wrangler deploy",
|
|
13
|
+
"upload:cloudflare": "wrangler versions upload"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@base-ui/react": "catalog:",
|
|
17
|
+
"@tanstack/react-query": "catalog:",
|
|
18
|
+
"@tanstack/react-router": "^1.170.46",
|
|
19
|
+
"@tanstack/react-start": "^1.169.5",
|
|
20
|
+
"@tpl/api": "workspace:*",
|
|
21
|
+
"@tpl/db": "workspace:*",
|
|
22
|
+
"@tpl/shared": "workspace:*",
|
|
23
|
+
"better-auth": "catalog:",
|
|
24
|
+
"clsx": "^2.1.1",
|
|
25
|
+
"lucide-react": "^1.71.0",
|
|
26
|
+
"react": "catalog:",
|
|
27
|
+
"react-dom": "catalog:",
|
|
28
|
+
"sonner": "^2.0.8",
|
|
29
|
+
"tailwind-merge": "^3.7.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@cloudflare/vite-plugin": "catalog:",
|
|
33
|
+
"@cloudflare/workers-types": "catalog:",
|
|
34
|
+
"@react-consulting/rc-kit": "link:../..",
|
|
35
|
+
"@sentry/cli": "^3.8.2",
|
|
36
|
+
"@tailwindcss/vite": "catalog:",
|
|
37
|
+
"@types/bun": "catalog:",
|
|
38
|
+
"@types/react": "catalog:",
|
|
39
|
+
"@types/react-dom": "catalog:",
|
|
40
|
+
"@typescript/native-preview": "catalog:",
|
|
41
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
42
|
+
"tailwindcss": "catalog:",
|
|
43
|
+
"typescript": "catalog:",
|
|
44
|
+
"vite": "catalog:",
|
|
45
|
+
"vite-plus": "catalog:",
|
|
46
|
+
"wrangler": "catalog:"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="8" fill="#27272a"/><path d="M10 22V10h7a4 4 0 0 1 0 8h-7m7 0 5 4" fill="none" stroke="#fafafa" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PROJECT_TITLE } from "@tpl/shared/project"
|
|
2
|
+
import { useNavigate } from "@tanstack/react-router"
|
|
3
|
+
import { LogOut } from "lucide-react"
|
|
4
|
+
import type { ReactNode } from "react"
|
|
5
|
+
import { Button } from "@/components/ui/button"
|
|
6
|
+
import { authClient } from "@/lib/auth-client"
|
|
7
|
+
import type { TSessionUser } from "@/lib/session"
|
|
8
|
+
|
|
9
|
+
export interface TAppShellProps {
|
|
10
|
+
user: TSessionUser
|
|
11
|
+
children: ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function AppShell({ user, children }: TAppShellProps) {
|
|
15
|
+
const navigate = useNavigate()
|
|
16
|
+
|
|
17
|
+
async function signOut() {
|
|
18
|
+
await authClient.signOut()
|
|
19
|
+
await navigate({ to: "/login" })
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="min-h-dvh bg-paper">
|
|
24
|
+
<header className="border-b border-line bg-surface">
|
|
25
|
+
<div className="mx-auto flex h-14 max-w-4xl items-center justify-between gap-4 px-4">
|
|
26
|
+
<p className="font-display text-sm font-semibold">{PROJECT_TITLE}</p>
|
|
27
|
+
<div className="flex items-center gap-3">
|
|
28
|
+
<span className="hidden text-sm text-ink-3 sm:inline">
|
|
29
|
+
{user.email}
|
|
30
|
+
</span>
|
|
31
|
+
<Button size="sm" variant="ghost" onClick={signOut}>
|
|
32
|
+
<LogOut aria-hidden="true" className="size-4" />
|
|
33
|
+
Déconnexion
|
|
34
|
+
</Button>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</header>
|
|
38
|
+
<main className="mx-auto max-w-4xl px-4 py-8">{children}</main>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|