fimo 0.14.0 → 0.15.0-staging.2

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.
Files changed (199) hide show
  1. package/README.md +1 -0
  2. package/assets/astro/components/Boolean.astro +14 -0
  3. package/assets/astro/components/Date.astro +23 -0
  4. package/assets/astro/components/Image.astro +79 -0
  5. package/assets/astro/components/Json.astro +14 -0
  6. package/assets/astro/components/RichText.astro +17 -0
  7. package/assets/astro/components/StaticImage.astro +66 -0
  8. package/assets/astro/components/Text.astro +23 -0
  9. package/assets/astro/components/Video.astro +47 -0
  10. package/assets/astro/components/index.d.ts +8 -0
  11. package/assets/astro/components/index.js +8 -0
  12. package/assets/content-templates/shared/server.eta +56 -0
  13. package/assets/content-templates/sveltekit/content.eta +86 -0
  14. package/assets/skills/fimo/SKILL.md +13 -4
  15. package/assets/skills/fimo-cli/SKILL.md +28 -28
  16. package/assets/skills/fimo-cli/references/account.md +0 -2
  17. package/assets/skills/fimo-cli/references/agent-setup.md +7 -9
  18. package/assets/skills/fimo-cli/references/agents.md +0 -2
  19. package/assets/skills/fimo-cli/references/analytics.md +0 -2
  20. package/assets/skills/fimo-cli/references/assets.md +2 -4
  21. package/assets/skills/fimo-cli/references/branches.md +14 -15
  22. package/assets/skills/fimo-cli/references/content.md +9 -11
  23. package/assets/skills/fimo-cli/references/credits.md +0 -2
  24. package/assets/skills/fimo-cli/references/deploy.md +6 -7
  25. package/assets/skills/fimo-cli/references/describe.md +1 -3
  26. package/assets/skills/fimo-cli/references/domains.md +0 -2
  27. package/assets/skills/fimo-cli/references/forms.md +5 -7
  28. package/assets/skills/fimo-cli/references/history.md +0 -2
  29. package/assets/skills/fimo-cli/references/init.md +34 -26
  30. package/assets/skills/fimo-cli/references/integrations/firecrawl.md +0 -2
  31. package/assets/skills/fimo-cli/references/integrations.md +0 -2
  32. package/assets/skills/fimo-cli/references/invite.md +0 -2
  33. package/assets/skills/fimo-cli/references/labels.md +5 -7
  34. package/assets/skills/fimo-cli/references/locales.md +2 -4
  35. package/assets/skills/fimo-cli/references/mcp.md +2 -4
  36. package/assets/skills/fimo-cli/references/media.md +0 -2
  37. package/assets/skills/fimo-cli/references/preview.md +0 -2
  38. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +1 -3
  39. package/assets/skills/fimo-cli/references/projects.md +1 -3
  40. package/assets/skills/fimo-cli/references/schedules.md +0 -2
  41. package/assets/skills/fimo-cli/references/support.md +0 -2
  42. package/assets/skills/fimo-cli/references/webhooks.md +0 -2
  43. package/assets/skills/fimo-code/SKILL.md +11 -3
  44. package/assets/skills/fimo-code/references/assets.md +2 -2
  45. package/assets/skills/fimo-code/references/content/clients.md +5 -1
  46. package/assets/skills/fimo-code/references/content.md +3 -1
  47. package/assets/skills/fimo-code/references/frameworks/astro.md +127 -0
  48. package/assets/skills/fimo-code/references/frameworks/compatibility.md +19 -0
  49. package/assets/skills/fimo-code/references/frameworks/hosting.md +15 -3
  50. package/assets/skills/fimo-code/references/frameworks/react-router.md +37 -209
  51. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +110 -0
  52. package/assets/skills/fimo-code/references/frameworks/vite-react.md +35 -166
  53. package/assets/skills/fimo-code/references/labels.md +16 -6
  54. package/assets/skills/fimo-code/references/locales.md +3 -1
  55. package/assets/skills/fimo-code/references/ui.md +19 -15
  56. package/assets/skills/fimo-migration/SKILL.md +99 -146
  57. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +26 -0
  58. package/assets/skills/fimo-migration/references/inventory/coordinator.md +40 -0
  59. package/assets/skills/fimo-migration/references/inventory/locales/next-intl.md +39 -0
  60. package/assets/skills/fimo-migration/references/inventory/locales.md +41 -0
  61. package/assets/skills/fimo-migration/references/workflow.md +3 -2
  62. package/assets/skills/fimo-migration/scripts/inventory/locales/next-intl.mjs +459 -0
  63. package/assets/skills/fimo-studio/SKILL.md +1 -1
  64. package/assets/skills/fimo-studio/references/project-creation.md +10 -18
  65. package/assets/starters/fimo-site/template/.fimo/agents/content-guide/capabilities.yaml +0 -1
  66. package/assets/starters/fimo-site/template/.fimo/agents/site-review/capabilities.yaml +0 -1
  67. package/assets/sveltekit/components/Boolean.svelte +19 -0
  68. package/assets/sveltekit/components/Date.svelte +33 -0
  69. package/assets/sveltekit/components/FimoProvider.svelte +35 -0
  70. package/assets/sveltekit/components/Image.svelte +80 -0
  71. package/assets/sveltekit/components/Json.svelte +18 -0
  72. package/assets/sveltekit/components/Label.svelte +16 -0
  73. package/assets/sveltekit/components/Number.svelte +21 -0
  74. package/assets/sveltekit/components/RichText.svelte +19 -0
  75. package/assets/sveltekit/components/Text.svelte +30 -0
  76. package/assets/sveltekit/components/Video.svelte +37 -0
  77. package/assets/sveltekit/components/index.d.ts +10 -0
  78. package/assets/sveltekit/components/index.js +10 -0
  79. package/dist/build/astro/config.d.ts +4 -0
  80. package/dist/build/astro/config.js +64 -0
  81. package/dist/build/next/config.js +16 -0
  82. package/dist/build/sveltekit/config.d.ts +6 -0
  83. package/dist/build/sveltekit/config.js +8 -0
  84. package/dist/build/sveltekit/data-id.d.ts +3 -0
  85. package/dist/build/sveltekit/data-id.js +171 -0
  86. package/dist/build/sveltekit/vite.d.ts +13 -0
  87. package/dist/build/sveltekit/vite.js +15 -0
  88. package/dist/build/vite/index.js +2 -0
  89. package/dist/build/vite/plugins/data-id.d.ts +9 -0
  90. package/dist/build/vite/plugins/data-id.js +6 -1
  91. package/dist/build/vite/plugins/runtime-env.d.ts +21 -0
  92. package/dist/build/vite/plugins/runtime-env.js +68 -0
  93. package/dist/cli/bundle.json +1 -1
  94. package/dist/cli/index.js +108 -101
  95. package/dist/runtime/app/FimoProviders.d.ts +1 -1
  96. package/dist/runtime/app/FimoProviders.js +11 -5
  97. package/dist/runtime/astro/internal.d.ts +6 -0
  98. package/dist/runtime/astro/internal.js +16 -0
  99. package/dist/runtime/astro/preview.d.ts +14 -0
  100. package/dist/runtime/astro/preview.js +103 -0
  101. package/dist/runtime/astro/render-rich-text.d.ts +2 -0
  102. package/dist/runtime/astro/render-rich-text.js +1 -0
  103. package/dist/runtime/astro/server-runtime.d.ts +3 -0
  104. package/dist/runtime/astro/server-runtime.js +20 -0
  105. package/dist/runtime/astro/server.d.ts +15 -0
  106. package/dist/runtime/astro/server.js +14 -0
  107. package/dist/runtime/content/client/collection-core.d.ts +2 -17
  108. package/dist/runtime/content/client/collection-core.js +15 -8
  109. package/dist/runtime/content/client/core-types.d.ts +96 -0
  110. package/dist/runtime/content/client/core-types.js +1 -0
  111. package/dist/runtime/content/client/internal.d.ts +4 -4
  112. package/dist/runtime/content/client/internal.js +4 -3
  113. package/dist/runtime/content/client/runtime.d.ts +1 -1
  114. package/dist/runtime/content/client/server-content-client.d.ts +3 -3
  115. package/dist/runtime/content/client/server-content-client.js +2 -29
  116. package/dist/runtime/content/client/singleton-core.d.ts +2 -9
  117. package/dist/runtime/content/client/singleton-core.js +9 -4
  118. package/dist/runtime/content/client/types.d.ts +5 -115
  119. package/dist/runtime/content/index.d.ts +3 -3
  120. package/dist/runtime/labels/fetch.js +5 -3
  121. package/dist/runtime/next/client.d.ts +2 -1
  122. package/dist/runtime/next/facade.d.ts +1 -1
  123. package/dist/runtime/next/provider.js +1 -1
  124. package/dist/runtime/next/server-runtime.js +1 -1
  125. package/dist/runtime/next/server.d.ts +5 -4
  126. package/dist/runtime/paths/get-fimo-paths.js +8 -3
  127. package/dist/runtime/preview/bridge.d.ts +8 -0
  128. package/dist/runtime/preview/bridge.js +20 -0
  129. package/dist/runtime/preview/location.d.ts +23 -0
  130. package/dist/runtime/preview/location.js +93 -0
  131. package/dist/runtime/preview/routes.d.ts +10 -0
  132. package/dist/runtime/preview/routes.js +29 -0
  133. package/dist/runtime/primitives/index.d.ts +4 -1
  134. package/dist/runtime/primitives/index.js +1 -0
  135. package/dist/runtime/primitives/lib/image-optimization.d.ts +27 -2
  136. package/dist/runtime/primitives/lib/image-optimization.js +40 -0
  137. package/dist/runtime/primitives/lib/index.d.ts +1 -1
  138. package/dist/runtime/primitives/lib/primitives.d.ts +0 -54
  139. package/dist/runtime/primitives/lib/primitives.js +6 -0
  140. package/dist/runtime/primitives/lib/render-rich-text.d.ts +3 -0
  141. package/dist/runtime/primitives/lib/render-rich-text.js +112 -0
  142. package/dist/runtime/react/primitives/contracts.d.ts +40 -2
  143. package/dist/runtime/react/primitives/renderers/ImageRenderer.js +15 -34
  144. package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +2 -1
  145. package/dist/runtime/react/primitives/renderers/StaticImage.js +13 -30
  146. package/dist/runtime/routing/AppRoutesProvider.js +20 -8
  147. package/dist/runtime/shared/env-identity.d.ts +43 -0
  148. package/dist/runtime/shared/env-identity.js +88 -0
  149. package/dist/runtime/shared/local-runtime-env.d.ts +65 -0
  150. package/dist/runtime/shared/local-runtime-env.js +169 -0
  151. package/dist/runtime/{react-router → shared}/preview-location.d.ts +7 -13
  152. package/dist/runtime/{react-router → shared}/preview-location.js +26 -27
  153. package/dist/runtime/sveltekit/content.d.ts +25 -0
  154. package/dist/runtime/sveltekit/content.js +33 -0
  155. package/dist/runtime/sveltekit/context-contract.d.ts +5 -0
  156. package/dist/runtime/sveltekit/context-contract.js +2 -0
  157. package/dist/runtime/sveltekit/context.d.ts +8 -0
  158. package/dist/runtime/sveltekit/context.js +25 -0
  159. package/dist/runtime/sveltekit/index.d.ts +7 -0
  160. package/dist/runtime/sveltekit/index.js +4 -0
  161. package/dist/runtime/sveltekit/internal.d.ts +6 -0
  162. package/dist/runtime/sveltekit/internal.js +12 -0
  163. package/dist/runtime/sveltekit/labels.d.ts +16 -0
  164. package/dist/runtime/sveltekit/labels.js +13 -0
  165. package/dist/runtime/sveltekit/preview.d.ts +19 -0
  166. package/dist/runtime/sveltekit/preview.js +77 -0
  167. package/dist/runtime/sveltekit/runtime.d.ts +8 -0
  168. package/dist/runtime/sveltekit/runtime.js +17 -0
  169. package/dist/runtime/templates.d.ts +1 -1
  170. package/dist/runtime/templates.js +1 -1
  171. package/dist/runtime/vite/Label.d.ts +13 -0
  172. package/dist/runtime/vite/Label.js +16 -0
  173. package/dist/scripts/extract-translations.js +103 -43
  174. package/dist/scripts/sync-forms.js +1 -1
  175. package/dist/scripts/sync-schemas.js +83 -16
  176. package/package.json +57 -2
  177. package/release.json +2 -2
  178. package/templates/nextjs/AGENTS.md +10 -5
  179. package/templates/nextjs/_gitignore +1 -0
  180. package/templates/react-router/AGENTS.md +4 -3
  181. package/templates/react-router/package.json +1 -1
  182. package/templates/sveltekit/.fimo/config.json +15 -0
  183. package/templates/sveltekit/AGENTS.md +36 -0
  184. package/templates/sveltekit/CLAUDE.md +5 -0
  185. package/templates/sveltekit/_gitignore +16 -0
  186. package/templates/sveltekit/package.json +28 -0
  187. package/templates/sveltekit/pnpm-workspace.yaml +4 -0
  188. package/templates/sveltekit/src/app.html +11 -0
  189. package/templates/sveltekit/src/routes/+layout.server.ts +8 -0
  190. package/templates/sveltekit/src/routes/+layout.svelte +12 -0
  191. package/templates/sveltekit/src/routes/+page.svelte +48 -0
  192. package/templates/sveltekit/svelte.config.js +5 -0
  193. package/templates/sveltekit/tsconfig.json +14 -0
  194. package/templates/sveltekit/vite.config.ts +5 -0
  195. /package/assets/content-templates/{form-template.eta → forms/react.eta} +0 -0
  196. /package/assets/content-templates/{next-client-template.eta → next/client.eta} +0 -0
  197. /package/assets/content-templates/{next-server-template.eta → next/server.eta} +0 -0
  198. /package/assets/content-templates/{hooks-template.eta → react/client.eta} +0 -0
  199. /package/assets/content-templates/{types-template.eta → shared/types.eta} +0 -0
