@decocms/start 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
- package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
- package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
- package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
- package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
- package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
- package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
- package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
- package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
- package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
- package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
- package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
- package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
- package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
- package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
- package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
- package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
- package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
- package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
- package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
- package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
- package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
- package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
- package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
- package/.cursor/skills/deco-core-architecture/engine.md +220 -0
- package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
- package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
- package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
- package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
- package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
- package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
- package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
- package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
- package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
- package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
- package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
- package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
- package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
- package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
- package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
- package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
- package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
- package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
- package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
- package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
- package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
- package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
- package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
- package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
- package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
- package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
- package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
- package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
- package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
- package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
- package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
- package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
- package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
- package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
- package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
- package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
- package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
- package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
- package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
- package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
- package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
- package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
- package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
- package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
- package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
- package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
- package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
- package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
- package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
- package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
- package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
- package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
- package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
- package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
- package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
- package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
- package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
- package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
- package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
- package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
- package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
- package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
- package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
- package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
- package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
- package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
- package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
- package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
- package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
- package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
- package/.cursor/skills/find-skills/SKILL.md +133 -0
- package/.cursor/skills/incident-report/SKILL.md +179 -0
- package/.cursor/skills/incident-report/references/5-whys.md +75 -0
- package/.cursor/skills/incident-report/templates/client-report.md +187 -0
- package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
- package/.cursor/skills/template-skill/SKILL.md +38 -0
- package/.github/workflows/release.yml +32 -0
- package/.releaserc.json +25 -0
- package/CLAUDE.md +135 -0
- package/GAP_ANALYSIS.md +224 -0
- package/GAP_ANALYSIS_V2.md +1013 -0
- package/biome.json +39 -0
- package/knip.json +5 -0
- package/package.json +87 -0
- package/scripts/generate-blocks.ts +69 -0
- package/scripts/generate-invoke.ts +378 -0
- package/scripts/generate-schema.ts +657 -0
- package/src/admin/cors.ts +29 -0
- package/src/admin/decofile.ts +72 -0
- package/src/admin/index.ts +24 -0
- package/src/admin/invoke.ts +163 -0
- package/src/admin/liveControls.ts +29 -0
- package/src/admin/meta.ts +70 -0
- package/src/admin/render.ts +205 -0
- package/src/admin/schema.ts +686 -0
- package/src/admin/setup.ts +44 -0
- package/src/cms/index.ts +59 -0
- package/src/cms/loader.ts +180 -0
- package/src/cms/registry.ts +162 -0
- package/src/cms/resolve.ts +1005 -0
- package/src/cms/sectionLoaders.ts +294 -0
- package/src/hooks/DecoPageRenderer.tsx +444 -0
- package/src/hooks/LazySection.tsx +109 -0
- package/src/hooks/LiveControls.tsx +108 -0
- package/src/hooks/SectionErrorFallback.tsx +85 -0
- package/src/hooks/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/matchers/builtins.ts +184 -0
- package/src/matchers/posthog.ts +154 -0
- package/src/middleware/decoState.ts +55 -0
- package/src/middleware/healthMetrics.ts +131 -0
- package/src/middleware/index.ts +80 -0
- package/src/middleware/liveness.ts +21 -0
- package/src/middleware/observability.ts +205 -0
- package/src/routes/adminRoutes.ts +83 -0
- package/src/routes/cmsRoute.ts +302 -0
- package/src/routes/components.tsx +34 -0
- package/src/routes/index.ts +15 -0
- package/src/sdk/analytics.ts +72 -0
- package/src/sdk/cacheHeaders.ts +268 -0
- package/src/sdk/cachedLoader.ts +206 -0
- package/src/sdk/clx.ts +3 -0
- package/src/sdk/cookie.ts +39 -0
- package/src/sdk/createInvoke.ts +57 -0
- package/src/sdk/csp.ts +59 -0
- package/src/sdk/env.ts +27 -0
- package/src/sdk/index.ts +63 -0
- package/src/sdk/instrumentedFetch.ts +137 -0
- package/src/sdk/invoke.ts +133 -0
- package/src/sdk/mergeCacheControl.ts +150 -0
- package/src/sdk/redirects.ts +217 -0
- package/src/sdk/requestContext.ts +184 -0
- package/src/sdk/serverTimings.ts +68 -0
- package/src/sdk/signal.ts +41 -0
- package/src/sdk/sitemap.ts +143 -0
- package/src/sdk/urlUtils.ts +117 -0
- package/src/sdk/useDevice.ts +82 -0
- package/src/sdk/useId.ts +7 -0
- package/src/sdk/useScript.ts +101 -0
- package/src/sdk/workerEntry.ts +703 -0
- package/src/sdk/wrapCaughtErrors.ts +107 -0
- package/src/types/index.ts +39 -0
- package/src/types/widgets.ts +13 -0
- package/tsconfig.json +13 -0
package/.releaserc.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
["@semantic-release/commit-analyzer", {
|
|
5
|
+
"preset": "angular",
|
|
6
|
+
"releaseRules": [
|
|
7
|
+
{ "type": "feat", "release": "minor" },
|
|
8
|
+
{ "type": "fix", "release": "patch" },
|
|
9
|
+
{ "type": "perf", "release": "patch" },
|
|
10
|
+
{ "type": "refactor", "release": "patch" },
|
|
11
|
+
{ "type": "docs", "release": false },
|
|
12
|
+
{ "type": "chore", "release": false },
|
|
13
|
+
{ "type": "style", "release": false },
|
|
14
|
+
{ "type": "test", "release": false }
|
|
15
|
+
]
|
|
16
|
+
}],
|
|
17
|
+
"@semantic-release/release-notes-generator",
|
|
18
|
+
"@semantic-release/npm",
|
|
19
|
+
"@semantic-release/github",
|
|
20
|
+
["@semantic-release/git", {
|
|
21
|
+
"assets": ["package.json"],
|
|
22
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
|
23
|
+
}]
|
|
24
|
+
]
|
|
25
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Guidance for AI assistants working with `@decocms/start`.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
`@decocms/start` is the framework layer for Deco storefronts built on **TanStack Start + React 19 + Cloudflare Workers**. It provides CMS block resolution, admin protocol handlers, section rendering, schema generation, and edge caching infrastructure.
|
|
8
|
+
|
|
9
|
+
**Not a storefront itself** — this is the npm package that storefronts depend on.
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- Runtime: Cloudflare Workers (Node compat)
|
|
14
|
+
- Framework: TanStack Start / TanStack Router
|
|
15
|
+
- UI: React 19 + React Compiler
|
|
16
|
+
- State: @tanstack/store + @tanstack/react-store
|
|
17
|
+
- Build: Vite
|
|
18
|
+
- Published as: `@decocms/start` on GitHub Packages
|
|
19
|
+
|
|
20
|
+
## Common Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build # tsc — compile to dist/
|
|
24
|
+
npm run typecheck # tsc --noEmit
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
No dev server — this is a library. Consumers run their own `vite dev`.
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
src/
|
|
33
|
+
├── admin/ # Admin protocol: meta, decofile, invoke, render, schema, CORS, setup
|
|
34
|
+
├── cms/ # Block loading, page resolution, section registry
|
|
35
|
+
├── hooks/ # DecoPageRenderer, LiveControls, LazySection, SectionErrorFallback
|
|
36
|
+
├── middleware/ # Observability, deco state, liveness probe
|
|
37
|
+
├── sdk/ # Worker entry, caching, useScript, signal, clx, analytics, redirects, sitemap
|
|
38
|
+
├── matchers/ # PostHog, built-in feature flag matchers
|
|
39
|
+
├── types/ # FnContext, App, Section, SectionProps, widgets
|
|
40
|
+
└── index.ts # Barrel export
|
|
41
|
+
scripts/
|
|
42
|
+
├── generate-blocks.ts # Scans site src/ for sections/loaders -> blocks.gen.ts
|
|
43
|
+
└── generate-schema.ts # Extracts TypeScript props -> JSON Schema (meta.gen.json)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Package Exports (from package.json)
|
|
47
|
+
|
|
48
|
+
Every export maps to a source file — no dist indirection:
|
|
49
|
+
|
|
50
|
+
| Import path | File |
|
|
51
|
+
|-------------|------|
|
|
52
|
+
| `@decocms/start` | `src/index.ts` |
|
|
53
|
+
| `@decocms/start/admin` | `src/admin/index.ts` |
|
|
54
|
+
| `@decocms/start/cms` | `src/cms/index.ts` |
|
|
55
|
+
| `@decocms/start/hooks` | `src/hooks/index.ts` |
|
|
56
|
+
| `@decocms/start/sdk/workerEntry` | `src/sdk/workerEntry.ts` |
|
|
57
|
+
| `@decocms/start/sdk/cacheHeaders` | `src/sdk/cacheHeaders.ts` |
|
|
58
|
+
| `@decocms/start/sdk/cachedLoader` | `src/sdk/cachedLoader.ts` |
|
|
59
|
+
| `@decocms/start/sdk/useScript` | `src/sdk/useScript.ts` |
|
|
60
|
+
| `@decocms/start/sdk/signal` | `src/sdk/signal.ts` |
|
|
61
|
+
| `@decocms/start/sdk/clx` | `src/sdk/clx.ts` |
|
|
62
|
+
| ... | (see `package.json` exports for full list) |
|
|
63
|
+
|
|
64
|
+
### Three-Layer Architecture
|
|
65
|
+
|
|
66
|
+
| Layer | Package | Responsibility |
|
|
67
|
+
|-------|---------|---------------|
|
|
68
|
+
| **@decocms/start** | This repo | Framework: CMS bridge, admin protocol, worker entry, caching, rendering |
|
|
69
|
+
| **@decocms/apps** | `decocms/apps-start` | Commerce: VTEX/Shopify loaders, types, SDK (useOffer, formatPrice) |
|
|
70
|
+
| **Site repo** | Not published | UI: components, hooks, routes, styles, contexts |
|
|
71
|
+
|
|
72
|
+
### Key Boundaries
|
|
73
|
+
|
|
74
|
+
- `@decocms/start` must NOT contain: Preact references, widget type aliases, site-specific section maps, commerce API calls
|
|
75
|
+
- `@decocms/apps` must NOT contain: UI components (Image, Picture), hook stubs, Preact/Fresh references
|
|
76
|
+
- Site repo must NOT contain: `compat/` directories, Vite aliases beyond `~` -> `src/`
|
|
77
|
+
|
|
78
|
+
## Worker Entry (`src/sdk/workerEntry.ts`)
|
|
79
|
+
|
|
80
|
+
The outermost Cloudflare Worker wrapper. Request flow:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Request → createDecoWorkerEntry(serverEntry, options)
|
|
84
|
+
├─ tryAdminRoute() ← /live/_meta, /.decofile, /live/previews/*
|
|
85
|
+
├─ cache purge check ← __deco_purge_cache
|
|
86
|
+
├─ static asset bypass ← /assets/*, favicon, sprites
|
|
87
|
+
├─ Cloudflare edge cache ← caches.open() with profile-based TTLs
|
|
88
|
+
└─ serverEntry.fetch() ← TanStack Start handles the rest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Admin routes MUST be handled here, NOT inside TanStack's `createServerEntry` — Vite strips custom fetch logic from server entries in production builds.
|
|
92
|
+
|
|
93
|
+
## Edge Caching (`src/sdk/cacheHeaders.ts`)
|
|
94
|
+
|
|
95
|
+
Built-in URL-to-profile detection:
|
|
96
|
+
|
|
97
|
+
| URL Pattern | Profile | Edge TTL |
|
|
98
|
+
|-------------|---------|----------|
|
|
99
|
+
| `/` | static | 1 day |
|
|
100
|
+
| `*/p` | product | 5 min |
|
|
101
|
+
| `/s`, `?q=` | search | 60s |
|
|
102
|
+
| `/cart`, `/checkout` | private | none |
|
|
103
|
+
| Everything else | listing | 2 min |
|
|
104
|
+
|
|
105
|
+
Cache API ignores `s-maxage` — the worker stores with `max-age` equal to `sMaxAge` as a workaround.
|
|
106
|
+
|
|
107
|
+
## Admin Protocol
|
|
108
|
+
|
|
109
|
+
The admin (admin.deco.cx) communicates with self-hosted storefronts via:
|
|
110
|
+
|
|
111
|
+
- `GET /live/_meta` — JSON Schema + manifest (with content-hash ETag)
|
|
112
|
+
- `GET /.decofile` — site content blocks
|
|
113
|
+
- `POST /deco/render` — section/page preview in iframe
|
|
114
|
+
- `POST /deco/invoke` — loader/action execution
|
|
115
|
+
|
|
116
|
+
Schema is composed at runtime: `generate-schema.ts` produces section schemas, `composeMeta()` in `src/admin/schema.ts` injects page schemas and framework definitions.
|
|
117
|
+
|
|
118
|
+
## Migration Guide
|
|
119
|
+
|
|
120
|
+
Detailed migration playbook from Fresh/Preact/Deno to TanStack Start/React/Workers is available at `.cursor/skills/deco-to-tanstack-migration/`. Covers:
|
|
121
|
+
|
|
122
|
+
- Import rewrites (Preact → React, @preact/signals → @tanstack/store)
|
|
123
|
+
- Deco framework elimination (@deco/deco/*, $fresh/*)
|
|
124
|
+
- Commerce type migration
|
|
125
|
+
- Platform hook implementation (useCart, useUser, useWishlist)
|
|
126
|
+
- Vite configuration
|
|
127
|
+
- 18 documented gotchas
|
|
128
|
+
|
|
129
|
+
## Important Constraints
|
|
130
|
+
|
|
131
|
+
1. **No compat layers** — replace imports, don't wrap them
|
|
132
|
+
2. **AsyncLocalStorage** — `src/cms/loader.ts` uses it; must use namespace import (`import * as asyncHooks`) to avoid breaking Vite client builds
|
|
133
|
+
3. **Preview shell** — must include `data-theme="light"` for DaisyUI v4 color variables
|
|
134
|
+
4. **Base64 encoding** — `toBase64()` must produce padded output matching `btoa()` — admin uses `btoa()` for definition refs
|
|
135
|
+
5. **ETag** — content-based DJB2 hash, not string length
|
package/GAP_ANALYSIS.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# deco-cx/deco vs @decocms/start — Capability Gap Analysis
|
|
2
|
+
|
|
3
|
+
> Generated from a full audit of `deco-cx/deco` (v1.174.2) compared against `@decocms/start` + `@decocms/apps`.
|
|
4
|
+
> Last updated: March 2026
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What's Already Ported
|
|
9
|
+
|
|
10
|
+
| Area | Status | Notes |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| CMS Block Storage + Page Routing | Solid | In-memory blocks, pattern matching with specificity |
|
|
13
|
+
| Deep Recursive Resolution | Solid | Walks section tree, dereferences blocks, handles variants |
|
|
14
|
+
| Section Registry | Solid | Lazy-loaded, async component registry with per-section options |
|
|
15
|
+
| Multivariate Flags / A/B Testing | Solid | Matchers + variant evaluation + PostHog bridge for sticky sessions |
|
|
16
|
+
| Admin Protocol | Functional | `/deco/meta`, `/deco/decofile`, `/deco/invoke`, `/deco/render` |
|
|
17
|
+
| Build-time Schema Gen | Good | `ts-morph` based, Props -> JSON Schema 7 |
|
|
18
|
+
| Build-time Block Gen | Good | `.deco/blocks/*.json` -> `blocks.gen.ts` |
|
|
19
|
+
| Analytics SDK | Good | `data-event` pattern, IntersectionObserver, GTM |
|
|
20
|
+
| useScript / useScriptAsDataURI | Ported | Function -> IIFE serialization |
|
|
21
|
+
| Signal (reactive state) | Ported | `@tanstack/store` backed, Preact signals API compat |
|
|
22
|
+
| Cookie Utilities | Ported | Client + server |
|
|
23
|
+
| className helper (clx) | Ported | Falsy filtering, whitespace collapse |
|
|
24
|
+
| Widget Types | Partial | Image, HTML, Video, Text, RichText, Secret, Color, Button |
|
|
25
|
+
| Core Type Aliases | Partial | App, AppContext, FnContext, Section, SectionProps, Flag |
|
|
26
|
+
| Admin Iframe Bridge | Ported | LiveControls with postMessage |
|
|
27
|
+
| DecoPageRenderer | Ported | Suspense + lazy sections + error boundaries + per-section fallbacks |
|
|
28
|
+
| Commerce Types | Solid | Full schema.org model (Product, PDP, PLP, etc.) |
|
|
29
|
+
| Commerce SDK | Good | useOffer, useVariantPossibilities, formatPrice, analytics |
|
|
30
|
+
| VTEX Integration | Extensive | 15 loaders, 11 actions, 6 inline loaders, instrumented fetch support |
|
|
31
|
+
| Shopify Integration | Partial | 4 loaders, 2 actions (missing related products, coupons), instrumented fetch support |
|
|
32
|
+
| **Loader Caching** | **NEW** | `createCachedLoader()` — SWR, single-flight dedup, LRU eviction |
|
|
33
|
+
| **Section Error Boundaries** | **NEW** | `SectionErrorBoundary` — per-section isolation, dev stack trace, prod silent |
|
|
34
|
+
| **Middleware Utilities** | **NEW** | `buildDecoState`, `handleLiveness`, `applyServerTiming`, `applyCorsHeaders` |
|
|
35
|
+
| **CDN Cache Headers** | **NEW** | `cacheHeaders()` — named profiles (static, product, listing, search, cart) |
|
|
36
|
+
| **Server-Timing** | **NEW** | `createServerTimings()` — start/record/toHeader for DevTools visibility |
|
|
37
|
+
| **Typed Invoke Proxy** | **NEW** | `createInvokeProxy()`, `batchInvoke()`, `invokeQueryOptions()` for TanStack Query |
|
|
38
|
+
| **PostHog Matcher Bridge** | **NEW** | `createPostHogMatcher()` + `createServerPostHogAdapter()` for sticky A/B |
|
|
39
|
+
| **Observability Toolkit** | **NEW** | `configureTracer()`, `withTracing()`, `logRequest()` — pluggable tracer adapter |
|
|
40
|
+
| **Instrumented Fetch** | **NEW** | `createInstrumentedFetch()` — dev logging + OTel tracing for outbound HTTP |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## What's Still Missing
|
|
45
|
+
|
|
46
|
+
### 1. Runtime / Server Infrastructure
|
|
47
|
+
|
|
48
|
+
| Capability | Impact | Status |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| ~~Middleware pipeline~~ | ~~No composable interceptors~~ | **DONE** — middleware utilities exported for TanStack Start `createMiddleware()` |
|
|
51
|
+
| ~~Multi-tier caching~~ | ~~No SWR, no CDN headers~~ | **DONE** — `createCachedLoader()` + `cacheHeaders()` |
|
|
52
|
+
| ~~Fetch enhancement~~ | ~~Raw fetch, no instrumented wrapper~~ | **DONE** — `createInstrumentedFetch()` wired into VTEX/Shopify clients |
|
|
53
|
+
| ~~Loader cache modes~~ | ~~Loaders always run fresh~~ | **DONE** — 3 policies: `no-store`, `no-cache`, `stale-while-revalidate` |
|
|
54
|
+
| ~~Server-Timing headers~~ | ~~No performance visibility~~ | **DONE** — `createServerTimings()` + middleware integration |
|
|
55
|
+
| ~~CORS utility~~ | ~~Admin-only CORS~~ | **DONE** — `applyCorsHeaders()` in middleware |
|
|
56
|
+
| Built-in route system | Path matching exists but no TanStack Router integration | Deferred — TanStack Router handles this |
|
|
57
|
+
| Static asset serving | Handled by TanStack Start | Deferred — not needed |
|
|
58
|
+
| Early Hints (103) | No resource preloading hints | Remaining |
|
|
59
|
+
|
|
60
|
+
### 2. Observability
|
|
61
|
+
|
|
62
|
+
| Capability | Impact | Status |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| ~~Pluggable tracing~~ | ~~No tracing~~ | **DONE** — `configureTracer()` + `withTracing()` adapter |
|
|
65
|
+
| ~~Structured logging~~ | ~~No structured logs~~ | **DONE** — `logRequest()` (JSON in prod, colored in dev) |
|
|
66
|
+
| ~~Fetch instrumentation~~ | ~~No auto-trace on outbound HTTP~~ | **DONE** — `createInstrumentedFetch()` |
|
|
67
|
+
| ~~Health probes~~ | ~~No liveness check~~ | **DONE** — `handleLiveness()` at `/_liveness` |
|
|
68
|
+
| Full OTel SDK integration | No auto-instrumentation | Remaining — use Sentry add-on or OTel SDK manually |
|
|
69
|
+
| OTel metrics (histograms) | No cache hit/miss, latency metrics | Remaining |
|
|
70
|
+
| Debug sampling | No debug-mode tracing | Remaining |
|
|
71
|
+
|
|
72
|
+
### 3. Block System
|
|
73
|
+
|
|
74
|
+
| Capability | Impact | Status |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| ~~Error boundary per section~~ | ~~Sections can crash the whole page~~ | **DONE** — `SectionErrorBoundary` wraps each section |
|
|
77
|
+
| ~~Loading fallback per section~~ | ~~No granular loading states~~ | **DONE** — per-section `SectionOptions` in registry |
|
|
78
|
+
| Handler blocks | No custom HTTP handler blocks | Deferred — TanStack server routes replace this |
|
|
79
|
+
| Workflow blocks | No durable workflows | Deferred — Cloudflare Workflows is the replacement |
|
|
80
|
+
| Account blocks | No credential management blocks | Deferred — env vars / t3env add-on |
|
|
81
|
+
| Block middleware | No per-block interceptors | Remaining |
|
|
82
|
+
| Gate Keeper visibility | No admin-only vs. public block control | Remaining |
|
|
83
|
+
|
|
84
|
+
### 4. Engine / Resolution
|
|
85
|
+
|
|
86
|
+
| Capability | Impact | Status |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `ReleaseResolver` | No lazy/deferred resolution, no `runOnce` | Remaining |
|
|
89
|
+
| Resolve chains (tracing) | Can't track which block called which | Remaining |
|
|
90
|
+
| Override maps | Can't substitute resolvables at runtime | Remaining |
|
|
91
|
+
| Decofile hot-reload | Changes require full redeploy | Remaining |
|
|
92
|
+
| Composable decofile providers | Only fs-based | Remaining |
|
|
93
|
+
| Import map building | No app composition via import maps | Deferred — npm handles this |
|
|
94
|
+
|
|
95
|
+
### 5. Client SDK
|
|
96
|
+
|
|
97
|
+
| Capability | Impact | Status |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| ~~Typed invoke proxy~~ | ~~No `Runtime.vtex.loaders.x()` pattern~~ | **DONE** — `createInvokeProxy()` |
|
|
100
|
+
| ~~Batch invoke~~ | ~~No batch client-side calls~~ | **DONE** — `batchInvoke()` |
|
|
101
|
+
| ~~TanStack Query integration~~ | ~~No SWR for invoke calls~~ | **DONE** — `invokeQueryOptions()` |
|
|
102
|
+
| SSE streaming reader | No streaming invoke support | Remaining |
|
|
103
|
+
| `forApp<TApp>()` | No app-specific typed invocations | Remaining |
|
|
104
|
+
|
|
105
|
+
### 6. Matcher System
|
|
106
|
+
|
|
107
|
+
| Capability | Impact | Status |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| ~~Sticky sessions / PostHog~~ | ~~Random matcher is non-deterministic~~ | **DONE** — `createPostHogMatcher()` + server-side adapter |
|
|
110
|
+
| Geo matchers | No location-based targeting | Remaining |
|
|
111
|
+
| Date/time matchers | No time-based content scheduling | Remaining |
|
|
112
|
+
| Cron matchers | No scheduled content swaps | Remaining |
|
|
113
|
+
| User-based matchers | No logged-in/anonymous targeting | Remaining |
|
|
114
|
+
|
|
115
|
+
### 7. Context System
|
|
116
|
+
|
|
117
|
+
| Capability | Impact | Status |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| ~~`DecoState` per-request~~ | ~~No state threading~~ | **DONE** — `buildDecoState()` in middleware |
|
|
120
|
+
| `RequestContext` (AsyncLocalStorage) | No per-request state without prop drilling | Remaining |
|
|
121
|
+
| Platform detection | No K8s/Deploy/localhost detection | Remaining |
|
|
122
|
+
|
|
123
|
+
### 8. Auth / JWT
|
|
124
|
+
|
|
125
|
+
| Capability | Status |
|
|
126
|
+
|---|---|
|
|
127
|
+
| JWT issuers / JWKS / key pairs | Deferred — use Clerk or WorkOS TanStack add-on |
|
|
128
|
+
|
|
129
|
+
### 9. Developer Tooling / CLI
|
|
130
|
+
|
|
131
|
+
| Capability | Status |
|
|
132
|
+
|---|---|
|
|
133
|
+
| Dev daemon / CRDT / tunnel | Deferred — TanStack Start dev server + Vite HMR |
|
|
134
|
+
| Codemod system | Deferred |
|
|
135
|
+
|
|
136
|
+
### 10. Widget Types (remaining)
|
|
137
|
+
|
|
138
|
+
| Missing | Status |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `Select`, `CheckboxGroup`, `RadioGroup`, `DatePicker`, `NumberRange`, `Dynamic` | Remaining |
|
|
141
|
+
| Custom widget registration | Remaining |
|
|
142
|
+
|
|
143
|
+
### 11. Schema Generation Gaps (remaining)
|
|
144
|
+
|
|
145
|
+
| Missing | Status |
|
|
146
|
+
|---|---|
|
|
147
|
+
| Loader/action schema generation | Remaining |
|
|
148
|
+
| Widget type annotation detection | Remaining |
|
|
149
|
+
| Incremental/watch mode | Remaining |
|
|
150
|
+
| App dependency schema merging | Remaining |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Severity Tiers (Updated)
|
|
155
|
+
|
|
156
|
+
### Tier 1 — Critical for production: DONE
|
|
157
|
+
|
|
158
|
+
- ~~Multi-tier caching (loader SWR + CDN headers)~~ **DONE**
|
|
159
|
+
- ~~Error boundaries per section~~ **DONE**
|
|
160
|
+
- ~~Sticky sessions for A/B tests~~ **DONE**
|
|
161
|
+
- ~~Server-Timing headers~~ **DONE**
|
|
162
|
+
- ~~DecoState per-request~~ **DONE** (via middleware)
|
|
163
|
+
- RequestContext / AsyncLocalStorage threading — **remaining**
|
|
164
|
+
|
|
165
|
+
### Tier 2 — Important for DX: MOSTLY DONE
|
|
166
|
+
|
|
167
|
+
- Decofile hot-reload (no redeploy) — **remaining**
|
|
168
|
+
- ~~Typed invoke proxy (client-side)~~ **DONE**
|
|
169
|
+
- Loader/action schema generation — **remaining**
|
|
170
|
+
- Widget annotation detection in schema gen — **remaining**
|
|
171
|
+
- ~~Loading fallbacks per section~~ **DONE**
|
|
172
|
+
|
|
173
|
+
### Tier 3 — Important for scale: MOSTLY DONE
|
|
174
|
+
|
|
175
|
+
- ~~Pluggable observability (tracer adapter + tracing + logging)~~ **DONE**
|
|
176
|
+
- ~~Health probes~~ **DONE**
|
|
177
|
+
- ~~Fetch instrumentation~~ **DONE**
|
|
178
|
+
- ~~Middleware pipeline~~ **DONE**
|
|
179
|
+
- Full OTel auto-instrumentation — **remaining** (use Sentry add-on)
|
|
180
|
+
|
|
181
|
+
### Tier 4 — Nice to have / deferred
|
|
182
|
+
|
|
183
|
+
- Dev daemon — Deferred (TanStack Start dev server)
|
|
184
|
+
- JWT utilities — Deferred (Clerk/WorkOS add-on)
|
|
185
|
+
- Workflow/durable blocks — Deferred (Cloudflare Workflows)
|
|
186
|
+
- Handler blocks — Deferred (TanStack server routes)
|
|
187
|
+
- AI code generation — Deferred
|
|
188
|
+
- Codemod system — Deferred
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## New Module Map
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
@decocms/start
|
|
196
|
+
├── src/
|
|
197
|
+
│ ├── cms/ # Block storage, page routing, resolution, registry
|
|
198
|
+
│ ├── admin/ # Admin protocol endpoints (meta, decofile, invoke, render, schema composition)
|
|
199
|
+
│ │ ├── meta.ts # /deco/meta endpoint, setMetaData() calls composeMeta()
|
|
200
|
+
│ │ ├── schema.ts # MetaResponse type, composeMeta(), framework block schemas (pages)
|
|
201
|
+
│ │ ├── render.ts # /deco/render endpoint, section + page rendering
|
|
202
|
+
│ │ ├── decofile.ts# /deco/decofile read/reload
|
|
203
|
+
│ │ ├── invoke.ts # /deco/invoke endpoint
|
|
204
|
+
│ │ ├── cors.ts # CORS + admin origin checks
|
|
205
|
+
│ │ └── liveControls.ts # Admin iframe bridge script
|
|
206
|
+
│ ├── hooks/ # DecoPageRenderer, SectionErrorBoundary, LiveControls
|
|
207
|
+
│ ├── middleware/ # DecoState, liveness, Server-Timing, CORS, observability
|
|
208
|
+
│ ├── matchers/ # PostHog feature flag bridge
|
|
209
|
+
│ ├── sdk/ # cachedLoader, cacheHeaders, serverTimings, invoke, instrumentedFetch, analytics, signal, cookie, clx, useScript
|
|
210
|
+
│ └── types/ # Core types + widget types
|
|
211
|
+
├── scripts/ # generate-blocks, generate-schema
|
|
212
|
+
└── package.json # 18 export paths
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Evolution Path
|
|
218
|
+
|
|
219
|
+
The framework is now at **"production-capable"** — it has the CMS resolution engine, section isolation, caching, middleware, observability hooks, typed client SDK, and instrumented fetch. What remains is:
|
|
220
|
+
|
|
221
|
+
1. **Next** — AsyncLocalStorage-based RequestContext, decofile hot-reload
|
|
222
|
+
2. **Then** — Schema generation improvements (loaders, widgets, watch mode)
|
|
223
|
+
3. **Later** — Full OTel auto-instrumentation, advanced matchers (geo, time, user)
|
|
224
|
+
4. **Eventually** — SSE streaming, remaining widget types
|