# PROGRAMISTA.md — install, new project, deployment, ipal-kit development > **Who it is for:** a human — a developer at the agency. Rules for writing code (for AI and > for humans) are in [AGENT.md](../agent/AGENT.md); module APIs are in the module files (map in > AGENT.md §12). This file is the process: how to set up, deploy and update a project, and > how to release a new plugin version. > > Building a project with an AI agent? Ready-made prompts, step by step: [vibe.md](./vibe.md). ## 0. MAIN RULE — the plugin helps, never limits ipal-kit is a plugin: it helps projects, it never limits them. - Every module / feature can be turned off on its own. - Every default (access rules, fields, hooks, labels, routes, collections, globals) can be overridden — **the project config wins**. - Safe defaults, always with an option to relax them. - We export building blocks (helpers, builders, hooks), not only finished features. - We never force a dependency, route, UI or data shape where an option or an exported building block is enough. Where the code does not meet this yet, the module docs say so plainly ("currently always added"). Contents: 0. Main rule · 1. Install · 2. New project · 3. Environment variables · 4. Deployment (Coolify) · 5. Compliance · 6. Updating an old project · 7. Troubleshooting · 8. ipal-kit development and publishing · 9. Git and Gitea --- ## 1. INSTALLING ipal-kit IN A PROJECT **`.npmrc` in the project root (commit it — it holds no secret):** ```ini legacy-peer-deps=true @intecion:registry=https://git.intecion.net/api/packages/IntecionSoftware/npm/ ``` This rule applies only to the `@intecion/*` scope — everything else (`react`, `payload`…) still comes from npm. The registry is public for reading, so install needs no token. ```bash pnpm add @intecion/ipal-kit pnpm add @payloadcms/plugin-seo @payloadcms/plugin-form-builder # peer dependencies pnpm add @clocklimited/payload-2fa@3.0.0-beta.7 # 2FA (optional peer, but required unless twoFactor: false) pnpm add @payloadcms/storage-s3 # optional peer — only when media live in R2 pnpm add tailwindcss @tailwindcss/postcss pnpm exec ipal-skills # agent skills + pointer to the guide in AGENTS.md / CLAUDE.md (§2.1a) ``` `nodemailer`, `lucide-react` (`^0.400.0` = only `0.400.x`), `slugify`, `server-only` are regular `dependencies` of the plugin — they install with it, do not add them. The other peers (`payload`, `@payloadcms/next`, `@payloadcms/ui`, `@payloadcms/richtext-lexical`, `next`, `react`) come from `create-payload-app`. If the project uses `lucide-react` itself, keep it at `~0.400.0` (another version = two copies). **Never from git** (`git+https://…`) — a path with a hash breaks the React Client Manifest (the plugin's `'use client'` components fail at runtime). **`@payloadcms/*` versions must match `payload` exactly** — otherwise you get an empty SEO tab, a missing Forms collection or a crash. In `package.json`: ```json "pnpm": { "overrides": { "payload": "3.94.1", "@payloadcms/ui": "3.94.1", "@payloadcms/next": "3.94.1", "@payloadcms/db-postgres": "3.94.1", "@payloadcms/richtext-lexical": "3.94.1", "@payloadcms/plugin-seo": "3.94.1", "@payloadcms/plugin-form-builder": "3.94.1", "@payloadcms/storage-s3": "3.94.1" } } ``` (match the database adapter: `db-postgres` / `db-mongodb`). Then `rm -rf node_modules pnpm-lock.yaml && pnpm install`. **Build with webpack** (Turbopack conflicts with `withPayload`): ```json "build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack" ``` Check that the registry responds: ```bash curl -s -o /dev/null -w "%{http_code}\n" \ https://git.intecion.net/api/packages/IntecionSoftware/npm/@intecion%2Fipal-kit # 200 ``` **Updating to the latest version:** `pnpm up --latest @intecion/ipal-kit`. Plain `pnpm up @intecion/ipal-kit` changes nothing when `package.json` has an exact version (`"1.8.13"`) — it stays within the range. Then follow the "Requires project changes" sections of the CHANGELOG. **401 when fetching the package** (`ERR_PNPM_FETCH_401 … Unauthorized`) even though the registry is public: `~/.npmrc` has an old `_authToken` for `git.intecion.net`, and an invalid token also blocks reading. Remove that line (the token is needed only for publishing, §8.3) or run 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@ create ` 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 ```bash npx create-payload-app@latest my-project # Blank; Postgres or Mongo cd my-project ``` Delete the starter `(frontend)/layout.tsx` and `(frontend)/page.tsx` — the root becomes the layout under `[locale]` (because `` must know the language). ### 2.1a Skills and AGENTS.md ```json // project package.json "scripts": { "ipal:skills": "ipal-skills" } ``` Run `pnpm ipal:skills` after install and after every ipal-kit update; commit `.agents/skills/`. (`ipal-skills` is the package `bin` — without the script: `pnpm exec ipal-skills`; options `--dest `, `--dry-run`, `--no-pointer`, `--external [ext-a,ext-b]`.) The command also adds to `AGENTS.md` a `…` block with a pointer to AGENT.md and the `ipal-reference` / `ipal-setup` skills, and creates a missing `CLAUDE.md` with the line `@AGENTS.md`. On later runs it replaces only the text between the markers. This way an agent that opens the project lands on the full guide right away — without a `postinstall` script (the package has none and never will). **Project `tsconfig.json`: `"exclude": ["node_modules", ".agents"]`** — the skills contain `.ts`/`.tsx` templates; without the exclusion `tsc` and `next build` check them as project code and fail (`ipal-skills` and `ipal-audit` warn about it). In the root, `AGENTS.md` follows the template from [AGENT.md §13](../agent/AGENT.md). List of skills: AGENT.md §14. ### 2.2 Locale — one source ```ts // src/i18n.config.ts import type { I18nConfig } from '@intecion/ipal-kit' export const i18nConfig = { defaultLocale: 'pl', locales: [ { code: 'pl', label: 'Polski' }, { code: 'en', label: 'English' }, ], } as const satisfies I18nConfig ``` Single-language site: one locale, no `[locale]` folder — layout with `i18nConfig.defaultLocale`, `createPageRoute` / `createNotFoundPage` unchanged, Markdown in `app/md/[[...slug]]/route.ts` (i18n.md). Do not add `[locale]` "just in case" with one language — links would be without `/pl`, pages with `/pl`. ### 2.3 payload.config.ts ```ts import { buildConfig } from 'payload' import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit' import { payloadTotp } from '@clocklimited/payload-2fa' import { s3Storage } from '@payloadcms/storage-s3' import { i18nConfig } from '@/i18n.config' import { contentConfig } from '@/content.config' import { Pages } from '@/collections/Pages' import { Media } from '@/collections/Media' export default buildConfig({ collections: [Pages, Media], // ipalKit adds users (your own only for extra fields) email: mailAdapter(), // without it form-builder emails are not sent plugins: [ ipalKit({ i18n: i18nConfig, access: { authCollection: 'users' }, pages: { slug: 'pages' }, // System pages (homepage, 404, policies) content: contentConfig, // collections with an archive (blog…), optional seo: { collections: ['pages'] }, forms: { redirectRelationships: ['pages'] }, twoFactor: { issuer: 'Nazwa Klienta', plugin: payloadTotp }, whiteLabel: true, // logo/name from Site settings in the admin panel indexNow: true, // publish → Bing / ChatGPT Search (production) consentLog: true, // proof of consent (GDPR Art. 7(1)), no personal data // adminRoute: '/its', // + move app/(payload)/admin → its and put `its` in the proxy matcher (§2.6) }), buildR2Storage(['media'], { s3Storage }), // ALWAYS — R2 when all R2_* are in env, local disk without them ], }) ``` The mandatory feature set (SEO, GEO, R2, Turnstile, forms…) and how to check it: **AGENT.md §0b**. Code for all routes below (§2.7–2.9). ### 2.4 Collections, blocks, shared fields - `Pages`: `title` (localized), `buildSlugField({ from: 'title' })`, `buildNoindexField()`, `buildSummaryField()` (summary for AI — GEO), `layout` of type `blocks` (min. 1 block), `trackSlugHistoryHook`, `buildRevalidateHook`. - `Media`: upload with `mimeTypes` (images + PDF), `alt` (required, localized), `normalizeFilenameHook`, `buildOptimizeUploadHook` + `buildOptimizeUploadField` (oversized files, with consent), `buildMediaPlaceholderHook` + `buildMediaPlaceholderField` (blur/color for `mediaImageProps`) — media.md; R2 through `buildR2Storage(['media'], { s3Storage })` — `s3Storage` from `@payloadcms/storage-s3`, injected (storage.md). - Fields from the plugin: links (`buildLinkField`, `buildLinksField` — links.md), section header and settings (`buildSectionHeaderField`, `buildSectionSettingsField` — blocks.md). The project holds only the visual UI primitives in `src/components/ui/` (CMSLink on `resolveLink`, Button, Media, Section, SectionHeader) and `src/components/forms/formClasses.ts` — ready code in `agent/skills/ipal-block/resources/section-code.md` and `ipal-form/resources/`, rules in AGENT.md §6. Create them **before** the first block. ### 2.5 Tailwind ```js // postcss.config.mjs export default { plugins: { '@tailwindcss/postcss': {} } } ``` ```css /* src/app/(frontend)/styles.css */ @import "tailwindcss"; @import "@intecion/ipal-kit/fluid.css"; /* optional: fluid typography and spacing scale */ @source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js"; @theme inline { --text-display: var(--ipal-fs-display); --text-h1: var(--ipal-fs-h1); --text-h2: var(--ipal-fs-h2); --text-h3: var(--ipal-fs-h3); --text-lead: var(--ipal-fs-lg); --spacing-section: var(--ipal-space-section); --spacing-gutter: var(--ipal-space-gutter); --spacing-gap: var(--ipal-space-gap); } ``` `fluid.css` is only `clamp()` variables (360 → 1280 px, in `rem`) — classes `text-h1`, `py-section`, `px-gutter`. `fluid-wide.css` — the same variables, scaled up to 1920 px (13″ ≠ 27″); import one of the two. Both also have height and width variables: `--ipal-hero-min-h`, `--ipal-fs-display-fit`, `--ipal-space-section-fit`, `--ipal-measure`, `--ipal-container` (AGENT.md §6.11a). Override numbers from `DESIGN.md` in the project's `:root` (`--ipal-fs-h1: clamp(…)`); do not write the formulas from scratch. Without `@source` the plugin's components (cookie banner, Turnstile) have no styles. Colors of the plugin's components: `--ipal-primary`, `--ipal-radius` (consent.md). **Design-token standard (1.15.0, [design-tokens.md](../design-tokens.md)) — new sites:** `styles.css` imports `fluid-wide.css`, `tokens.css`, `tailwind.css` and `../../design/tokens.css` (instead of the `@theme inline` above); the brand is `src/design/tokens.ts` → `pnpm exec ipal-tokens`; next/font variables `--font-family-body` / `--font-family-heading`. Components use the preset's utilities (`bg-surface`, `text-fg`, `py-section`). ### 2.6 Proxy (NOT middleware.ts) ```ts // src/proxy.ts import { NextResponse } from 'next/server' import { createProxy } from '@intecion/ipal-kit' import { i18nConfig } from '@/i18n.config' // markdown: true (GEO) — /md/… passes without a language redirect, and a page // fetched with `Accept: text/markdown` gets its Markdown version export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true }) // Inline literal — Next analyzes it statically; importing a variable = proxy on /admin → 500 export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] } ``` Sets `x-locale` / `x-pathname`, the language cookie with consent, redirects `/`. The headers are for dynamic routes (API, route handlers) — in SSG/ISR pages, layouts and `not-found.tsx` **do not read `headers()`** (AGENT.md §4.6). ### 2.7 Data layer — one source ```ts // src/lib/content.ts — the ONLY place for configuration: data, routes, links, layout import { createContentHelpers } from '@intecion/ipal-kit' import config from '@/payload.config' import { i18nConfig } from '@/i18n.config' import { contentConfig } from '@/content.config' export const { // data getCachedPayload, getSettings, getConfiguredLocales, resolveRoute, getEntries, getNotFoundPage, generatePageMetadata, generateStaticParams, getPageJsonLd, resolvePageRedirect, i18n, // layout, forms, links getSiteShell, getFormTexts, getLinkOptions, getHomeSlug, resolveLink, resolveNav, getSystemLinks, // routes (re-exported in app/) sitemap, sitemapRoute, robots, manifest, llmsRoute, llmsFullRoute, markdownRoute, mcpGET, mcpPOST, healthRoute, indexNowKeyRoute, } = createContentHelpers({ config, content: contentConfig, i18n: i18nConfig, baseUrl: process.env.NEXT_PUBLIC_SERVER_URL, markdownAlternate: true, // GEO: on every page summaryField: 'aiSummary', // llms.txt and MCP take the AI description from buildSummaryField mcp: { serverName: '-site' }, // pageJsonLd: { faq: (doc) => …map the FAQ block to { question, answer }… }, // siteJsonLd: async ({ settings, baseUrl, locale }) => [buildLocalBusinessJsonLd({…})], // local business }) ``` Everything is computed only on first use and cached per request. You can skip any function and build the page from lower-level blocks (`createPageMetadata`, `createLlmsTxtRoute`, `createMcpRoute`… — seo.md, mcp.md) — the plugin forces nothing. ### 2.8 Routes ```tsx // src/app/(frontend)/[locale]/layout.tsx import { notFound } from 'next/navigation' import { CookieBanner } from '@intecion/ipal-kit/client' import { SiteProviders } from '@intecion/ipal-kit/rsc' import { getConfiguredLocales, getSiteShell } from '@/lib/content' import '../styles.css' type Props = { children: React.ReactNode; params: Promise<{ locale: string }> } export default async function LocaleLayout({ children, params }: Props) { const { locale } = await params if (!(await getConfiguredLocales()).includes(locale)) notFound() const shell = await getSiteShell(locale) // consent, analytics, Turnstile, site JSON-LD, Site settings return ( {/* NO — Next manages it itself */} }> {/*
*/}
{children}
{/*