@@ -1,7 +1,5 @@
1
1
  # Project Variables And Secrets
2
2
 
3
- > **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
4
-
5
3
  Use project variables for values that are safe to expose to the browser. Use project secrets for hidden values such as API keys, tokens, webhooks, and service credentials.
6
4
 
7
5
  There is no private-variable mode. If leaking the value would be a problem, use `fimo secrets`.
@@ -49,7 +47,7 @@ variables.
49
47
 
50
48
  ## Local Env Files
51
49
 
52
- `fimo init` writes `.env` with tenant content API URLs for Vite and Next runtimes. This lets the framework's normal dev command work without a Fimo wrapper.
50
+ `fimo init` and `fimo clone` write `.env` with the framework-specific tenant content API URLs needed for local development. These are Fimo-managed connection values, not project variables; users should not discover or set them manually.
53
51
 
54
52
  `fimo vars add`, `fimo vars update`, and `fimo vars pull` write public project variables to a managed block in `.env.local`.
55
53
 
@@ -1,7 +1,5 @@
1
1
  # Managing projects
2
2
 
3
- > **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
4
-
5
3
  Commands for listing projects across an org, cloning a remote project locally, and managing the lifecycle of a single project (delete, publish, unpublish, rename). Most lifecycle commands operate on the **current project** (read from `.fimo/project.json`, or the legacy `.fimo.settings.json`, in the cwd) by default; for `delete`, `publish`, and `unpublish` you can pass an explicit `[projectId]` to target another. (`rename` only edits the linked local project; see below.)
