feat: enhance project setup and architecture documentation

- Updated `tibi-project-setup` skill to clarify project initialization goals and steps.
- Improved `tibi-ssr-caching` skill to detail SSR architecture, responsibilities, and caching mechanisms.
- Introduced `website-solution-architecture` skill for translating website requirements into coherent solutions.
- Refined `AGENTS.md` to provide a structured roadmap for project development phases.
- Added `ADMIN_ASSET_VERSION` to `api/config.yml.env` for asset versioning.
- Updated SSR request flow and cache invalidation logic in `api/hooks/ssr/AGENTS.md`.
- Removed obsolete `esbuild.config.admin.js` and integrated asset versioning into the main `esbuild.config.js`.
- Adjusted `api/collections/content.yml` to utilize asset versioning for admin scripts.
This commit is contained in:
2026-05-12 20:01:22 +00:00
parent 4a604bab0b
commit 491f495c66
23 changed files with 3189 additions and 225 deletions
+13 -6
View File
@@ -5,20 +5,27 @@ Server-side rendering via goja (Go JS runtime) with HTML caching.
## Request flow
1. `get_read.js` receives the request and calls `lib/ssr-server.js`.
2. `ssr-server.js` renders the Svelte app via `lib/app.server.js` and injects `window.__SSR_CACHE__`.
3. On the client, `lib/ssr.js` hydrates using the injected cache data.
4. Rendered HTML is stored in the `ssr` collection with dependency tracking.
2. `get_read.js` loads `lib/app.server.js` and calls `app.default.render({ url })`.
3. `frontend/src/ssr.ts` stays thin and only initializes locale state before rendering `App.svelte`.
4. `frontend/src/App.svelte` is responsible for actual page data loading for both browser and SSR.
5. During SSR, `App.svelte` calls the same `loadContent(...)` path directly inside `typeof window === "undefined"`.
6. Rendered HTML is stored in the `ssr` collection together with dependency tracking strings.
## Build
- SSR bundle is built via `yarn build:server` and outputs to `lib/app.server.js`.
- The build uses `--banner:js='// @ts-nocheck'` to suppress type errors in the generated bundle.
- The project no longer uses Babel for SSR.
- goja-compatible transforms are configured in `esbuild.config.server.js` via `supported`.
- The server build must remove frontend-only splitting/outdir options inherited from the shared esbuild config.
## Cache invalidation
- `clear_cache.js` hook invalidates SSR cache entries based on collection dependencies.
- When content changes, only SSR entries that depend on the changed collection/entry are cleared.
- Dependencies are stored as strings like `content:<id>` or `content:*`.
- `DELETE` invalidation must be robust even when `context.data.id` is missing.
## Route validation
SSR route validation is currently disabled and returns -1 in `config.js`; update this when enabling SSR per route.
- SSR route validation is active in `config.js`.
- Public page URLs are language-prefixed (`/de/...`, `/en/...`), while `content.path` in the DB is stored without that prefix.
- `ssrValidatePath()` must strip the language prefix before querying content and return a canonical language-prefixed URL when needed.