# What the scaffold generates — and what it deliberately doesn't

URL: https://kywi-docs-production.up.railway.app/developing/what-the-scaffold-generates--and-what-it-deliberately-doesnt
Type: docPage

Eleven stamped delegate files plus your config, module map and layer folders — the render path itself stays in core and upgrades with the package.

Two sets of files come out of `create-kywi-app`, and the difference between them is mechanical rather than editorial: eleven render-path files carry a version-and-hash stamp on line one and are `create-kywi-app upgrade`'s to replace, and everything else carries no stamp and is yours forever.

## The eleven stamped files

Nine exist in every deployment mode — `lib/kywi.ts`, `middleware.ts`, `kywi.layers.ts`, `app/api/v1/[...kywi]/route.ts`, the four AX root routes (`llms.txt`, `llms-full.txt`, `sitemap.xml`, `robots.txt`) and `app/admin/[[...admin]]/page.tsx`. Two are coupled-only: `app/(site)/layout.tsx` and `app/(site)/[[...slug]]/page.tsx`. Each is a few lines of wiring around a core constructor — see [The host-app contract](/developing/the-host-app-contract/).

// kywi-render v2 (create-kywi-app 0.23.0) sha256:16a524f634c2

## lib/kywi.ts — line 1 of every generated render file

## The stamp is an integrity check, not a version label

`v2` is the shape of the emission; the hash is the first twelve hex characters of the sha256 of everything *below* the stamp line, over the exact bytes with no whitespace or line-ending normalisation. Any edit at all changes it, which is the point: `upgrade` can tell an untouched generated file from one carrying someone's work without diffing against every historical emission. A file whose hash still matches is replaced silently; one whose hash does not is refused as edited. A render file with no stamp at all is refused too — unless its whole-content hash matches one of the pre-stamp emissions `upgrade` still recognises (`KNOWN_UNSTAMPED_EMISSIONS`), in which case it is replaced exactly like an intact stamped file, not refused. Only `--force` overrides an actual refusal, and it copies the original into `.kywi-upgrade/<timestamp>/` first.

## What it deliberately does not generate

The render path. Before 0.19.0 the scaffold copied roughly 1,370 lines of content resolution, SEO metadata, JSON-LD, personalization and A/B assignment into every project, at paths a core upgrade could never reach again. That code now ships in `@kywi-software/core/next`, and the six files that used to hold its glue are retired rather than merely unused: `lib/site.ts`, `lib/config.ts`, `lib/kywi-js-loader.ts`, `components/kywi-js-loader.tsx`, `components/personalization-runtime.tsx` and `app/(site)/kywi-front-edit.tsx`. A copy left behind shadows the real implementation, so `upgrade` reports every one it finds and removes it only under `--force`, with the same backup.

## What the project owns

Unstamped, and never written twice: `kywi.config.ts`, `app/(site)/site.css`, `lib/modules.tsx`, `components/site-nav.tsx`, and everything under `sites/`. Layer files are the interesting case: `upgrade` creates one for a configured site that has none, because a missing layer makes core's registry assertion throw at boot, and from then on it is reported as kept and never compared again. `kywi.layers.ts` is the exception in the other direction: it is regenerated from a scan of your `kywi.config.ts` on every upgrade, and if that scan reports a problem the command emits nothing at all rather than write a registry that would fail at boot.

## Editing a stamped file stops upgrades to it, silently, until you notice

Nothing prevents the edit and nothing complains at build time. It surfaces at the next `create-kywi-app upgrade`, as a refusal naming the file, and the project then sits on an old render wiring while the package moves. Put the change in `kywi.config.ts`, `lib/modules.tsx` or a `sites/` layer instead — those are the seams that exist so the stamped files never need touching.

## Two things about the generated config

The emitted `kywi.config.ts` imports `defineKywiConfig`, `defineSite`, `defineTheme` and `defineModule` — but not `defineContentType`, and its one seeded type is written as a bare object literal:

contentTypes: [ { name: 'page', label: 'Page', baseType: 'content', fields: [], }, ],

## kywi.config.ts (as generated)

A literal is a valid `ContentTypeConfig` and the site works, but it skips the one default the helper applies — `defineContentType` sets `commentable: false` — so the seeded `page` type leaves that key unset. Wrap it, and your own types, in the helper: see [Designing a content type](/developing/designing-a-content-type/).

And `mode` decides which files you got, at scaffold time, and nothing after that. No core runtime branches on it; the config export and the admin's Settings surface read it to display it, and that is the whole of its use. `headless` and `decoupled` emit an identical file set; four files differ only by the mode string inside them — `kywi.config.ts`, the emitted root page (`app/page.tsx`), `README.md` (twice over), and `AGENTS.md`. [Coupled, headless, decoupled](/start/coupled--headless--decoupled/) is where that choice is made.