6
4
 
7
5
  ## The `fimo projects` namespace
@@ -29,7 +27,7 @@ fimo projects rename <name> [projectId] [-C <dir>] # set seo.siteName in the l
29
27
  fimo clone [projectId] [dir] [--env <name>] # same as `fimo projects clone`
30
28
  ```
31
29
 
32
- Use the top-level shortcut for the common "get this project onto my machine" workflow. After clone succeeds, `cd` into the printed directory, `Read` the project's `AGENTS.md`, and load the code skill with `npx fimo@latest skills get fimo-code` before generating code.
30
+ Use the top-level shortcut for the common "get this project onto my machine" workflow. After clone succeeds, `cd` into the printed directory, `Read` the project's `AGENTS.md`, and load the code skill with `fimo skills get fimo-code` before generating code.
33
31
 
34
32
  ## Top-level shortcuts (current project)
35
33
 
@@ -1,7 +1,5 @@
1
1
  # Scheduled Commands
2
2
 
3
- > **Run via `npx fimo@latest <command>`** - always the latest CLI, no install needed.
4
-
5
3
  `fimo schedules` manages recurring commands for one project environment. It uses the current checkout environment by default, or the environment passed with `--env <name>`.
6
4
 
7
5
  The command starts in that environment's sandbox. Commands can still target another environment explicitly, for example with `fimo schemas list --env preview`.
@@ -1,7 +1,5 @@
1
1
  # Reporting a problem to Fimo
2
2
 
3
- > **Run via `npx fimo@latest <command>`** - always the latest CLI, no install needed.
4
-
5
3
  `fimo support report` sends a project-scoped problem to Fimo support. It automatically includes the project, current environment, and CLI version so support can start investigating without asking the user to repeat that context.
6
4
 
7
5
  ## When to prepare it
@@ -1,7 +1,5 @@
1
1
  # Outbound webhooks
2
2
 
3
- > **Run via `npx fimo@latest <command>`** so the event catalog and delivery commands match the platform.
4
-
5
3
  > **Beta:** Test each destination and inspect its delivery history before depending on it in production.
6
4
 
7
5
  Use `fimo webhooks` to send project events to external HTTPS endpoints. The CLI and Studio edit the same project-wide configurations and delivery history. The CLI has no provider presets: inspect the destination's API documentation, then pass its URL, headers, and JSON body explicitly.
@@ -4,7 +4,7 @@ description: >-
4
4
  Write schema-first application code with the installed `fimo` package.
5
5
  Load when declaring content schemas or forms, using generated content
6
6
  clients, rendering Fimo primitives, reading labels, or integrating Fimo
7
- with Next.js, React Router, Vite, or another application framework. CLI
7
+ with Next.js, React Router, Vite, SvelteKit, or another application framework. CLI
8
8
  commands and operational workflows live in the `fimo-cli` skill.
9
9
  ---
10
10
 
@@ -30,7 +30,14 @@ Framework routing:
30
30
  - `nextjs` or an `app/`, `src/app/`, `pages/`, or `src/pages/` tree → `references/frameworks/next.md`, then the matching App Router or Pages Router reference.
31
31
  - React Router framework mode (`react-router.config.ts`, `src/routes.ts`) → `references/frameworks/react-router.md`.
32
32
  - Vite + React without framework mode → `references/frameworks/vite-react.md`.
33
- - Astro, Nuxt, Remix, SvelteKit, Vue, or another hosting-only setup → `references/frameworks/hosting.md`. The current content/primitives SDK is React-only; do not invent a framework adapter.
33
+ - Astro (`astro.config.*`, `src/pages/**/*.astro`) → `references/frameworks/astro.md`.
34
+ - SvelteKit → `references/frameworks/sveltekit.md`.
35
+ - Nuxt, Remix, Vue, or another hosting-only setup → `references/frameworks/hosting.md`. Do not invent an SDK adapter that the installed package does not export.
36
+
37
+ When a project's framework version is uncertain, load
38
+ `references/frameworks/compatibility.md`. Use the project's installed version
39
+ and the documented adapter range; do not assume that a framework profile means
40
+ every historical version is supported.
34
41
 
35
42
  ## Durable content contract
36
43
 
@@ -50,8 +57,9 @@ Each reference defines one package contract. Fetch it when the task reaches that
50
57
  - Tracked rendering: `Text`, `RichText`, `Image`, `FimoString`, `FimoMedia` → `references/ui.md`
51
58
  - Forms: JSON spec, generated Zod schema, `submit*` helpers → `references/forms.md`
52
59
  - Media values, `<Image>`, `<StaticImage>` → `references/assets.md`
53
- - Static editable copy: `t()`, `useLabels`, `getLabels` → `references/labels.md`
60
+ - Static editable copy: `Label`, `t()`, providers, and server label readers → `references/labels.md`
54
61
  - Locale ownership and framework handoff → `references/locales.md`
62
+ - Astro connector and output/adapter contract → `references/frameworks/astro.md`
55
63
  - Framework detection, production routing, and hosting adapters → `references/frameworks/hosting.md`
56
64
  - Major visual work → `references/design.md`
57
65
 
@@ -22,9 +22,9 @@ Asset values returned from `fimo assets upload` or Fimo media tasks, and stored
22
22
 
23
23
  Generated content reads wrap this stored value in `FimoMedia`, which exposes `url`, `alt`, `name`, `mime`, and optional `width`/`height`. It does not expose `source`; Fimo tracks that internally. Pass the whole entry value to `<Image>` / `<Video>`.
24
24
 
25
- ## Rendering in JSX
25
+ ## Rendering in application code
26
26
 
27
- Import the primitives from the active framework adapter: `fimo/next` on the Next server, `fimo/next/client` in Next Client Components, or `fimo/ui` in React Router/Vite.
27
+ Import the primitives from the active framework adapter: `fimo/next` on the Next server, `fimo/next/client` in Next Client Components, `fimo/ui` in React Router/Vite, or `fimo/astro/components` in Astro pages.
28
28
 
29
29
  | Asset source | Component | Pass via |
30
30
  | --------------------------------------------------- | --------------------- | ------------------------- |
@@ -2,7 +2,11 @@
2
2
 
3
3
  Application code imports the public modules generated from `src/schemas/<Uid>.json`, not `.types.ts` directly.
4
4
 
5
- The exact file split is framework-dependent. Load `references/frameworks/next.md`, `references/frameworks/react-router.md`, or `references/frameworks/vite-react.md` before choosing imports.
5
+ The exact file split is framework-dependent. Load the matching reference under
6
+ `references/frameworks/` before choosing imports. This includes the Next.js,
7
+ Astro, React Router, Vite React, and SvelteKit references. Astro modules are
8
+ server-only promise clients; the hooks below exist only in client-capable
9
+ frameworks.
6
10
 
7
11
  ## Entry shape
8
12
 
@@ -7,8 +7,10 @@ Load only what the task needs:
7
7
  - `references/content/schema.md` — schema JSON, field types, blocks, references, and safe transitions.
8
8
  - `references/content/richtext.md` — Tiptap JSONContent, entry payloads, and slug rules.
9
9
  - `references/content/clients.md` — generated collection/singleton clients, queries, projections, population, and locale behavior.
10
- - `references/ui.md` — source-tracked values and their React renderers.
10
+ - `references/ui.md` — source-tracked values and their framework renderers.
11
11
  - `references/frameworks/next.md` — Next App/Pages Router module boundaries.
12
+ - `references/frameworks/astro.md` — Astro server clients and native components.
13
+ - `references/frameworks/sveltekit.md` — request-bound clients, load serialization, native components, and labels.
12
14
  - `references/frameworks/react-router.md` — React Router framework-mode setup and imports.
13
15
  - `references/frameworks/vite-react.md` — Vite + React setup and imports.
14
16
 
@@ -0,0 +1,127 @@
1
+ # Astro integration
2
+
3
+ Use this reference for an existing Astro application. The application keeps its route files, output mode, adapter, locale system, links, `<html lang/dir>`, and SEO. Fimo connects content, labels, native rendering, preview, and hosting.
4
+
5
+ ## Setup
6
+
7
+ Declare the production framework in `.fimo/config.json`:
8
+
9
+ ```json
10
+ {
11
+ "runtime": { "framework": "astro" }
12
+ }
13
+ ```
14
+
15
+ Astro owns its static or server output, routes, and 404 behavior. Do not add a catch-all hosting rewrite, a hosting-provider adapter, a preview URL, or a script tag for Fimo.
16
+
17
+ Add the integration beside the adapters and integrations the project already uses:
18
+
19
+ ```js
20
+ import { defineConfig } from 'astro/config';
21
+ import { fimo } from 'fimo/astro/config';
22
+
23
+ export default defineConfig({
24
+ integrations: [fimo()],
25
+ });
26
+ ```
27
+
28
+ Compatibility: the Fimo peer range covers Astro 5–7. Static output is supported
29
+ across that range. Fimo's automatic server adapter path is currently validated
30
+ with the Astro 7-compatible adapter; Astro 5/6 server apps should keep their
31
+ existing adapter until a matching server adapter is supported.
32
+
33
+ `fimo()` loads the platform script only in Fimo previews, reports location to Studio, and performs full-page navigation when Studio changes routes. With `output: 'server'` and no adapter, it also supplies Fimo's hosted server adapter; it never replaces an adapter the application already owns for another deployment target.
34
+
35
+ Server reads use `FIMO_CONTENT_API_URL`. `fimo init` and `fimo clone` provide it locally; hosted preview and production inject it (alias table: `references/frameworks/hosting.md`).
36
+
37
+ ## Generated content
38
+
39
+ Declare content in `src/schemas/<Uid>.json` and apply each change with `fimo schemas push <Uid>` (workflow: `fimo-cli/references/content.md`). Astro receives one server-only `<Uid>.ts` public module plus `<Uid>.types.ts`. There are no `.client.ts` modules, React Query hooks, or browser content registry; reads run in frontmatter on the server.
40
+
41
+ ## Read and render
42
+
43
+ Use generated schema modules for data, `fimo/astro` for `getLabels` and the `fimo` template tag, and `fimo/astro/components` for native components:
44
+
45
+ ```astro
46
+ ---
47
+ import { fimo, getLabels } from 'fimo/astro';
48
+ import { Image, RichText, Text } from 'fimo/astro/components';
49
+
50
+ import * as SiteSettings from '../schemas/SiteSettings';
51
+ import * as Story from '../schemas/Story';
52
+
53
+ const locale = Astro.currentLocale; // or the app's own resolution — see Locales
54
+ const [settings, stories, labels] = await Promise.all([
55
+ SiteSettings.get({ locale }),
56
+ Story.list({ locale, limit: 12 }),
57
+ getLabels({ locale }),
58
+ ]);
59
+ ---
60
+
61
+ <Text as="h1" value={settings.siteName} />
62
+ {
63
+ stories.items.map((story) => (
64
+ <article>
65
+ <Image value={story.cover} width={320} />
66
+ <Text as="h3" value={story.title} />
67
+ <RichText value={story.body} />
68
+ <a href={`/stories/${String(story.slug)}`}>
69
+ <Text as="span" value={fimo`${labels.t('story.readMore')}: ${story.title}`} />
70
+ </a>
71
+ </article>
72
+ ))
73
+ }
74
+ ```
75
+
76
+ The native surface is `Text`, `RichText`, `Image`, `StaticImage`, `Video`, `Date`, `Boolean`, and `Json` (component table: `references/ui.md`). Pass tracked values whole so Studio can resolve their source; use `String(value)` only for attributes and URLs.
77
+
78
+ ## Static and on-demand rendering
79
+
80
+ Keep the application's per-route rendering choice:
81
+
82
+ - Prerendered pages read content once at build; edited content appears after a rebuild/redeploy.
83
+ - On-demand pages (`export const prerender = false`, or `output: 'server'`) read on every request and always serve current content.
84
+ - A fully static app that needs on-demand routes and owns no adapter can set `output: 'server'`, mark still-static pages `export const prerender = true`, and let `fimo()` supply the server adapter.
85
+
86
+ Expand prerendered dynamic routes from generated reads:
87
+
88
+ ```astro
89
+ ---
90
+ import * as Story from '../../schemas/Story';
91
+
92
+ export async function getStaticPaths() {
93
+ const { items } = await Story.list({ limit: 100 });
94
+ return items.map((story) => ({ params: { slug: String(story.slug) } }));
95
+ }
96
+ ---
97
+ ```
98
+
99
+ ## Locales
100
+
101
+ The application resolves the locale — route prefix, middleware, domain, `Astro.currentLocale`, cookie, or its i18n library — and passes it to content reads and `getLabels({ locale })`. When a server read omits `locale`, the Fimo API resolves the project default; do not hardcode a fallback locale in application code. Astro needs no Fimo locale provider. Ownership rules: `references/locales.md`.
102
+
103
+ ## Studio route catalog
104
+
105
+ `.fimo/config.json#routes` is an optional catalog of pages for Studio navigation, not router configuration. Never replace or infer Astro's route files, redirects, middleware, or 404 behavior from it. Keep paths canonical and unlocalized, and describe dynamic segments with `params` so Studio can list entries:
106
+
107
+ ```json
108
+ {
109
+ "routes": {
110
+ "home": { "label": "Home", "path": "/" },
111
+ "story": {
112
+ "label": "Story",
113
+ "path": "/stories/:slug",
114
+ "params": { "slug": { "schema": "Story", "queryField": "slug", "displayField": "title" } }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ## Client islands
121
+
122
+ Generated content reads remain server-only. Preserve existing islands and do not add React or a client SDK to work around this boundary.
123
+
124
+ ## Recovery
125
+
126
+ - `fimo schemas push` reports that the project-local `fimo` package lacks the `fimo/astro` export → upgrade the project's `fimo` dependency, then re-run validation with the project-installed CLI.
127
+ - The site renders in preview but Studio cannot list or open pages → `fimo()` is missing from `astro.config.*`, or a route catalog `path` does not match the page's URL.
@@ -0,0 +1,19 @@
1
+ # Framework compatibility
2
+
3
+ `runtime.framework` selects Fimo's integration profile. The package's optional
4
+ peer ranges and the executable acceptance fixtures define compatibility; the
5
+ profile does not promise support for every version of the framework.
6
+
7
+ | Profile | Application dependency specifier | Fimo surface |
8
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
9
+ | `nextjs` | Next 16 is the current acceptance baseline; Fimo's React peer is `^18.2.0 \|\| ^19.0.0` and Next imposes its own React range | `fimo/next`, `fimo/next/client` |
10
+ | `react-router` | React `^18.2.0 \|\| ^19.0.0`, React Router `^7.0.0 \|\| ^8.0.0`, Vite `^7.0.0 \|\| ^8.0.0` | `fimo/react-router`, `fimo/ui` |
11
+ | `vite` | React `^18.2.0 \|\| ^19.0.0`, Vite `^7.0.0 \|\| ^8.0.0` | `fimo/ui`, `fimo/vite` |
12
+ | `astro` | Astro `^5.0.0 \|\| ^6.0.0 \|\| ^7.0.0` | `fimo/astro`, `fimo/astro/components` |
13
+ | `sveltekit` | SvelteKit `^2.0.0`, Svelte `^5.0.0`, Vite `^7.0.0 \|\| ^8.0.0` | `fimo/sveltekit`, `fimo/sveltekit/components`, `fimo/sveltekit/config`, `fimo/sveltekit/vite` |
14
+ | `nuxtjs`, `remix`, `vue` | Hosting detection only; no Fimo content/runtime adapter yet | `fimo` hosting profile only |
15
+
16
+ The exact versions used by acceptance fixtures are test baselines, not values
17
+ to copy into an application. If a project falls outside a documented range,
18
+ report that boundary before changing framework code; do not silently downgrade
19
+ or replace the application's framework.
@@ -28,9 +28,18 @@ Hosted preview and production inject the tenant API through these aliases:
28
28
  | Astro, Remix, SvelteKit | `FIMO_CONTENT_API_URL` | `PUBLIC_FIMO_API_URL` |
29
29
  | React Router, Vite, Vue | `FIMO_CONTENT_API_URL` | `VITE_API_URL` |
30
30
 
31
- Current `fimo init` and `fimo clone` write the Vite and Next aliases locally.
32
- For another framework, preserve or add its normal local environment alias; do
33
- not hardcode a tenant URL in application source.
31
+ Locally, the app derives its env from the **git branch**: `fimo/vite`,
32
+ `withFimo`, the Astro integration and the SvelteKit plugin compute the tenant
33
+ API URL from `.fimo/project.json`
34
+ (`projectId` + `tenantApiBaseUrl`, recorded once at `init`/`clone`/`link`) and
35
+ expose the Vite, Next and public (`PUBLIC_*`) aliases plus `FIMO_ENV` /
36
+ `NEXT_PUBLIC_FIMO_ENV` at startup. No env file is written on a switch, so a plain `git checkout` is a
37
+ complete env switch. Never hardcode a tenant URL in application source. One
38
+ rule, per variable: a value the user set explicitly (`.env`, shell, their own
39
+ `define`) is left alone, and Fimo fills the variables they did not set.
40
+
41
+ For a framework whose alias is not in that list yet, preserve or add its normal
42
+ local environment alias by hand.
34
43
 
35
44
  ## React Router framework mode
36
45
 
@@ -75,6 +84,9 @@ Next.js and the other supported native frameworks own their build and routing
75
84
  output. Do not add a catch-all rewrite; the framework's hosting preset handles
76
85
  routes, server functions, static output, and 404 responses.
77
86
 
87
+ Astro has a dedicated connector — load `references/frameworks/astro.md` before
88
+ editing an Astro config.
89
+
78
90
  `.fimo/config.json#routes` is the Studio page catalog, not deployment routing.
