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:
Radosław Smoliński
2026-10-29 15:50:44 +01:00
co-authored by Claude Opus 5.5
parent 154049662e
commit 804a09efed
43 changed files with 2902 additions and 99 deletions
+26 -46
View File
@@ -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,