payload-bootstrap
Skill0 starsChanged 13 days agoMITView on GitHub
Create a Payload CMS 3 + Next.js project from the official website template with libSQL / Turso, or add Payload to an existing Next.js app, then define the data model. Use when starting a new site, installing Payload into a frontend, configuring the SQLite adapter, setting environment variables, or adding collections and globals. Never scaffolds from scratch.
- Reads credentials
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-guardrailsSkill
- creative-frontendSkill
- figma-handoffSkill
- payload-admin-brandingSkill
- payload-auth-rbacSkill
- payload-bookings-paymentsSkill
- payload-deploy-vercelSkill
- payload-forms-crmSkill
- payload-integrationsSkill
- payload-legal-trustSkill
- payload-live-previewSkill
- payload-localizationSkill
- payload-mcpSkill
- payload-mediaSkill
- payload-performanceSkill
- payload-project-kickoffSkill
- payload-seo-geoSkill
- payload-testingSkill
- project-architectureSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 11
Start from the official template every time.
- Very specific: line 30
If the current folder must be the project root (it only contains PROJECT.md and AGENTS.md), use --name app --no-git, move everything from …
- Very specific: line 32
Run the project normalization in the project-architecture skill (Step 2: move globals into src/globals).
- Very specific: line 57
Keep the env variable name the generated config uses (DATABASE_URL in 3.94).
- Very specific: line 60
Never use a file: database on Vercel.
- Very specific: line 64
Write .env.example with names and placeholders, and keep real values in .env (gitignored by the template).
- Very specific: line 79
Read the features list in PROJECT.md and the inventory (if a frontend existed).
- Very specific: line 82
After each schema change, run pnpm generate:types.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Payload bootstrap
Start from the official template every time. It already contains working live preview, drafts, SEO fields, redirects, search, sitemaps, and tests. Rebuilding these by hand is the most common cause of broken projects.
Choose the path
Scenario (from payload-project-kickoff) | Path |
| A. New site | Step 1 (template) |
B. Existing Next.js app, already refactored by project-architecture | Step 2 (add to existing app) |
| D. Payload already installed | Skip to Step 4 (data model) |
Step 1: New site from the template
- Pick the agent value:
cursororcodex(installs the official skill into.agents/skills), orclaude(installs into.claude/skills). - From the parent folder of the new project, run:
npx create-payload-app@latest --name <project-slug> --template website --db sqlite --db-accept-recommended --agent cursor --use-pnpm- If the current folder must be the project root (it only contains
PROJECT.mdandAGENTS.md), use--name app --no-git, move everything fromapp/(including dotfiles) into the current folder, delete the emptyapp/folder, then rungit init. - The command writes
AGENTS.md(orCLAUDE.md). Append the rules from thepayload-project-kickoffAGENTS template to it instead of replacing it. - Run the project normalization in the
project-architectureskill (Step 2: move globals intosrc/globals).
Step 2: Add Payload to an existing Next.js app
create-payload-app asks interactive questions in this mode, which blocks unattended agents. Follow the manual steps in references/add-to-existing-app.md. Do not start until every route lives under src/app/(frontend)/, because Payload's admin needs its own root layout in src/app/(payload)/.
Step 3: Configure the database (libSQL / Turso)
Open src/payload.config.ts and make the adapter match this exactly:
import { sqliteAdapter } from '@payloadcms/db-sqlite'
// inside buildConfig({ ... })
db: sqliteAdapter({
client: {
url: process.env.DATABASE_URL || '',
authToken: process.env.DATABASE_AUTH_TOKEN,
},
}),Rules:
- Never add
transactionOptions: {}to the SQLite adapter. Payload keeps transactions off for SQLite by default because they cause database locking, which shows up as failed or hanging saves. - Keep the env variable name the generated config uses (
DATABASE_URLin 3.94). - Local development uses a file:
DATABASE_URL=file:./payload.db. Production uses Turso:DATABASE_URL=libsql://<db>-<org>.turso.ioplusDATABASE_AUTH_TOKEN. - Development uses push mode (schema syncs automatically). Production uses migrations only. Never point a dev server at the production database; push mode and migrations on the same database corrupt the migration history.
- Never use a
file:database on Vercel. The filesystem is read-only and resets on every deploy.
Step 4: Environment variables
Write .env.example with names and placeholders, and keep real values in .env (gitignored by the template).
PAYLOAD_SECRET=generate-a-long-random-string
DATABASE_URL=file:./payload.db
DATABASE_AUTH_TOKEN=
NEXT_PUBLIC_SERVER_URL=http://localhost:3000
PREVIEW_SECRET=generate-a-long-random-string
CRON_SECRET=generate-a-long-random-stringOther skills add their own variables to this file. Generate secrets with node -e "console.log(crypto.randomBytes(32).toString('hex'))".
Step 5: Data model
- Read the features list in
PROJECT.mdand the inventory (if a frontend existed). - Map content to collections and globals using references/data-model.md.
- For field options, hooks, and access control syntax, read the official Payload skill. Do not guess.
- After each schema change, run
pnpm generate:types. After adding admin components, runpnpm generate:importmap. - Register all plugins in
src/plugins/index.ts(the template keeps them there).
Step 6: First run
pnpm install, thenpnpm dev.- Open
http://localhost:3000/adminand create the first user. That user gets the highest role defined bypayload-auth-rbac. - In development only, the template's dashboard "Seed your database" button creates demo content. Remove the
beforeDashboardseed component before production. - Commit:
feat: bootstrap Payload project.
Stop and ask
- The brief requires PostgreSQL or MongoDB instead of libSQL.
- The existing app uses the Pages Router (
pages/folder) for routes that must stay. - The Turso database or its token is not available and the phase needs production data.
Done when
- Project created from the
websitetemplate, or Payload installed per the reference src/payload.config.tsusessqliteAdapterwithouttransactionOptions.env.examplelists every variable;.envis gitignored- Official Payload skill present in
.agents/skills/payloador.claude/skills/payload pnpm generate:typesandpnpm tsc --noEmitpass/adminloads, a user can log in, and creating then editing a post saves without errors
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