79
91
  Never generate hosting rewrites from it. If a project already has a
80
92
  provider-specific deployment file, preserve it; that file remains authoritative.
@@ -1,72 +1,33 @@
1
- # Setup Fimo on React Router 8
1
+ # React Router framework mode
2
2
 
3
- This recipe describes the canonical Fimo + React Router framework-mode setup.
4
- It mirrors the default `fimo init` scaffold; you can also apply it to an
5
- existing RR project.
3
+ This is the canonical Fimo + React Router framework-mode setup used by
4
+ `fimo init`. You can also apply it to an existing React Router project: preserve
5
+ its routes, rendering choices, providers, and SEO.
6
6
 
7
- ## Prerequisites
7
+ ## Install and build
8
8
 
9
- - Node 22.22+
10
- - A Fimo project created via `fimo init` (gives you `projectId`,
11
- `organizationId`, and an `apiUrl`).
9
+ Install the peers the application uses:
12
10
 
13
- ## Install
14
-
15
- ```
11
+ ```bash
16
12
  pnpm add fimo react react-dom react-router @tanstack/react-query
17
- pnpm add -D @react-router/dev @react-router/node @tailwindcss/vite tailwindcss vite @types/node @types/react @types/react-dom typescript
18
- ```
19
-
20
- ## File: `package.json`
21
-
22
- ```json
23
- {
24
- "name": "__PROJECT_SLUG__",
25
- "version": "0.0.0",
26
- "private": true,
27
- "type": "module",
28
- "scripts": {
29
- "dev": "react-router dev --port 5173",
30
- "build": "react-router build && fimo export-static",
31
- "preview": "vite preview --host 0.0.0.0 --port 4173",
32
- "typecheck": "tsc --noEmit"
33
- }
34
- }
13
+ pnpm add -D @react-router/dev @react-router/node vite
35
14
  ```
36
15
 
37
- ## File: `vite.config.ts`
16
+ Keep the project's React Router Vite plugin explicit:
38
17
 
39
18
  ```ts
