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]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
154049662e
commit
804a09efed
+16
-1
@@ -11,9 +11,19 @@ once there are more than 20.
|
||||
## Unreleased
|
||||
|
||||
Database names follow one rule, and seeding a live site touches only the records you name. The block library:
|
||||
fifteen ready page sections and ten page templates.
|
||||
fifteen ready page sections and ten page templates. A new site in one command: `ipal-kit create`.
|
||||
|
||||
### New
|
||||
- **`ipal-kit create` — a new site in one command** ([project-starter.md](./project-starter.md)):
|
||||
`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create intecion.com` asks the architecture
|
||||
questions (or reads `--answers answers.json`), generates the site from the reference site (`reference/` through
|
||||
`starter.manifest.json`: placeholders, `@starter:if` variants, demo left out), writes the answers into `AGENTS.md` →
|
||||
Project decisions and `ipal-doctor.json`, installs from a shipped lockfile, runs `ipal-skills`, `ipal-tokens`,
|
||||
`generate:types`, `generate:importmap`, `typecheck`, checks for secrets and makes the first commit. New bin `ipal-kit`
|
||||
(subcommand `create`), new entry `@intecion/ipal-kit/starter` with the building blocks (`renderSite`,
|
||||
`validateAnswers`, `applyVariants`, `collectBundle` …). New scripts `build:starter` and `starter:gate` in
|
||||
`prepublishOnly`: a site made from the packed tarball must install frozen, seed, build, run the targeted seed in
|
||||
production mode and serve `/pl` before a publish. Adds ~180 KB to the tarball.
|
||||
- **Design-token standard** ([design-tokens.md](./design-tokens.md)): one set of `--ipal-*` names for every site,
|
||||
only the values differ per brand. `@intecion/ipal-kit/tokens.css` (neutral defaults, light/dark on `data-theme`,
|
||||
`[data-surface="inverse"]` scope, reduced motion), `@intecion/ipal-kit/tailwind.css` (Tailwind 4 preset: `bg-surface`,
|
||||
@@ -50,6 +60,11 @@ fifteen ready page sections and ten page templates.
|
||||
plugin repo (`reference/`, not shipped) and is built, seeded and smoke-tested in the plugin's CI.
|
||||
|
||||
### Changed
|
||||
- The plugin's own dependencies are pinned to exact versions (`lucide-react` 0.400.0, `nodemailer` 10.3.1,
|
||||
`server-only` 0.0.1, `slugify` 1.6.9), so two sites created from the same release get identical trees. Projects:
|
||||
nothing to do (pnpm installs the pinned versions; `nodemailer` moves from 10.2.1 to 10.3.1).
|
||||
- The reference site carries `@starter:if` markers (comment lines) and the starter's alternatives as `//: ` lines;
|
||||
it runs exactly as before.
|
||||
- **Cookie banner / button colours** read the single token names (`--ipal-surface`, `--ipal-text` …) instead of
|
||||
`dark:` + `--ipal-*-dark`. With `tokens.css` they switch with the theme. Without it, the built-in fallback follows the
|
||||
page's `color-scheme` (`light-dark()`): a site without a dark theme no longer gets a dark banner on a dark-mode
|
||||
|
||||
@@ -29,6 +29,7 @@ API details — one file per module:
|
||||
| Under construction — locks subpages behind a popup (developer tool) | [construction.md](./construction.md) |
|
||||
| Routing, archives, redirects, Markdown, search | [content.md](./content.md) |
|
||||
| Site frontend: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](./frontend.md) |
|
||||
| New site in one command (`ipal-kit create`, `@intecion/ipal-kit/starter`) | [project-starter.md](./project-starter.md) |
|
||||
| Deployment, production variables, health check | [deployment.md](./deployment.md) |
|
||||
| Seeds: create-only, dry run, backup, production update guard | [seeding.md](./seeding.md) |
|
||||
| Email SMTP / Graph | [email.md](./email.md) |
|
||||
|
||||
@@ -78,6 +78,11 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
|
||||
| Admin | 2FA, white-label (client brand in the panel), agency credit |
|
||||
| Hosting | Coolify, the production domain(s), who adds the DNS records (deployment.md §6) |
|
||||
|
||||
- **A new site starts with `ipal-kit create`** (docs/project-starter.md): `pnpm --config.auto-install-peers=false dlx
|
||||
@intecion/ipal-kit@<version> create <domain>` asks exactly these questions (or reads them from `--answers file.json`),
|
||||
generates the site from the reference site, writes the answers into `AGENTS.md` and makes the first commit. Ask the owner
|
||||
first, then pass the answers — the command never fills a gap. The manual path (`ipal-setup` stages 1–11) is for an
|
||||
existing project or what the command does not cover yet (another default language, no URL prefix, Postgres).
|
||||
- Write every answer into the project's `AGENTS.md` → **"Project decisions"** (one line per topic).
|
||||
- **Do not guess a missing answer.** No answer to an architecture question → do not build that part; ask again.
|
||||
(Only *content* gaps — company data, texts, IDs — may wait: use `[TO FILL: …]` in the panel, §0a.)
|
||||
@@ -1314,6 +1319,7 @@ Anything that needs a developer → move it to the panel.
|
||||
| R2, `buildImagesConfig`, YouTube | [storage.md](../storage.md) |
|
||||
| Front end: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](../frontend.md) |
|
||||
| Integrations (the `site-integrations` global, statuses, email test) | [integrations.md](../integrations.md) |
|
||||
| New site from the reference site: `ipal-kit create`, `@intecion/ipal-kit/starter` | [project-starter.md](../project-starter.md) |
|
||||
| Deployment, production env, health check | [deployment.md](../deployment.md) |
|
||||
| Seeds on production: create-only, dry run, backup, update guard | [seeding.md](../seeding.md) |
|
||||
| Meta Pixel / GA4 via GTM | [gtm-meta-pixel.md](../gtm-meta-pixel.md) |
|
||||
|
||||
@@ -25,7 +25,7 @@ Rules: AGENT.md §13, §0a.
|
||||
| `README.md` | how to run the reference site and what is where |
|
||||
| `docs/DEPLOY.md` | the Coolify runbook: local check, app settings, MongoDB resource, env, targeted seeds, DNS, rollback |
|
||||
| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) |
|
||||
| `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By (below) |
|
||||
| `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By |
|
||||
| `package.json` | scripts (build, start, seed, tokens, generate), pinned Payload versions and overrides |
|
||||
| `playwright.config.ts` | smoke tests against the built, seeded site (below) |
|
||||
| `postcss.config.mjs` | Tailwind 4 through PostCSS (below) |
|
||||
@@ -67,48 +67,6 @@ legacy-peer-deps=true
|
||||
}
|
||||
```
|
||||
|
||||
### `next.config.ts`
|
||||
|
||||
```ts
|
||||
import type { NextConfig } from 'next'
|
||||
|
||||
import {
|
||||
buildAdminCspHeaders,
|
||||
buildImagesConfig,
|
||||
buildSecurityHeaders,
|
||||
buildUploadSecurityHeaders,
|
||||
withSecurityConfig,
|
||||
} from '@intecion/ipal-kit'
|
||||
import { withPayload } from '@payloadcms/next/withPayload'
|
||||
|
||||
// CSP enforced: the reference site is the example after the report-only phase (security.md → "ROLL OUT CSP").
|
||||
// Flags = what the site loads: Turnstile on forms, Google analytics/GTM when IDs are set in Site integrations.
|
||||
const csp = { mode: 'enforce', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const
|
||||
|
||||
const securityHeaders = buildSecurityHeaders({
|
||||
csp: { ...csp, analytics: true, turnstile: true },
|
||||
hsts: process.env.NODE_ENV === 'production',
|
||||
})
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// ALLOW_LOCAL_MEDIA=1 (local / CI production checks only): let next/image optimize files the app serves on localhost
|
||||
images: buildImagesConfig(process.env.ALLOW_LOCAL_MEDIA === '1' ? { production: false } : {}),
|
||||
// Metadata in <head> for crawlers (deployment.md §3a)
|
||||
htmlLimitedBots:
|
||||
/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Yandex|DuckDuckBot|Baiduspider|Screaming Frog|AhrefsBot|SemrushBot/i,
|
||||
async headers() {
|
||||
return [
|
||||
{ source: '/:path*', headers: securityHeaders },
|
||||
{ source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, // after the site-wide rule
|
||||
...buildUploadSecurityHeaders(),
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
// withSecurityConfig: no X-Powered-By (Next's and Payload's)
|
||||
export default withPayload(withSecurityConfig(nextConfig))
|
||||
```
|
||||
|
||||
### `playwright.config.ts`
|
||||
|
||||
```ts
|
||||
@@ -200,8 +158,12 @@ import type { ContentOption } from '@intecion/ipal-kit'
|
||||
*/
|
||||
export const contentConfig: ContentOption = {
|
||||
collections: [
|
||||
// @starter:if posts
|
||||
{ slug: 'posts', label: 'Blog', perPage: 9 },
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
{ slug: 'caseStudies', label: 'Case studies', perPage: 9 },
|
||||
// @starter:endif
|
||||
],
|
||||
}
|
||||
```
|
||||
@@ -245,9 +207,21 @@ export function register() {
|
||||
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
|
||||
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
|
||||
assertEnv(
|
||||
ipalEnvRules({ databaseName: { domain: 'example-studio.pl' }, ipHeader: true, storage: process.env.ALLOW_LOCAL_MEDIA !== '1' }).map((rule) =>
|
||||
rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule,
|
||||
),
|
||||
ipalEnvRules({
|
||||
// @starter:if crawl
|
||||
//: cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN — the shared cookie-crawler service
|
||||
// @starter:endif
|
||||
databaseName: { domain: 'example-studio.pl' },
|
||||
// @starter:if graph
|
||||
//: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph
|
||||
// @starter:endif
|
||||
ipHeader: true,
|
||||
// @starter:if r2
|
||||
storage: process.env.ALLOW_LOCAL_MEDIA !== '1',
|
||||
// @starter:else
|
||||
//: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions)
|
||||
// @starter:endif
|
||||
}).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)),
|
||||
)
|
||||
}
|
||||
```
|
||||
@@ -566,12 +540,18 @@ import { libraryBlocks, type LibraryBlocksOptions } from '@intecion/ipal-kit/blo
|
||||
export const blockOptions = {
|
||||
contact: true,
|
||||
cta: true,
|
||||
// @starter:if collections
|
||||
entryList: {
|
||||
collections: [
|
||||
// @starter:if posts
|
||||
{ label: { en: 'Blog posts', pl: 'Wpisy' }, value: 'posts' },
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
{ label: { en: 'Case studies', pl: 'Realizacje' }, value: 'caseStudies' },
|
||||
// @starter:endif
|
||||
],
|
||||
},
|
||||
// @starter:endif
|
||||
faq: true,
|
||||
featureGrid: true,
|
||||
gallery: true,
|
||||
|
||||
@@ -195,6 +195,7 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| a11y widget CSS | `styles.css` | `@import "@intecion/ipal-kit/a11y.css";` (only with `<AccessibilityWidget>`) | widget options change the page | accessibility.md |
|
||||
| `/its` panel | `app/(payload)/its/…` | `adminRoute: '/its'` + `its` in the proxy matcher | `/its` login, `/admin` 404 | security.md |
|
||||
| skills | `package.json` | `"ipal:skills": "ipal-skills"` | `.agents/skills/` up to date | PROGRAMISTA §2.1a |
|
||||
| a new site | CLI (from the parent folder) | `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> [--answers answers.json] [--dir] [--external] [--no-install] [--no-git] [--dry-run]`; in a project: `pnpm exec ipal-kit create <domain> --dir ../<name>-web`. Building blocks: `@intecion/ipal-kit/starter` (resources/api.md) | one commit, `AGENTS.md` decisions filled, `pnpm typecheck` passes | project-starter.md |
|
||||
| eject a library block | CLI | `pnpm exec ipal-blocks list` / `pnpm exec ipal-blocks eject faq [--dest src/blocks] [--dry-run]` → `src/blocks/Faq/`; then the ejected builder in `blockOptions`' place and `components: { faq: FaqBlock }` | the block renders from the project file | block-library.md "Own blocks and eject" |
|
||||
|
||||
**`createContentHelpers` keys (exports of `@/lib/content`)** — all lazy and cached per request:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# ipal-kit — export index
|
||||
|
||||
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
|
||||
`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`), grouped by module. Search with grep
|
||||
`/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`), grouped by module. Search with grep
|
||||
(`grep -n "name" .agents/skills/ipal-reference/resources/api.md`) before you write anything yourself.
|
||||
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
|
||||
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
|
||||
@@ -739,6 +739,31 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
|
||||
**Types:** `ThemeOptions` (root, `ipalKit({ theme })`), `Theme`, `ThemeSetting`, `ThemeConfig` (root, `/client`) — theme, setting from the panel and theme options; `ThemeScriptProps` (`/rsc`), `ThemeSwitcherProps`, `ThemeSwitcherClassNames` (`/client`) — component props.
|
||||
|
||||
## Project starter (`starter`) — details: `node_modules/@intecion/ipal-kit/docs/project-starter.md`
|
||||
|
||||
Bin: `ipal-kit create <domain>` (`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create …`).
|
||||
`@intecion/ipal-kit/starter` uses Node built-ins only (no Payload) — the building blocks of the command.
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `runCreateCli(args, log?)`, `CREATE_USAGE` | `@intecion/ipal-kit/starter` | The command (`ipal-kit create`) — returns the exit code. |
|
||||
| `parseCreateArgs(args)`, `normalizeDomain(input)`, `localEnv(example)` | `@intecion/ipal-kit/starter` | Its pieces: options, `https://www.X.pl/` → `x.pl` (punycode), `.env` with a fresh `PAYLOAD_SECRET`. |
|
||||
| `validateAnswers(input)`, `STARTER_TOPICS` | `@intecion/ipal-kit/starter` | The architecture answers (`StarterAnswers`): every missing / invalid one as a line; `[]` = valid. |
|
||||
| `flagsFromAnswers(answers)` | `@intecion/ipal-kit/starter` | The `@starter:if` flags the answers turn on (`twoFactor`, `posts`, `crawl`, `r2`, `enforceCsp: false`, `demo: false`…). |
|
||||
| `askAnswers(ask)` | `@intecion/ipal-kit/starter` | The questions with any `ask(question) → Promise<string>` (terminal, chat bridge). |
|
||||
| `collectBundle(dir)`, `packBundle(bundle)`, `unpackBundle(buffer)`, `bundleFlags(bundle)` | `@intecion/ipal-kit/starter` | `reference/` → the bundle (fails on a fake value in a kept file) → gzip and back; the flags the markers use. |
|
||||
| `renderSite(bundle, answers, ctx)`, `placeholderValues(answers, ctx)` | `@intecion/ipal-kit/starter` | The new site's files (path → content), in memory; the value of every `{{token}}`. |
|
||||
| `applyVariants(text, flags, file?)`, `variantFlags(text)` | `@intecion/ipal-kit/starter` | `@starter:if` / `else` / `endif` blocks (nesting; `//: ` / `#: ` lines uncommented inside kept blocks). |
|
||||
| `applyPlaceholders(text, fakes, values)`, `leftoverFakes(text, fakes)` | `@intecion/ipal-kit/starter` | Fake values → the site's values (longest first); what is left. |
|
||||
| `assertManifest(value)`, `fileRole(path, manifest)`, `matchGlob(path, glob)`, `ALWAYS_SKIPPED` | `@intecion/ipal-kit/starter` | `starter.manifest.json`: drop / generate / template / keep. |
|
||||
| `renderI18nConfig`, `renderTokens`, `renderDesignMd`, `renderAgentsMd`, `renderDecisions`, `renderDoctorConfig` | `@intecion/ipal-kit/starter` | Files and sections written from the answers (languages, brand, DESIGN.md, AGENTS.md decisions, ipal-doctor.json). |
|
||||
| `rewriteFonts(layout, answers)`, `fontExport(name)`, `rewritePackageJson(text, rules, ctx, answers)` | `@intecion/ipal-kit/starter` | next/font calls → the answered fonts; the manifest's package.json rewrite. |
|
||||
| `lockfileWithoutPlugin(lock)` | `@intecion/ipal-kit/starter` | The reference lockfile without the plugin (shipped with the bundle). |
|
||||
| `secretFindings(files)` | `@intecion/ipal-kit/starter` | The pre-commit check: `.env*`, assigned secrets, private keys. |
|
||||
|
||||
**Types:** `StarterAnswers`, `AnalyticsTool`, `ContentCollection` — the answers; `StarterBundle`, `StarterManifest`, `FileRole`,
|
||||
`StarterFlags`, `SiteContext` — the bundle, the manifest, the flags and the site context (all `/starter`).
|
||||
|
||||
## Design tokens (`tokens`) — details: `node_modules/@intecion/ipal-kit/docs/design-tokens.md`
|
||||
|
||||
CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `[data-surface="inverse"]`), `@intecion/ipal-kit/tailwind.css`
|
||||
|
||||
@@ -66,7 +66,21 @@ propose a concrete choice and get a yes before you build it.
|
||||
|
||||
## 1. Installation
|
||||
|
||||
**Steps.** Scaffold: `npx create-payload-app@latest <project>` (Blank, Postgres/Mongo), delete the starter
|
||||
**New site: `ipal-kit create` does stages 1–10 in one command** (`node_modules/@intecion/ipal-kit/docs/project-starter.md`).
|
||||
After stage 0, write the answers as JSON (shape `StarterAnswers` from `@intecion/ipal-kit/starter`) and run, from the
|
||||
folder that will hold the project (needs the `@intecion` registry line in `~/.npmrc`):
|
||||
```bash
|
||||
pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> --answers answers.json
|
||||
```
|
||||
It generates the site from the reference site, writes `.env` (fresh `PAYLOAD_SECRET`), installs from the shipped
|
||||
lockfile, runs `ipal-skills`, `ipal-tokens`, `generate:types`, `generate:importmap`, `typecheck` (and `ipal-doctor
|
||||
--strict` when shipped), checks for secrets and makes the first commit. **Check:** `git log --oneline` = 1 commit,
|
||||
`git status` clean, `AGENTS.md` → "Project decisions" holds every answer, `pnpm typecheck` passes. Then go to stage 11.
|
||||
**Turn off / override:** it refuses another default language than `pl`, sites without `en`, URLs without a prefix and
|
||||
Postgres — use the stages below; every generated file is the project's own afterwards. The stages below are also the
|
||||
path for an existing project.
|
||||
|
||||
**Steps (manual path).** Scaffold: `npx create-payload-app@latest <project>` (Blank, Postgres/Mongo), delete the starter
|
||||
`src/app/(frontend)/layout.tsx` and `page.tsx` (the frontend root becomes `[locale]/layout.tsx`). Do not create
|
||||
`middleware.ts` (Next 16 = `proxy.ts`; delete an existing one). Never install from git (`git+https://…`).
|
||||
```ini
|
||||
|
||||
@@ -45,7 +45,12 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
|
||||
decision (AGENT §0a) and on a plugin gap (ipal-plugin-gap — report, wait for the owner).
|
||||
|
||||
## Phase 1 — Foundation
|
||||
- New project → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical
|
||||
- **New site → `ipal-kit create`** with the phase-0 answers as JSON (`docs/project-starter.md`):
|
||||
`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> --answers answers.json`.
|
||||
It generates the site from the reference site (every §0b item wired), installs the skills, writes the answers into
|
||||
`AGENTS.md`, and makes the first commit. Check: `git log --oneline` = 1 commit, `pnpm typecheck` passes. Then continue
|
||||
with phase 2. What it refuses (another default language, no URL prefix, Postgres) → the manual path below.
|
||||
- New project without the command → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical
|
||||
version in the reference site: `node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md` (AGENT.md
|
||||
"Reference site") — copy the pattern, change only the content.
|
||||
- Existing project on an older ipal-kit → **ipal-upgrade** before anything else.
|
||||
|
||||
@@ -95,6 +95,11 @@ once: `NPM_CONFIG_USERCONFIG=/dev/null pnpm up --latest @intecion/ipal-kit`.
|
||||
|
||||
## 2. NEW PROJECT — ORDER
|
||||
|
||||
**Fastest: one command.** `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain>`
|
||||
generates the whole site from the reference site — questions, files, install, skills, first commit
|
||||
([project-starter.md](../project-starter.md)). The order below is the manual path (an existing project, or what the
|
||||
command does not cover yet).
|
||||
|
||||
Pnpm, Node 22+, Next 16, Payload 3. The order matters.
|
||||
|
||||
### 2.1 Skeleton
|
||||
|
||||
@@ -0,0 +1,607 @@
|
||||
# Project starter — proposal (`ipal-kit create`)
|
||||
|
||||
**Status:** built (revision 3) — the user guide is [docs/project-starter.md](../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.
|
||||
|
||||
```bash
|
||||
pnpm dlx @intecion/ipal-kit@1.15.0 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
|
||||
|
||||
```bash
|
||||
pnpm dlx @intecion/ipal-kit@1.15.0 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:
|
||||
|
||||
```markdown
|
||||
# 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.
|
||||
|
||||
### 4.6 2FA, cookie scanner, white-label
|
||||
|
||||
- 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`):
|
||||
|
||||
```bash
|
||||
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`):
|
||||
```bash
|
||||
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/ipal-kit@X.Y.Z 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.
|
||||
@@ -0,0 +1,203 @@
|
||||
# project starter — `ipal-kit create`
|
||||
|
||||
One command creates a new Payload 3 + Next 16 client site that already follows every team convention, so
|
||||
every project starts identical. The site is generated from the **reference site** (`reference/` in the plugin
|
||||
repo, not shipped as a folder): the same files, with the made-up company's values replaced by the owner's
|
||||
answers and its demo content left out.
|
||||
|
||||
```bash
|
||||
pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@1.15.0 create intecion.com
|
||||
```
|
||||
|
||||
- Always give the version: it pins the templates and therefore every dependency of the new site.
|
||||
- Run it from the folder that will hold the project, with the `@intecion` registry line in `~/.npmrc`
|
||||
(README "Installation") — there is no project `.npmrc` yet.
|
||||
- `--config.auto-install-peers=false` keeps `dlx` to the plugin itself: 7 packages, ~44 MB, ~1 s with a warm
|
||||
store. Without it pnpm also installs the plugin's peers (Payload, Next, React — 356 packages, ~750 MB in the dlx
|
||||
cache) that the generator never loads.
|
||||
- An agent that already has the plugin installed: `pnpm exec ipal-kit create <domain> --dir ../<name>-web`. The
|
||||
command refuses to write into the current project.
|
||||
|
||||
## What it asks — and where the answers go
|
||||
|
||||
The architecture questions of AGENT.md "Ask before you build" (the same list as `ipal-setup` stage 0), all before
|
||||
a single file is written. Enter takes the recommendation shown in brackets — an explicit choice, recorded as the
|
||||
owner's answer. There is no `--yes`: a missing answer stops the run with the list of open topics.
|
||||
|
||||
| Topic | Asked | Goes to |
|
||||
|---|---|---|
|
||||
| Site name, market, industry | name (also the 2FA issuer) | `AGENTS.md` header, Site settings and Company (seed), `twoFactor.issuer` |
|
||||
| Languages | locales besides `pl` (default) and `en` | `src/i18n.config.ts` (every language with a URL prefix) |
|
||||
| Styling | primary (+ secondary, accent), body and heading font, theme light / dark / both + default, radius sharp / soft / round, fluid standard / wide | `src/design/tokens.ts`, `DESIGN.md`, the next/font calls in the root layout, Site settings → Theme (seed) |
|
||||
| Pages and content | the site map; collections `posts` / `caseStudies` | `AGENTS.md` → Site map; the collection files, `content.config.ts`, the entry list block, the blog archive page |
|
||||
| Forms | forms, the inbox that receives them, SMTP or Microsoft Graph | Company → E-mail (seed), the seeded forms, `ipalEnvRules({ emailGraph })` + `GRAPH_*` |
|
||||
| Analytics and consent | tools, Consent Mode, the settings window, cookie scanner, browser crawl | CSP flags in `next.config.ts`, `SiteProviders analytics` / `banner`, `cookieScanner`, `IPAL_COOKIE_SCAN_*` |
|
||||
| SEO / GEO | local business (schema.org type), AI crawlers | `siteJsonLd` with `buildLocalBusinessJsonLd`, `robots.aiBots` |
|
||||
| Media | R2 or local disk | `ipalEnvRules({ storage })`, `docs/DEPLOY.md` (Persistent Storage without R2) |
|
||||
| Admin | 2FA, white-label, agency credit, panel link preview | `twoFactor`, `whiteLabel`, `agency`, `adminMeta` |
|
||||
| Hosting | canonical host apex / www, Coolify server, who adds DNS | `NEXT_PUBLIC_SERVER_URL`, `docs/DEPLOY.md` |
|
||||
| Agent tooling | external skills | `ipal-skills --external` |
|
||||
|
||||
Every answer is written into `AGENTS.md` → **Project decisions** (one line per topic) and the full set into
|
||||
`.ipal/starter.json`. A module the owner turns off needs the owner's reason, which goes into
|
||||
`ipal-audit-skip:` and `ipal-doctor.json` (`"rules": { "2fa": { "off": true, "reason": "…" } }`).
|
||||
|
||||
**Limits of this version** (the generator refuses, the manual `ipal-setup` path covers them): the default
|
||||
language must be `pl` and `en` must be one of the locales (the base seed is Polish + English, with Polish
|
||||
default-locale slugs); every language gets a URL prefix; MongoDB only.
|
||||
|
||||
For agents and CI, the same answers as JSON (shape: `StarterAnswers`, `@intecion/ipal-kit/starter`):
|
||||
|
||||
```bash
|
||||
pnpm exec ipal-kit create intecion.com --dir ../intecioncom-web --answers answers.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"siteName": "Intecion", "market": "PL", "industry": "software house",
|
||||
"languages": { "default": "pl", "locales": [{ "code": "pl", "label": "Polski" }, { "code": "en", "label": "English" }] },
|
||||
"styling": { "primary": "oklch(0.5 0.17 250)", "fontBody": "Inter", "fontHeading": "Inter", "theme": "both", "defaultTheme": "system", "radius": "soft", "fluid": "wide" },
|
||||
"content": { "pages": ["Home", "About", "Services", "Contact"], "collections": ["posts"] },
|
||||
"forms": { "list": ["Contact form"], "recipient": "biuro@intecion.com", "transport": "smtp" },
|
||||
"consent": { "tools": ["ga4"], "consentMode": "advanced", "banner": "detailed", "cookieScanner": true, "crawl": true },
|
||||
"seo": { "aiBots": "allow", "localBusiness": { "type": "ProfessionalService" } },
|
||||
"media": "r2",
|
||||
"admin": { "twoFactor": true, "whiteLabel": true, "agency": "intecion", "adminMeta": true },
|
||||
"hosting": { "canonical": "apex", "coolify": "coolify-1 / intecion", "dns": "the team" },
|
||||
"tooling": { "external": [] }
|
||||
}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Default | What it does |
|
||||
|---|---|---|
|
||||
| `<domain>` | — (required) | the production domain; `https://`, `www.` and a path are stripped, IDN → punycode |
|
||||
| `--dir <path>` | `./<domain without dots>-web` | target folder; must not exist or be empty |
|
||||
| `--answers <file>` | — | the answers as JSON, no questions |
|
||||
| `--external [a,b]` | none | also the vendored `ext-*` skills (all, or the listed ones) |
|
||||
| `--no-install` | install | write the files only; the report lists the remaining commands |
|
||||
| `--no-git` | git | no `git init` / first commit |
|
||||
| `--dry-run` | off | print the file list and the database names, write nothing |
|
||||
| `--plugin-spec <spec>` | the exact version | install the plugin from another spec — the release gate uses the packed tarball |
|
||||
|
||||
## What it does, in order
|
||||
|
||||
1. Validates the domain, the folder and every answer — nothing is written while one is missing.
|
||||
2. Renders the site from the starter bundle (below) and writes it; writes a local `.env` (`.env.example` with a
|
||||
fresh `PAYLOAD_SECRET`; git-ignored, never committed).
|
||||
3. `pnpm install` from the shipped lockfile, `pnpm exec ipal-skills` (+ `--external`), `pnpm exec ipal-tokens`
|
||||
(writes `src/design/tokens.css`, fails on a WCAG contrast error — pick another colour), `pnpm generate:types`,
|
||||
`pnpm generate:importmap`, `pnpm typecheck`, and `pnpm exec ipal-doctor --strict --offline` when the installed
|
||||
ipal-kit ships it.
|
||||
4. `git init -b main`, a secret check of every staged file (no `.env*` except `.env.example`, no assigned
|
||||
`*_SECRET` / `*_TOKEN` / `*_PASSWORD` / `*_ACCESS_KEY` value, no private key) and one commit
|
||||
`chore: create site with ipal-kit create <version>`. No remote, no push.
|
||||
5. Prints the next steps: local MongoDB with `<domain>_dev`, `pnpm seed` (before launch), the panel steps, the
|
||||
deploy (`docs/DEPLOY.md`).
|
||||
|
||||
**Check:** in the new folder `git log --oneline` = one commit, `git status` clean, `pnpm typecheck` passes,
|
||||
`grep -c 'Project decisions' AGENTS.md` = 1, `cat ipal-doctor.json` shows the domain and `launched: false`.
|
||||
|
||||
## The generated site
|
||||
|
||||
The reference site's tree (AGENT.md §3) with: the plugin pinned to the exact released version, the database
|
||||
names from `databaseNamesFor(domain)` (`intecion.com` → `intecioncom_dev` / `intecioncom_prod`; hyphens stay),
|
||||
CSP in **report-only** (`ipal-doctor.json` silences the report-only finding for 28 days with the reason),
|
||||
`assertEnv(ipalEnvRules({ databaseName, ipHeader, storage, … }))` in `instrumentation.ts`, the blocks from the
|
||||
block library (`libraryBlocks` + `createBlockRegistry(content, { Image, Link, … })`), the design-token standard
|
||||
(`styles.css` imports only, the brand in `src/design/tokens.ts`, next/font `--font-family-body` /
|
||||
`--font-family-heading`), seeds through `createSeeder` with `SEED_ONLY`, and `docs/DEPLOY.md` for the team's
|
||||
Coolify flow — build and check locally, Coolify builds the app from the repo with its default build pack,
|
||||
MongoDB is a separate Coolify resource on the same Docker network, **no Dockerfile**:
|
||||
|
||||
```bash
|
||||
SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed # in Coolify → the app → Terminal: read the plan
|
||||
# Coolify → MongoDB resource → Backup now
|
||||
SEED_ONLY="pages:kontakt" pnpm seed # the real run
|
||||
```
|
||||
|
||||
Not in a new site: the reference company's demo content and media, the Blocks showcase page, the smoke tests
|
||||
(`e2e/`), `.agents/skills` (re-installed by `ipal-skills`), `README.md`.
|
||||
|
||||
## How the reference site becomes a site
|
||||
|
||||
`reference/starter.manifest.json` (owned by the reference site) gives every path a role:
|
||||
|
||||
| Role | Meaning |
|
||||
|---|---|
|
||||
| `drop` | left out (demo seeds and media, e2e, generated files) |
|
||||
| `generate` | written by the starter from the answers (`src/i18n.config.ts`, `src/design/tokens.ts`, `DESIGN.md`, `ipal-doctor.json`) |
|
||||
| `template` | copied with `placeholders` replaced — the reference's unique fake values (`example-studio.pl`, `Example Studio`, `example-studiopl`…) → the new site's values |
|
||||
| `keep` | copied as is; must not contain a fake value (the bundle build fails) |
|
||||
| `variants` | whole files that exist only with a flag on (`src/collections/Posts.ts` → `posts`) |
|
||||
| `rewrite` | `package.json` entries set or removed (`null`) |
|
||||
|
||||
Inside files, variants are comment lines, so the reference site stays a normal, runnable project:
|
||||
|
||||
```ts
|
||||
// @starter:if twoFactor
|
||||
twoFactor: { issuer: 'Example Studio', plugin: payloadTotp },
|
||||
// @starter:else
|
||||
//: twoFactor: false, // turned off by the owner
|
||||
// @starter:endif
|
||||
```
|
||||
|
||||
`// @starter:if <flag>` / `!<flag>` … `// @starter:else` … `// @starter:endif` (also `#` in env files, `<!-- -->`
|
||||
in Markdown, `{/* */}` in TSX children); blocks nest. Inside a kept block a `//: ` / `#: ` line is uncommented —
|
||||
that is how the reference carries code it does not run itself. The flags come from the answers
|
||||
(`flagsFromAnswers`): `twoFactor`, `posts`, `caseStudies`, `collections`, `crawl`, `scannerWithoutCrawl`, `r2`,
|
||||
`graph`, `localBusiness`, `aiBotsBlockTraining`, `aiBotsDisallow`, `analytics`, `metaPixel`, `linkedIn`, `tiktok`,
|
||||
`clarity`, `consentBasic`, `bannerDetailed`, `bannerInline`, `bannerModal`, `themeToggle`, `defaultLight`,
|
||||
`defaultDark`, `defaultSystem`, `whiteLabel`, `adminMeta`, `agencyNone`, `agencyCustom`, `enforceCsp` (always
|
||||
off in a new site) and `demo` (always off). A flag the reference uses that this ipal-kit does not set stops the
|
||||
run with its name.
|
||||
|
||||
**Adding a feature to the starter** = changing the reference site: write the code there (marked with
|
||||
`@starter:if` when it depends on an answer), add a placeholder to the manifest when it holds a per-client value,
|
||||
and — for a new answer — the question in `answers.ts` / `prompts.ts` and the flag in `flagsFromAnswers`.
|
||||
|
||||
## Release: the bundle and the gate
|
||||
|
||||
`pnpm build:starter` (in `prepublishOnly`, after `pnpm build`) packs the reference site into
|
||||
`dist/starter/template.json.gz`: the kept files, the manifest and the reference lockfile **without the plugin
|
||||
itself** — its integrity hash does not exist before the tarball is published. The new site's `pnpm install`
|
||||
keeps every locked entry and resolves only the plugin (exact version) and its four dependencies (exact versions
|
||||
too), then the complete lockfile goes into the first commit; from then on `--frozen-lockfile`. Size (measured on
|
||||
1.14.6): the bundle is 90 KB gzipped (69 files + lockfile, 283 KB of text); everything the starter adds — bundle,
|
||||
compiled code with source maps, docs — is ~340 KB unpacked (~4 % of 7.96 MB) and ~180 KB of the 2.40 MB tarball.
|
||||
|
||||
`pnpm starter:gate` (the last step of `prepublishOnly`) blocks the publish unless a site created from the
|
||||
**packed tarball** works the way it will in Coolify: `dlx` create → frozen install → first seed of a fresh
|
||||
`_dev` database (MongoDB in its own Docker container) → `pnpm generate:types && pnpm build` →
|
||||
`SEED_ONLY="pages:kontakt" [SEED_DRY_RUN=1] pnpm seed` in production mode → a full seed in production refused →
|
||||
`pnpm start` with `/api/health`, `/pl`, report-only CSP, no `X-Powered-By`, `/llms.txt` → `ipal-doctor --strict`
|
||||
(when shipped) → with the `nixpacks` CLI on PATH, the same seed inside the Nixpacks image. Needs Docker;
|
||||
`--keep` leaves `.starter-gate/` for inspection.
|
||||
|
||||
## Building blocks — `@intecion/ipal-kit/starter`
|
||||
|
||||
Node built-ins only, no Payload: script your own generator or check a reference tree with them.
|
||||
|
||||
| Export | What it does |
|
||||
|---|---|
|
||||
| `runCreateCli(args, log?)`, `CREATE_USAGE`, `parseCreateArgs(args)`, `normalizeDomain(input)`, `localEnv(example)` | the command and its pieces |
|
||||
| `validateAnswers(input)`, `flagsFromAnswers(answers)`, `STARTER_TOPICS`, `askAnswers(ask)` | the questions as data, their validation, the flags they set, the prompts (any `ask` function) |
|
||||
| `collectBundle(dir)`, `packBundle(bundle)`, `unpackBundle(buffer)`, `bundleFlags(bundle)` | a reference tree → the bundle and back; the flags its markers use |
|
||||
| `renderSite(bundle, answers, ctx)`, `placeholderValues(answers, ctx)` | the new site's files (path → content), in memory |
|
||||
| `applyVariants(text, flags, file?)`, `variantFlags(text)`, `applyPlaceholders(text, fakes, values)`, `leftoverFakes(text, fakes)` | the text transforms |
|
||||
| `assertManifest(value)`, `fileRole(path, manifest)`, `matchGlob(path, glob)`, `ALWAYS_SKIPPED` | the manifest rules |
|
||||
| `renderI18nConfig`, `renderTokens`, `renderDesignMd`, `renderAgentsMd`, `renderDecisions`, `renderDoctorConfig`, `rewriteFonts`, `fontExport`, `rewritePackageJson` | the files and sections written from the answers |
|
||||
| `lockfileWithoutPlugin(lock)`, `secretFindings(files)` | the lockfile step and the secret check |
|
||||
|
||||
Types: `StarterAnswers`, `AnalyticsTool`, `ContentCollection`, `StarterBundle`, `StarterManifest`, `FileRole`,
|
||||
`StarterFlags`, `SiteContext`.
|
||||
|
||||
## Turn off, override
|
||||
|
||||
- The command is optional: the manual path (`ipal-setup` stages 1–11) still sets up any site, including what this
|
||||
version refuses (other default language, no URL prefix, Postgres).
|
||||
- Every generated file belongs to the project afterwards — change it like any other file; `ipal-upgrade` and
|
||||
`ipal-doctor` keep it in line with later plugin versions.
|
||||
- `--no-install`, `--no-git`, `--dir`, `--plugin-spec` change the run; a different reference tree → your own
|
||||
generator from the building blocks above.
|
||||
Reference in New Issue
Block a user