Files
ipal-kit/docs/dev/project-starter-proposal.md
T
Radosław SmolińskiandClaude Opus 5.5 804a09efed Project starter: ipal-kit create <domain> generates a new site from the reference site
- bin `ipal-kit` (subcommand `create`): the architecture questions (or --answers JSON),
  rendering from reference/ through starter.manifest.json (placeholders, @starter:if variants,
  //: alternatives, demo dropped), answers into AGENTS.md "Project decisions" and ipal-doctor.json,
  local .env with a fresh PAYLOAD_SECRET, install from the shipped lockfile, ipal-skills,
  ipal-tokens, generate:types/importmap, typecheck, ipal-doctor when shipped, secret check,
  first commit
- @intecion/ipal-kit/starter: the building blocks (renderSite, validateAnswers, applyVariants,
  collectBundle, lockfileWithoutPlugin, secretFindings …)
- build:starter packs reference/ into dist/starter/template.json.gz (90 KB);
  starter:gate in prepublishOnly: site from the packed tarball, frozen install, seed, build,
  targeted SEED_ONLY seed in production mode, full seed refused, pnpm start checks
- D15: plugin dependencies pinned exactly (nodemailer 10.3.1)
- reference/: @starter:if markers (runs as before), manifest generate/variants/rewrite
- docs: project-starter.md, AGENT.md, ipal-setup, ipal-site, ipal-reference (+ api.md),
  README, PROGRAMISTA §2, CHANGELOG, docs/README, reference index

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:50:44 +01:00

43 KiB
Raw Blame History

Project starter — proposal (ipal-kit create)

Status: built (revision 3) — the user guide is docs/project-starter.md. Differences from this design, found while building: the env rules stay inline in instrumentation.ts as in the reference site (no src/env.rules.ts); no packageManager field (the reference site has none — add it there and the starter copies it); the command needs --config.auto-install-peers=false to keep dlx small (7 packages instead of 356); the templates and the lockfile travel in one bundle (dist/starter/template.json.gz); the seed command is the reference's SEED_ONLY=… pnpm seed; the language answers are limited to default pl + en (the base seed is Polish + English). Revision 3 (2026-10-29): the owner accepted every remaining recommendation (D2–D16) with two changes: MongoDB only in v1, and no Dockerfile — the team builds and checks locally, Coolify deploys the app from the repo with its default build pack, and MongoDB runs as its own Coolify resource on the same Docker network (§4.8). The doctor runs in CI only on new sites; client sites stay untouched. Revision 2 (2026-10-29): the owner chose "just ipal-kit" — the starter is a command of @intecion/ipal-kit, not a separate package (§5); D6 is done on main (0ed3898); the live-site risks in §1.3 are information only (the owner talks to the clients — no fix sessions, no edits to client sites). Branch: claude/project-starter-14fd31 · Plugin version at writing: 1.14.6 · Date: 2026-10-29

Goal: one command creates a new Payload 3 + Next 16 client site that already follows every team convention, so every project starts identical and passes ipal-doctor with zero findings on day one.

pnpm dlx @intecion/[email protected] create intecion.com

Contents: §1 survey of the existing sites · §2 the command and its questions · §3 the generated tree · §4 what each file does · §5 where it lives and how it ships · §6 staying in sync with the plugin · §7 how it fits the sibling tracks · §8 decisions for the owner · §9 build plan.


1. Survey — the seven existing sites

Read-only survey of architektimprezpl-web, coastalclimatesupplycomau-web, ecogenicacouk-web, intecioncom-web, saydiamondspl-web, thecleanteampl-web, vanstevpl-web (nothing edited).

1.1 What they already share (the starter keeps it)

  • Payload 3 + Next 16 App Router, (payload) group + a frontend group with [[...slug]] on createPageRoute.
  • proxy.ts (no middleware.ts anywhere), identical: createProxy(i18nConfig, { NextResponse, markdown: true }) with the inline matcher.
  • src/{payload.config,i18n.config,proxy,instrumentation}.ts, src/lib/content.ts (createContentHelpers), api/{health,mcp}, llms.txt, llms-full.txt, sitemap.xml, md/, robots.ts, manifest.ts, src/blocks/<Name>/, src/collections, src/globals, src/components.
  • MongoDB in production on all seven; buildR2Storage(['media'], { s3Storage }); mailAdapter(); payloadTotp 2FA; ipalKit always with i18n, access, pages, seo, forms.redirectRelationships.
  • next.config: buildSecurityHeaders, buildImagesConfig(), buildUploadSecurityHeaders(), the same htmlLimitedBots regex; build with --webpack.
  • instrumentation.ts with assertEnv(ipalEnvRules(…)) from /env, nodejs-guarded.
  • .npmrc = legacy-peer-deps=true + the @intecion registry line; .agents/skills/ipal-* committed; tsconfig excludes .agents; nobody uses .claude/skills.
  • scripts/seed-form-<name>.ts via payload run + createSeeder.
  • No site has CI, a Coolify file (nixpacks.toml) or a working Docker setup. Five build with Coolify's default (Nixpacks); the two Dockerfiles are stock Next examples.

1.2 Where they drift

Item architekt coastal ecogenica intecion saydiamonds cleanteam vanstev
ipal-kit 1.14.6 1.14.1 1.14.1 1.14.6 1.11.0 ^1.12.2 1.12.2
payload 3.90.2 ^3.0.0 (unpinned) 3.92.0 3.90.2 3.90.2 3.90.2 3.88.0
next ^16.4.3 ^16.4.3 16.4.3 16.4.3 ^16.3.6 16.2.6 ⚠ 16.2.6 ⚠
packageManager pnpm 10.34.3 pnpm 11.15.0 pnpm 10.17.1 — pnpm 10.34.7 — —
engines.node ≥22.0 ≥22.13 ≥22.23.4 ≥20.9 — ^18 || ≥20.9 —
extra DB adapters — sqlite — — — sqlite sqlite + postgres
DB env var URI URI || URL URI URI URI URL || URI URI
DB name dev …_dev/_prod (drops "com") ecogenicacouk_dev/_prod ✓ intecioncom-dev saydiamonds test in prod ⚠ vanstevpl
withSecurityConfig / CSP yes / report-only yes / report-only yes / report-only yes / report-only no / enforce no / enforce + unsafe-eval no / enforce + unsafe-eval
admin CSP + csp-report route yes yes yes yes no no no
locales / [locale] pl / no en / no en / no pl,en / yes pl,en / yes ((site)) pl,en / yes pl,en,de / yes
consentLog, indexNow yes yes yes yes yes yes no
cookieScanner yes — — yes — — —
adminMeta / agency / theme option — — — — (theme prop only) — — —
Tailwind 4 yes yes yes yes none yes yes
eslint / prettier — stub / yes — — — full / yes —
tests tsx --test — playwright — playwright vitest + playwright —
seed full named forms only foundation (refuses non-_dev) full full, creates admin from env partial full + upgrade
AGENTS ipal block / CLAUDE.md yes / yes yes / yes AGENT.md inlined ×4 / yes yes / yes no / no no / no no / no
"Project decisions" EN EN EN (renamed) PL §6 PL PL .agents/context/project.md
Docker — stock, broken — — — stock + standalone —
package name architektimprezpl-web coastalclimatesupplyau-web ✓ ✓ say-diamondspl-web the-clean-team ✓

1.3 Problems found — information only

The owner decided (2026-10-29): no fix sessions and no edits to any client site; they will ask each client whether to move to the latest ipal-kit, which supports these fixes. Kept here as context.

  1. thecleanteampl-web: per its AGENTS.md production reads the Mongo database test (URL without a db name) on the same instance as dev. Highest risk.
  2. ecogenicacouk-web: the local .env points at ecogenicacouk_prod — a plain local run writes to production.
  3. saydiamondspl-web/.env.example commits a real server IP and the Coolify internal hostname (also in thecleanteampl-web/AGENTS.md).
  4. coastalclimatesupplycomau-web/Dockerfile copies .next/standalone without output: 'standalone' (build fails); its compose file uses Node 20 against engines ≥22.13; payload unpinned.
  5. vanstevpl-web: seed hard-codes a path in a developer's home folder; PAYLOAD_SECRET has a hard-coded fallback; its own Users duplicates the injected one; payloadTotp as never; consentLog off and the default banner without logEndpoint; hand-rolled ipal:skills.
  6. thecleanteampl-web and vanstevpl-web are on Next 16.2.6 — below the 16.4.1 minimum (AGENT.md §4 item 11).
  7. saydiamonds and cleanteam set localization by hand — dead code, the plugin overwrites it.
  8. Three sites lack the ipal-reference skill and the AGENTS.md pointer block.

1.4 What the survey decides for the starter

  • MongoDB is the default (all seven); database names <dbBase>_dev / _prod exactly as ecogenica does, in DATABASE_URI only (never DATABASE_URL, never a hard-coded fallback).
  • .agents/skills (no site uses .claude/skills), "ipal:skills": "ipal-skills", ipal-reference included.
  • withSecurityConfig + report-only CSP + admin CSP + csp-report route — four sites already do it.
  • Pin everything: packageManager, engines, .nvmrc, exact payload/@payloadcms/*/next — drift in all three is the biggest source of difference today.
  • The Coolify path the team already uses: build from the repo with Coolify's default build pack (Nixpacks), no Dockerfile; Node pinned through engines so the build picks Node 22 (§4.8).
  • One "Project decisions" heading, in English, outside the ipal block; never inline AGENT.md.
  • Ship eslint/prettier (cleanteam's set) and a typecheck script — today only one site lints.
  • adminMeta, agency, theme and the cookie scanner are new; the starter makes them explicit choices.

2. The command

pnpm dlx @intecion/[email protected] create <domain> [options]   # from anywhere: creates ./<name>-web

pnpm dlx runs a package's bin named after the package (ipal-kit) when it has several, so the plugin gets one new bin, ipal-kit, with subcommands — create now; ipal-skills, ipal-doctor, ipal-tokens stay as they are (§5.1). Always give the version: it pins the templates and therefore every dependency.

Option Default What it does
<domain> — (required) production domain, e.g. intecion.com (no www., no scheme)
--dir <path> ./<domain without dots>-web target folder; must not exist or must be empty
--answers <file.json> — the architecture answers as JSON — for agents and CI; no prompts
--no-install install skip pnpm install (and therefore the checks that need it)
--no-git git skip git init and the first commit
--external [ext-a,ext-b] none also install the vendored third-party skills (ipal-skills --external)
--dry-run off print the file tree and the decisions, write nothing

Derived names (from the domain, never asked). Database names come from the plugin's own databaseNamesFor() (@intecion/ipal-kit/env, merged on main in 0ed3898) — one rule for the starter, ipalEnvRules({ databaseName }) and ipal-doctor:

Name Rule intecion.com architekt-imprez.pl
production database databaseNamesFor(domain).prod — dots removed, www. stripped intecioncom_prod architekt-imprezpl_prod
development database databaseNamesFor(domain).dev intecioncom_dev architekt-imprezpl_dev
folder / repo / package.json name <domain without dots>-web (the live sites' pattern) intecioncom-web architekt-imprezpl-web
NEXT_PUBLIC_SERVER_URL (prod) https://<www.?><domain> per the hosting answer https://intecion.com —
MCP server name <domain without dots>-site intecioncom-site —

Hyphens stay, as in the plugin rule; MongoDB accepts them. No live site has a hyphenated domain.

2.1 Architecture questions — asked up front, written into AGENTS.md

The generator asks the nine topics from AGENT.md "Ask before you build" (the same list as ipal-setup stage 0), all before it writes a single file. There is no --yes: a missing answer stops the run with the list of open topics (AGENT.md: never guess an architecture answer). Each prompt shows the recommended choice; picking it is recorded as the owner's answer, not as "default".

# Topic Prompt (choices) Drives
1 Languages locales (pl,en), default (pl), URLs: every language prefixed / default without prefix i18n.config.ts; one language → no [locale] folder, md/[[...slug]]
2 Styling the tokens track's five: primary (+ secondary/accent); heading + body font (Google name or system); theme light / dark / both + default; radius sharp / soft / round; fluid or fluid-wide src/design/tokens.ts, DESIGN.md, next/font, <SiteProviders theme> + ThemeSwitcher, Site settings → Theme seed
3 Content pages list (free text); content collections (none / blog / case studies / products / other) "Site map" + "Project decisions"; collections are not generated — ipal-collection adds them
4 Forms + e-mail forms list; recipient; transport SMTP (panel) / Microsoft Graph mailAdapter(); Graph → emailGraph: true in env rules + GRAPH_* in .env.example; the contact form in src/seed/base with the answered recipient
5 Analytics + consent tools (GA4, GTM, Meta, LinkedIn, TikTok, Clarity, none); Consent Mode advanced / basic; banner settings inline / modal / detailed; cookie scanner yes/no; browser crawl yes/no CSP flags, analytics={{ consentMode }}, <CookieBanner settings>, cookieScanner (+ crawl → cookieCrawl: true + IPAL_COOKIE_SCAN_*)
6 SEO / GEO market (PL / AU / UK / …); local business yes/no (type); AI bots allow / block-training / disallow siteJsonLd with buildLocalBusinessJsonLd; robots.aiBots; a block → ipal-audit-skip: aibots with the reason
7 Data + media media: R2 / local disk (Coolify volume). Database is always MongoDB (D12) — not asked src/db.ts (mongooseAdapter); buildR2Storage; env rules storage
8 Admin 2FA on / off (+ reason); white-label yes/no; agency credit Intecion / other { name, url } / none; panel link preview on/off twoFactor, whiteLabel, agency, adminMeta
9 Hosting Coolify server + project name; canonical host apex / www; extra domains; who adds DNS (team default) NEXT_PUBLIC_SERVER_URL, DEPLOY.md (domains, DNS table pre-filled)
+ Agent tooling external skills (none / pick); skills always in .agents/skills ipal-skills --external, tsconfig exclude

The answers file (--answers) has the same keys; the generator writes the final, complete answers to .ipal/starter.json in the site (no secrets) so ipal-doctor and a later upgrade can read them.

AGENTS.md output — AGENT.md §13 template, filled in, outside the ipal-kit:start…end block:

# AGENTS.md

**Project:** <site name> · intecion.com · market PL · industry <…>
**Languages:** pl (default), en · **Media:** R2 · **Email:** Graph

## Rules
(§13 text, unchanged)

## Site map
- <pages from answer 3> — sections written later by ipal-site

## Project decisions
- Languages: pl (default), en — every language prefixed (/pl/…, /en/…)
- Styling: tokens from scratch — primary #0B5FFF, Inter / Inter, theme system + toggle
- Content: pages Home, About, Services, Contact; collections none
- Forms + e-mail: contact form → biuro@…; transport Microsoft Graph
- Analytics/consent: GA4; Consent Mode advanced; banner detailed; cookie scanner on, crawl off
- SEO/GEO: market PL; LocalBusiness (ProfessionalService); AI bots allow
- Database + media: MongoDB (intecioncom_prod / intecioncom_dev); R2, media through the app
- Admin: 2FA on; white-label on; agency credit Intecion.com; panel link preview on
- Hosting: Coolify <server>/<project>; canonical https://intecion.com (www → apex); DNS by the team
- Agent tooling: external skills none
- Created with `ipal-kit create` 1.15.0 on 2026-11-02
<!-- ipal-kit:start --> … written by ipal-skills … <!-- ipal-kit:end -->

A "2FA off" or "AI bots blocked" answer also writes the matching ipal-audit-skip: line with the reason, so ipal-audit and ipal-doctor accept it.

2.2 What the command runs, in order

  1. Validate the domain and the target folder; collect and validate all answers (stop on any gap).
  2. Render the template (§6) into the folder: files + conditional fragments, placeholders filled.
  3. Write the local .env (git-ignored): random PAYLOAD_SECRET (crypto.randomBytes(48)), the dev database URI with <dbBase>_dev, NEXT_PUBLIC_SERVER_URL=http://localhost:3000. Nothing else.
  4. pnpm install against the lockfile shipped for this database: every locked entry kept, only the plugin and its own dependencies resolved (§5.4); the complete lockfile is committed in step 8.
  5. pnpm exec ipal-skills [--external …] — skills + the AGENTS.md/CLAUDE.md pointer; pnpm exec ipal-tokens — generates tokens.css and the contrast report (AA failure → back to question 2).
  6. pnpm generate:types && pnpm generate:importmap.
  7. pnpm typecheck && pnpm lint and pnpm exec ipal-doctor → must be zero findings (error, warning and info), else the run fails and prints them — the starter's contract with the doctor track. Every deliberate difference is written to ipal-doctor.json as a silenced rule with the reason, never hidden: CSP report-only on day 1 ("rollout: enforce after clean reports"), and each owner answer that turns a recommended module off (2FA, cookie scanner, adminMeta, agency) with the owner's reason — the same reason as the ipal-audit-skip: line.
  8. git init -b main, secret check of the index (§4.9), first commit chore: create site with ipal-kit create <version>. No remote is added.
  9. Print the report: what is wired, next steps (dev database, first user + 2FA, panel steps from ipal-setup §11), the Coolify env list and the DNS records for this domain.

Steps 4–7 need the network only for the pinned registry install; --no-install stops after step 3 and prints the remaining commands.


3. The generated tree

Shown for the default answers (pl + en, MongoDB, R2, 2FA on, cookie scanner on, theme with toggle). † = present only for some answers (§4 says which).

intecioncom-web/
├── .agents/skills/ipal-*/            # by ipal-skills — committed
├── .ipal/starter.json                # the answers + starter/plugin versions (no secrets)
├── ipal-doctor.json                  # { domain, launched: false } + silenced rules with the owner's reason
├── .github/workflows/ci.yml †        # or .gitea/workflows/ci.yml — §8 D7
├── .env                              # local only, git-ignored, never committed
├── .env.example                      # from ipalEnvRules (§4.4) — committed, no values
├── .gitignore
├── .npmrc                            # @intecion registry + legacy-peer-deps (no token)
├── .nvmrc                            # 22
├── .prettierrc.json
├── AGENTS.md                         # §2.1 output + ipal-kit pointer block
├── CLAUDE.md                         # @AGENTS.md (by ipal-skills)
├── DESIGN.md                         # 9 sections, values from answer 2 (tokens track)
├── eslint.config.mjs
├── next.config.ts                    # withPayload(withSecurityConfig(…)), CSP report-only
├── package.json                      # exact versions, scripts (§4.1), pnpm.overrides
├── pnpm-lock.yaml                    # the shipped lockfile for this variant
├── postcss.config.mjs
├── tsconfig.json                     # exclude node_modules + the skills folder
├── docs/DEPLOY.md                    # Coolify + DNS for this domain (§4.8)
└── src/
    ├── app/
    │   ├── (frontend)/
    │   │   ├── styles.css            # imports only — identical on every site (tokens track)
    │   │   └── [locale]/             # † single language: no [locale]
    │   │       ├── layout.tsx        # SiteProviders, CookieBanner, Header/Footer, fonts
    │   │       ├── actions.ts        # sendForm = createSubmitAction(…)
    │   │       ├── not-found.tsx · notFoundView.ts
    │   │       └── [[...slug]]/page.tsx
    │   ├── (payload)/…               # Payload admin (generated, importMap.js)
    │   ├── api/{health,mcp,csp-report}/route.ts
    │   ├── llms.txt/ · llms-full.txt/ · indexnow-key.txt/ · sitemap.xml/   # route.ts each
    │   ├── md/[locale]/[[...slug]]/route.ts
    │   ├── manifest.ts · robots.ts
    ├── blocks/registry.ts            # createBlockRegistry(content) — blocks + UI primitives come from the plugin
    ├── collections/{Pages,Media}.ts  # Pages.layout = libraryBlocks({ … }) from @intecion/ipal-kit/blocks
    ├── components/
    │   ├── forms/formClasses.ts
    │   └── layout/{Header,Footer}.tsx   # ui/ only for a primitive the project overrides (ui: { Media })
    ├── globals/{Header,Footer,Company}.ts
    ├── db.ts                         # the database adapter (MongoDB)
    ├── seed/                         # seed.ts (`--only page:…,form:…,global:…`, §4.7) + base/
    ├── lib/content.ts                # createContentHelpers — the only data access
    ├── design/tokens.ts · tokens.css # brand tokens; tokens.css generated by `ipal-tokens`
    ├── content.config.ts · i18n.config.ts
    ├── env.rules.ts                  # the ONE ipalEnvRules call (instrumentation + env:check + .env.example)
    ├── instrumentation.ts
    ├── payload.config.ts
    └── proxy.ts

Not generated: any content collection (blog etc. — ipal-collection), real content (ipal-site phase 6), middleware.ts, anything in public/ that the plugin serves as a route.


4. What each part does

4.1 package.json

  • name = folder name, private: true, type: module, engines.node: ">=22 <23", packageManager: "pnpm@<exact>" (corepack, pinned).
  • Exact versions for everything (no ^): @intecion/ipal-kit, payload and every @payloadcms/* at the same version, next + eslint-config-next at the same 16.4.x (≥ 16.4.1), sharp ≥ 0.35.5, react/react-dom, @clocklimited/payload-2fa (only with 2FA), @payloadcms/storage-s3 (only with R2), the db adapter for the chosen database. pnpm.overrides: every @payloadcms/* pinned to the payload version + the advisory overrides from AGENT.md §4 item 12. The set comes from the release's shipped lockfile (§5.4) — the starter never resolves "latest".
  • Scripts (one name per job, same in every site):
Script Command
dev next dev
build cross-env NODE_OPTIONS="--max-old-space-size=3072" next build --webpack
start next start
typecheck tsc --noEmit
lint / format eslint . / prettier --write .
payload payload
generate:types / generate:importmap payload generate:types / payload generate:importmap
seed payload run src/seed/seed.ts (SEED_ONLY=… pnpm seed)
env:check payload run src/env.check.ts (asserts envRules and prints the result)
ipal:skills ipal-skills (+ the chosen --dest)
doctor ipal-doctor

4.2 payload.config.ts

ipal-setup stage 3 with the answers filled in: ipalKit({ i18n, access, pages, content, seo, forms, twoFactor: { issuer: '<site name>', plugin: payloadTotp } | false, whiteLabel, agency, adminMeta, cookieScanner, indexNow: true, consentLog: true, revalidatePath }), email: mailAdapter(), buildR2Storage(['media'], { s3Storage }) (always wired — R2 works by itself when the keys are there). Only options that differ from the plugin default are written (adminMeta on and the Intecion agency are defaults, so they appear only when turned off or changed) — the file stays short and the plugin's defaults keep flowing in on upgrades.

Database: mongooseAdapter({ url: process.env.DATABASE_URI }) in src/db.ts. The database name lives only in DATABASE_URI (…/intecioncom_dev locally, …/intecioncom_prod in Coolify); no name in code.

4.3 next.config.ts — security

Exactly ipal-setup stage 7: withPayload(withSecurityConfig({...})), buildSecurityHeaders({ hsts: production, csp: { mode: 'report-only', reportUri: '/api/csp-report', r2Url, turnstile: true, …flags } }), buildAdminCspHeaders(csp) on /admin/:path*, buildUploadSecurityHeaders(), buildImagesConfig(), htmlLimitedBots. The CSP flags come from answer 5 (analytics, metaPixel, linkedIn, tiktok, clarity). src/app/api/csp-report/route.ts = createCspReportRoute(). DEPLOY.md has the step "after a week of clean [csp] logs switch to mode: 'enforce'".

4.4 Environment — one rule set, three uses

src/env.rules.ts exports envRules = ipalEnvRules({ storage, ipHeader: true, emailGraph, cookieCrawl, databaseName: { domain: '<domain>' } }) (the domain is given, because NEXT_PUBLIC_SERVER_URL is localhost in dev) (with the R2_PUBLIC_URL optional mapping from ipal-setup). It is used by:

  1. src/instrumentation.ts → assertEnv(envRules) (nodejs runtime only, import from /env);
  2. pnpm env:check → the same check on demand (Coolify Terminal, CI);
  3. the generator → .env.example is rendered from the same rules (name, description, required in production) at template build time, so the example and the validation can never drift.

.env.example also lists the non-validated variables the plugin reads (IPAL_NOINDEX, INDEXNOW_KEY, Turnstile fallback) with a comment, and the database line as DATABASE_URI=mongodb://localhost:27017/intecioncom_dev.

4.5 Frontend wiring

proxy.ts, lib/content.ts, layout, catch-all, 404, all SEO/GEO routes: ipal-setup stages 6–8 1:1, answers filled in (markdown: true, mcp.serverName, siteJsonLd for a local business, robots.aiBots). Layout: <SiteProviders shell logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="<answer>" />} analytics={{ consentMode }} theme> + Header/Footer + <MediaPreconnect/>. Theme answer "light only" → no theme prop and no switcher.

  • 2FA on (recommended): twoFactor + @clocklimited/payload-2fa + import map; check in the report: a new admin lands on /admin/setup-totp?back=%2Fadmin. Off: twoFactor: false, the dependency is left out, ipal-audit-skip: twofactor — <reason> in "Project decisions".
  • Cookie scanner on: cookieScanner: true (+ crawl: true → env rules cookieCrawl and the two env variables); the report lists the editor steps (Scan cookies → Approve and add) for after launch.
  • White-label + agency + adminMeta as answered.

4.7 Seeds — named records only

The plugin's createSeeder already has the record list and the full-seed guard (D6 done, main 0ed3898):

SEED_ONLY="pages:kontakt,forms:Contact form,global:header" pnpm seed   # after launch: named records only
SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed                    # plan only
pnpm seed                                                              # before launch, local _dev database
  • src/seed/base/*.ts hold the reference site's seed:base set (system pages, globals, contact form, banner and notification texts); seed:demo is dropped. src/seed/seed.ts passes them to createSeeder (create-only, idempotent, every locale, [TO FILL: …], no users/media/secrets).
  • A run without SEED_ONLY against production or a non-local database is refused by the plugin unless IPAL_SEED_ALLOW_FULL=1 (the owner's explicit OK). The starter writes no guard of its own.
  • docs/DEPLOY.md has the Coolify Terminal steps: dry run with the list → Backup now → the real run.

4.8 Coolify — the team's existing path, written into docs/DEPLOY.md

No Dockerfile, no compose file, no new image model — the same process as the five live sites that deploy without one (§1.1):

  1. Locally: pnpm build && pnpm start, the checks (ipal-doctor, ipal-seo-check), commit, push.
  2. Coolify app from the Git repo, Coolify's default build pack (Nixpacks). It reads pnpm-lock.yaml and packageManager (pnpm, pinned) and engines.node (>=22 <23 → Node 22). Commands in the app's build settings: install pnpm install --frozen-lockfile, build pnpm generate:types && pnpm build, start pnpm start. Port 3000, no host port mapping, health check GET /api/health.
  3. MongoDB is a separate Coolify database resource (its own container) in the same project, on the same Docker network as the app. DATABASE_URI = the resource's internal URL with the database name added: mongodb://<user>:<password>@<internal-host>:27017/<dbBase>_prod?authSource=admin. Host and credentials stay in Coolify's env only — never in .env.example, AGENTS.md or DEPLOY.md (two live sites leak one, §1.3).
  4. Seeds run in the app container: Coolify → the app → Terminal. The build pack image is the whole repo with node_modules, so src/seed/, the Payload CLI and pnpm are there, and the container has the runtime env (production DATABASE_URI, NODE_ENV=production):
    SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed   # 1. plan — must list only the named records
    #                                                     2. Coolify → MongoDB resource → Backups → Backup now
    SEED_ONLY="pages:kontakt" pnpm seed                  # 3. the real run
    
    Without SEED_ONLY the plugin refuses the run on production (createSeeder guard, D6). The release gate (§5.3) runs this exact command in a container built the same way, so it is proven to work.

docs/DEPLOY.md (generated, domain filled in) holds these steps plus: domains https://intecion.com,https://www.intecion.com with the redirect to the canonical host, the env list with build-time / runtime flags (deployment.md §4.2; DATABASE_URI and PAYLOAD_SECRET also at build time only when pages prerender from the database, §3a3), scheduled MongoDB backups to S3/R2, R2 or a persistent volume for media, the DNS records from deployment.md §6 with this domain's names, and rollback notes.

4.9 Git and secrets

  • .gitignore: .env, .env.* except .env.example, node_modules, .next, media/, *.tsbuildinfo.
  • Before the first commit the generator scans the index: no .env, no line matching (SECRET|TOKEN|PASSWORD|KEY)=\S outside .env.example, no private-key blocks — any hit aborts.
  • .npmrc holds only the registry line; the Gitea token stays in ~/.npmrc (PROGRAMISTA §1).
  • One commit on main; no remote, no push — the developer adds the Gitea remote.

5. Where it lives and how it ships

5.1 A command of @intecion/ipal-kit (owner's choice)

  • Bin: bin/ipal-kit.mjs, a small dispatcher: ipal-kit create … → bin/create/*.mjs. Node built-ins only (node:fs, node:zlib, node:readline/promises, node:crypto, node:child_process), no imports from dist/ except the plain databaseNamesFor helper — so it runs without Payload or Next loaded.
  • Why a dispatcher named ipal-kit: with several bins in one package pnpm dlx @intecion/ipal-kit … runs the bin named after the package; any other name needs the longer pnpm --package=@intecion/[email protected] dlx ipal-create …. The existing bins stay for compatibility; the dispatcher can later also forward skills, doctor, tokens.
  • Inside a project (an agent that already has the plugin installed): pnpm exec ipal-kit create <domain> --dir ../<name>-web works the same; it refuses to write into the current project.
  • Peer dependencies under dlx: pnpm installs the plugin's peers (Payload, Next, React…) into its dlx cache by default. They land in the shared pnpm store, which the new site's install then reuses (hard links), so the second download is small; the generator itself never loads them. To be measured in build step 1; if it is slow, the docs add --config.auto-install-peers=false to the command (to be verified on pnpm 10).

5.2 Size cost in the published tarball

Measured inputs: the plugin today is ~9.3 MB unpacked (dist 7.2 MB, docs 2.1 MB). A live site's pnpm-lock.yaml is ~195 KB (~61 KB gzipped); the reference site's skeleton (demo dropped) is estimated at 0.3–0.5 MB of source text.

Shipped file Unpacked size (estimate)
dist/starter/template.json.gz — every kept file as { path: content }, gzip -9 ~80–120 KB
dist/starter/lock.yaml.gz (MongoDB only) ~60 KB
bin/ipal-kit.mjs + bin/create/* ~30 KB
Total ~0.2 MB, about 2 % of the package

Stored gzipped, so every project that installs the plugin carries ~0.25 MB more on disk; the download grows by about the same (the npm tarball is gzipped already). The generator unpacks with node:zlib — no tar library. Exact numbers go into the build report and the CHANGELOG entry.

5.3 Release

One package, one version, one release step. prepublishOnly gains build:starter: read reference/starter.manifest.json, bundle the kept files, prepare the lockfile(s) (§5.4), then test the packed tarball: pnpm pack → pnpm dlx ./ipal-kit-X.Y.Z.tgz create release-check.example → install → typecheck → next build → ipal-doctor --strict → build the site the way Coolify does (the nixpacks CLI, version pinned in CI) and, in that container against a throw-away MongoDB container on the same Docker network, run SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed and the real run — this proves the §4.8 Terminal command works in the deployed image (pnpm, the Payload CLI and src/seed/ present). Failure blocks the publish. reference/ is not in files; only the bundle is. The owner approves the publish as for every release.

5.4 Nothing unpinned — the lockfile

  • The generator never runs create-payload-app, git clone, curl or …@latest; templates come from the tarball, not from the Git tag.
  • The shipped lockfile is the reference site's resolved tree, with the plugin rewritten from link:.. to the exact version X.Y.Z. One catch: the plugin's own lockfile entry needs the integrity hash of the tarball being built, which does not exist yet. So the shipped lockfile holds every package except @intecion/ipal-kit itself and its four direct dependencies (lucide-react, nodemailer, server-only, slugify). The generator runs pnpm install (not frozen): pnpm keeps every locked entry as it is and resolves only the plugin (exact X.Y.Z in package.json) and those four. The resulting complete lockfile is committed in the first commit; from then on --frozen-lockfile (Coolify's install command, CI).
  • To close the last gap, D15: pin the plugin's four dependencies to exact versions in its own package.json. Then two sites created from the same release get identical trees.
  • External skills come only from ipal-skills --external (vendored, hash-checked).
  • The only network access is the install from the team registry + npm.

6. Staying in sync with the plugin

Templates are generated from the reference site, not maintained by hand.

reference site (runnable, all features on, CI-green with ipal-kit X.Y.Z)
   │  pnpm build:starter → dist/starter/*.gz   (prepublishOnly)
   ▼
@intecion/ipal-kit tarball   ← kept files + lockfile, placeholders and variant markers intact
   │  pnpm dlx @intecion/[email protected] create <domain>   (developer's machine)
   ▼
new site  ── ipal-doctor: 0 findings
  • "Project decisions" in the reference AGENTS.md sit between <!-- starter:decisions --> markers; the starter replaces that block with the owner's answers.
  • One manifest, owned by the reference site: reference/starter.manifest.json (the reference session's proposal) marks every path keep, drop (demo) or template, and lists whole-file variants ({ "if": "theme" }). The starter keeps no template files and no mapping of its own.
  • Placeholders. The reference site uses one made-up company with unique fake values (example-studio.pl, examplestudiopl_dev); the manifest maps them to {{domain}}, {{dbBase}}, {{projectName}}, {{siteName}}, {{locales}}, {{issuer}}, {{mcpName}}, {{serverUrl}}. The build fails when a mapped value is missing or an unmapped fake value shows up in a new file.
  • Variants inside a file are comments that keep the reference site runnable: // @starter:if theme … // @starter:endif ({/* @starter:if theme */} in TSX). Flags: theme, cookieScanner, crawl, graph, localBusiness, twoFactor, singleLocale, one per analytics/CSP tool. The reference site runs "everything on"; the CI matrix proves the other combinations.
  • What is dropped: src/seed/demo/, seed-media/, the Blocks showcase page (the /design styleguide is the reference's D5), .env, generated files (payload-types.ts, importMap.js — regenerated on step 6), the reference site's own CI and notes.
  • Release gate (CI in the ipal-kit repo): build templates → generate the matrix (pl+en / pl only × the toggles that change code) → pnpm install (§5.4) → typecheck, lint, next build (database service container), ipal-doctor = 0, ipal-audit quick = 0. Any failure blocks the starter release; the plugin can still ship.
  • Agent guide: a new option or wiring step lands in the reference site, then AGENT.md/skills in the same change (CLAUDE.md rule); the starter picks it up with no template edit. ipal-doctor checks the same rules, so "starter output" = "what the doctor expects" by construction.
  • Existing sites are not touched by the starter. They converge through ipal-upgrade + ipal-doctor findings; .ipal/starter.json lets the doctor tell starter-made sites from older ones.

Order of work: the reference site comes first; the starter's generator can be written and unit-tested in parallel against a small fixture tree and switches to reference/ once it is green. No stop-gap templates are maintained by hand.


7. Fit with the sibling tracks

Track What the starter takes Status (notes folder, 2026-10-29)
reference site (reference/ in the plugin repo, not shipped) the whole template source via starter.manifest.json; seed:base kept, seed:demo dropped; MongoDB only; no Dockerfile (owner, D9) aligned — starter-vs-reference.md
design tokens DESIGN.md (9 fixed sections), src/design/tokens.ts via defineTokens() from @intecion/ipal-kit/tokens (light entry, no Payload import) (+ tokens.css generated by ipal-tokens; fallback: hand-written tokens.css, same path — tokens D1), the fixed styles.css imports, next/font with --font-family-body / --font-family-heading (not --font-body: a var() cycle with Tailwind's font-body key); questions: primary (+ secondary/accent), heading/body font, theme light/dark/both + default, radius sharp/soft/round, fluid vs fluid-wide; ipal-tokens contrast report into DESIGN.md (AA failure → ask again) aligned with design-tokens-wiring.md; built on claude/design-tokens-build (9511b12); answer 2 in §2.1 expands to these five questions
block library imported, not copied: libraryBlocks({ … }) in Pages.layout (/blocks), registry.ts = createBlockRegistry(content) (/blocks/rsc, also the five UI primitives — the project writes one only to override it), page templates from /templates for seed/base; default set hero, textMedia, featureGrid, cta, richText, faq, contact, gallery; after a block-list change generate:types + generate:importmap aligned with block-library-for-starter.md
ipal-doctor step 7 of the run and the release gate: zero findings incl. info; ipal-doctor.json { domain, launched: false, rules: { <rule>: { off, reason } } } aligned — ipal-doctor-for-starter.md (doctor commit 7bdc5d6)

Conflicts between the drafts — all settled with the sibling sessions (2026-10-29):

  1. src/ top level: the doctor's exported allow list now includes seed/, design/, db.ts, env.rules.ts, content.config.ts; a project extends it with ipal-doctor.json "layout": { "allow": […] }.
  2. components/ui/: required only without createBlockRegistry (block library agreed; the doctor warns when a project primitive in ui/ is not passed through createBlockRegistry({ ui })).
  3. Optional modules: silenced per rule with a reason — "rules": { "2fa": { "off": true, "reason": "…" } }; silenced findings don't fail --strict; an entry without a reason is ignored and reported. The starter writes these entries from the owner's answers (and one for CSP report-only).
  4. Plugin version: "not the latest" is a warning naming the newer version, an error only two or more minors behind (doctor's D2, owner to confirm) — a site made from an older starter release still passes.

All four depend on owner approvals of their own proposals; the starter follows whatever they settle, because it only copies the reference site.


8. Decisions for the owner

All decisions are settled (owner, 2026-10-29: "Accept all", with D9 and D12 changed as below).

# Decision Status
D1 A command of @intecion/ipal-kit: pnpm dlx @intecion/[email protected] create <domain> (§5.1) decided
D2 The reference site is the only hand-edited tree; the starter is generated from it through reference/starter.manifest.json accepted
D3 Exact dependency versions in new sites (no ^, packageManager, engines), upgrades via ipal-upgrade accepted
D4 Database names from the plugin's databaseNamesFor (hyphens kept) settled
D5 @payloadcms/storage-s3 and @clocklimited/payload-2fa always installed (one lockfile) accepted
D6 createSeeder record list + full-seed guard done — main 0ed3898
D7 Gitea Actions CI in new sites only (typecheck, lint, build, ipal-doctor); client sites untouched accepted
D8 Skills in .agents/skills accepted
D9 No Dockerfile. Build and check locally; Coolify builds from the repo with its default build pack; MongoDB as its own Coolify resource on the same Docker network; seeds in the app container's Terminal (§4.8) decided by the owner
D10 Single-language sites in v1 accepted
D11 Node 22 pinned in .nvmrc and engines; pnpm pinned in packageManager accepted
D12 MongoDB only in v1 — no --db option, no second lockfile, no Postgres CI job; Postgres stays a later, one-file addition (src/db.ts) decided by the owner
D13 The §1.3 live-site problems: information only — no fix sessions, no edits to client sites decided by the owner
D14 The four §7 conflicts as settled with ipal-doctor and the block library accepted
D15 Pin the plugin's four runtime dependencies to exact versions accepted
D16 One ipal-kit dispatcher bin (create now; later skills, doctor, tokens) accepted

9. Build plan (after approval)

  1. bin/ipal-kit.mjs dispatcher + create: CLI, prompts, answers schema, renderer, secret check, report — unit-tested against a small fixture tree; measure the dlx peer cost (§5.1).
  2. build:starter: bundle from reference/starter.manifest.json, lockfile preparation (§5.4), the packed-tarball check in prepublishOnly; the matrix CI with ipal-doctor --strict once the reference site and the doctor are green.
  3. Docs and skills in the same change (CLAUDE.md rule): AGENT.md "Ask before you build" + §13/§14, ipal-setup stage 1 ("new site → ipal-kit create; existing site → the manual stages"), ipal-reference (the bin and its options), PROGRAMISTA §2, deployment.md → docs/DEPLOY.md, CHANGELOG with the size cost.
  4. Release with the next plugin version; try it on one real new site before announcing.