40
19
  import { reactRouter } from '@react-router/dev/vite';
41
- import { resolve } from 'path';
42
20
  import { defineConfig } from 'vite';
43
-
44
21
  import { fimo } from 'fimo/vite';
45
22
 
46
23
  export default defineConfig({
47
24
  plugins: [reactRouter(), fimo({ sitemap: true })],
48
- resolve: {
49
- alias: {
50
- '@': resolve(__dirname, './src/'),
51
- },
52
- },
53
25
  });
54
26
  ```
55
27
 
56
- Notes:
28
+ `fimo()` is synchronous and returns a Vite `PluginOption[]`. Do not enable `seo: true`; React Router route `meta` exports own SEO.
57
29
 
58
- - **You** call `reactRouter()`. `fimo/vite` no longer auto-injects it — the
59
- user's vite.config owns the framework plugin. This is the library-mode shape.
60
- - `fimo()` is synchronous; it returns a `PluginOption[]` you drop straight into
61
- `plugins`. Don't `await` it or spread it.
62
- - Do **not** add `fimo({ seo: true })` here. RR handles SEO via the `meta`
63
- export (see `src/root.tsx`); the build-time SEO plugin would conflict.
64
- - `sitemap` is opt-in and off by default; pass `fimo({ sitemap: true })` to emit
65
- `sitemap.xml` (the canonical template does this). Omitting the option leaves
66
- it off.
67
- - `fimo({ robots: true })` opt-in to emit `robots.txt`.
68
-
69
- ## File: `react-router.config.ts`
30
+ For the supported client-rendered setup, connect React Router's native build to Fimo hosting:
70
31
 
71
32
  ```ts
72
33
  import type { Config } from '@react-router/dev/config';
@@ -76,59 +37,26 @@ export default {
76
37
  appDirectory: 'src',
77
38
  ssr: false,
78
39
  presets: [fimoPreset()],
79
- // Static-site generation is opt-in. By default this template builds as an
80
- // SPA (single index.html shell, client-side routing). To prerender routes at
81
- // build time — required for crawler-visible per-route SEO — add this line:
82
- //
83
- // import { getFimoPaths } from 'fimo/paths';
84
- // prerender: async () => (await getFimoPaths()).map((p) => p.path),
85
- //
86
- // `getFimoPaths()` expands dynamic routes (e.g. `/blog/:slug`) by fetching
87
- // schema entries from the content API. See `references/frameworks/react-router.md`
88
- // in the fimo skill for the full setup pattern.
89
- buildDirectory: 'dist',
90
40
  } satisfies Config;
91
41
  ```
92
42
 
93
- `fimoPreset()` connects the client-rendered build to Fimo hosting without
94
- exposing a provider package. See `references/frameworks/hosting.md`; do not
95
- apply this SPA preset to an existing SSR project.
96
-
97
- **SSG is opt-in now.** Default = SPA (one HTML shell). Add `prerender`
98
- yourself if you want crawler-visible per-route HTML. The previous
99
- "prerender everything by default" behavior was a website-builder opinion
100
- that doesn't fit infrastructure mode — your call which routes to prerender,
101
- when to render them, and how.
43
+ Do not change an existing SSR project to `ssr: false` merely to add Fimo. The current adapter does not provide React Router SSR support. Prerendering is application-owned and opt-in.
102
44
 
103
- ## File: `src/root.tsx`
45
+ ## Application root
104
46
 
105
- The explicit `QueryClientProvider` below is the canonical template shape so the
106
- app can configure query defaults such as `staleTime`. Adopted SPAs can omit it:
107
- `FimoProviders` reuses an ancestor client when present and supplies a stable
108
- fallback otherwise.
47
+ `FimoProviders` reuses an ancestor React Query client or supplies a stable fallback. Keep an explicit ancestor when the application owns query defaults or shares the cache:
109
48
 
110
49
  ```tsx
111
50
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
112
- import { FimoProviders, FimoScripts, loadFimoMetaData, buildFimoMeta, fimoHtmlProps } from 'fimo/react-router';
113
- import type { MetaFunction } from 'react-router';
51
+ import { FimoProviders, FimoScripts } from 'fimo/react-router';
114
52
  import { Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
115
53
 
116
- const queryClient = new QueryClient({
117
- defaultOptions: { queries: { staleTime: Infinity } },
118
- });
119
-
120
- export async function loader(args: { request: Request }) {
121
- return loadFimoMetaData(args);
122
- }
123
-
124
- export const meta: MetaFunction = (args) => buildFimoMeta(args);
54
+ const queryClient = new QueryClient();
125
55
 
126
56
  export function Layout({ children }: { children: React.ReactNode }) {
127
57
  return (
128
- <html {...fimoHtmlProps()}>
58
+ <html>
129
59
  <head>
130
- <meta charSet="utf-8" />
131
- <meta name="viewport" content="width=device-width, initial-scale=1" />
132
60
  <Meta />
133
61
  <Links />
134
62
  <FimoScripts />
@@ -153,7 +81,11 @@ export default function AppRoot() {
153
81
  }
154
82
  ```
155
83
 
156
- ## File: `src/routes.ts`
84
+ Keep the application's existing `Layout` details. Add only the Fimo provider and script connector required by the task.
85
+
86
+ ## Routes and locales
87
+
88
+ `fimoRoutes()` is an optional helper for Fimo's path-prefix locale convention:
157
89
 
158
90
  ```ts
159
91
  import type { RouteConfig } from '@react-router/dev/routes';
@@ -161,142 +93,38 @@ import { index } from '@react-router/dev/routes';
161
93
  import { fimoRoutes } from 'fimo/react-router/routes';
162
94
 
163
95
  const routes = [index('./pages/Index.tsx', { id: 'home' })] satisfies RouteConfig;
164
-
165
96
  export default fimoRoutes(routes) satisfies RouteConfig;
166
97
  ```
167
98
 
168
- Page filenames are your choice; the scaffold uses PascalCase (e.g. `Index.tsx`,
169
- `Privacy.tsx`).
99
+ Custom locale routers can skip it and pass their resolved locale to `<FimoProviders locale={locale}>`. Use `FimoLink` only when the application adopts Fimo's locale-aware link behavior; otherwise preserve its links. Copyable path-prefix locale examples live in `assets/react-router-locales/`.
170
100
 
171
- `fimoRoutes()` is Fimo's React Router helper for path-prefix locales. It is a no-op for single-locale projects and expands concrete locale aliases when `.fimo/config.json#i18n.locales` contains more locales. Custom routers can ignore this helper and pass their own locale to `<FimoProviders locale={locale}>`; see `references/locales.md`.
101
+ ## Content and labels
172
102
 
173
- ### Locale-aware navigation
174
-
175
- Use `FimoLink` for internal links that should preserve the current locale or deliberately switch it:
103
+ Render tracked values with `fimo/ui`:
176
104
 
177
105
  ```tsx
178
- import { FimoLink } from 'fimo/react-router';
106
+ import { Image, Label, RichText, Text } from 'fimo/ui';
179
107
 
180
- <FimoLink to="/pricing">Pricing</FimoLink>
181
- <FimoLink to="/pricing" locale="es">Spanish pricing</FimoLink>
108
+ return <Label value="home.hero.title" as="h1" />;
182
109
  ```
183
110
 
184
- Read the active locale with `useLocale()` when component logic needs the locale list, current canonical route, or document direction:
111
+ Use `useLabels().t()` for attributes, metadata, or composed strings. `references/labels.md` owns the complete contract.
185
112
 
186
- ```tsx
187
- import { useLocale } from 'fimo/ui';
113
+ ## Project profile
188
114
 
189
- const { locale, defaultLocale, locales, routePath, dir } = useLocale();
190
- ```
191
-
192
- `FimoLink` localizes absolute internal paths using `.fimo/config.json#i18n.routing`; relative, hash, query-only, and external URLs remain unchanged. Copyable route and navigation examples live in `assets/react-router-locales/`.
193
-
194
- ## File: `src/pages/Index.tsx`
195
-
196
- ```tsx
197
- import { Text, useLabels } from 'fimo/ui';
198
-
199
- export default function HomePage() {
200
- const { t } = useLabels();
201
-
202
- return (
203
- <main>
204
- <Text value={t('home.hero.title')} as="h1" />
205
- </main>
206
- );
207
- }
208
- ```
209
-
210
- ## File: `.fimo/config.json`
211
-
212
- ```json
213
- {
214
- "runtime": { "framework": "react-router" },
215
- "version": "4",
216
- "seo": {
217
- "title": "__PROJECT_SLUG__",
218
- "siteName": "__PROJECT_SLUG__"
219
- },
220
- "routes": {
221
- "home": {
222
- "label": "Home",
223
- "path": "/"
224
- }
225
- }
226
- }
227
- ```
228
-
229
- ## File: `.fimo/project.json`
230
-
231
- ```json
232
- {
233
- "projectId": "__PROJECT_ID__",
234
- "organizationId": "__ORG_ID__",
235
- "apiUrl": "__API_URL__"
236
- }
237
- ```
238
-
239
- Replace the `__PROJECT_ID__` / `__ORG_ID__` / `__API_URL__` sentinels with the
240
- values from `fimo init`'s output (or `fimo projects info`).
241
-
242
- ## File: `tsconfig.json`
115
+ Declare the runtime in `.fimo/config.json`:
243
116
 
244
117
  ```json
245
118
  {
246
- "compilerOptions": {
247
- "target": "ES2022",
248
- "lib": ["DOM", "DOM.Iterable", "ES2022"],
249
- "module": "ESNext",
250
- "moduleResolution": "Bundler",
251
- "jsx": "react-jsx",
252
- "strict": true,
253
- "esModuleInterop": true,
254
- "skipLibCheck": true,
255
- "resolveJsonModule": true,
256
- "isolatedModules": true,
257
- "types": ["@react-router/node", "vite/client"],
258
- "paths": { "@/*": ["./src/*"] }
259
- },
260
- "include": ["src", "*.config.ts"]
119
+ "runtime": { "framework": "react-router" }
261
120
  }
262
121
  ```
263
122
 
264
- ## File: `index.css`
265
-
266
- ```css
267
- @import 'tailwindcss';
268
- ```
269
-
270
- (Optional — only if using Tailwind. Tailwind is not required for Fimo to
271
- function; it just ships with the canonical template.)
272
-
273
- ## Verify and iterate
274
-
275
- Run the app with the project's package-manager `dev` script (`pnpm dev` /
276
- `npm run dev` / `yarn dev` / `bun dev` — match the lockfile). It serves the site
277
- on localhost with live reload — this is your iteration loop: edit, see the change,
278
- repeat with the developer.
279
-
280
- `fimo deploy` is on-demand, not part of this loop: run it only when the developer
281
- wants a hosted preview, a shareable link, or to go live — and only on their signal.
282
- The dashboard's preview iframe shows the **deployed** app, so it only reflects
283
- changes after a `fimo deploy` (the local dev server is localhost-only).
284
-
285
- ## What you don't add
286
-
287
- - **No `fimo({ seo: true })`** — React Router's `meta` export covers SEO via
288
- `loadFimoMetaData` + `buildFimoMeta`. The build-time SEO plugin is for
289
- framework-less Vite + React setups (`references/frameworks/vite-react.md`).
290
- - **No `<FimoSeo />` component** — not part of the RR setup.
291
- - **No manual `<script src="overlay-runtime.js">`** — `<FimoScripts />`
292
- handles preview-script + overlay loading.
123
+ The optional `routes` object is Studio's semantic page catalog. Keep it aligned with application routes when the project uses Studio navigation, but do not treat it as the production router.
293
124
 
294
- ## What to do next
125
+ ## Boundaries
295
126
 
296
- - Add more routes: extend `src/routes.ts`, create matching `src/pages/*.tsx`,
297
- add route entries in `.fimo/config.json#routes`.
298
- - Add a sitemap: pass `fimo({ sitemap: true })` (opt-in, off by default; the
299
- canonical template enables it). To customize the base URL, set
300
- `.fimo/config.json#seo.url`.
301
- - Override SEO per route with React Router's `meta` export and the existing `loadFimoMetaData` / `buildFimoMeta` integration in `src/root.tsx`.
302
- - Look up rendering exports in `references/ui.md` and generated content APIs in `references/content/clients.md`.
127
+ - Route modules and `meta` exports own routing and SEO.
128
+ - `FimoScripts` owns preview-script loading; do not add the overlay script manually.
129
+ - Use `fimo deploy` only when the developer requests a hosted preview or publication.
130
+ - Load `references/ui.md` for rendering and `references/locales.md` for locale ownership.