Strapi Project Scaffolding#
Overview#
Strapi v5 projects are generated via create-strapi (a thin wrapper) and create-strapi-app (the implementation). The recommended invocation is:
npx create-strapi@latest
# or
npm create strapi@latest
create-strapi simply re-exports create-strapi-app, which contains all scaffolding logic . Source lives at packages/cli/create-strapi/ and packages/cli/create-strapi-app/ in the monorepo .
Scaffolding Architecture#
create-strapi-app produces a project from one of four bundled templates :
| Template | Language | Sample data |
|---|---|---|
vanilla | TypeScript | No |
vanilla-js | JavaScript | No |
example | TypeScript | Yes |
example-js | JavaScript | Yes |
The scaffolding pipeline: template copy β package.json generation (using mergePackageJson() via lodash.mergeWith, which replaces arrays rather than merging by index to prevent stale lock-file entries ) β dependency install β optional git init.
Key CLI flags :
--ts/--jsβ language (TypeScript is default)--use-npm/--use-yarn/--use-pnpmβ package manager--non-interactiveβ skip all prompts, use defaults (requires<directory>argument)--skip-dbβ SQLite with no prompts--template <name-or-url>β custom template--no-runβ create without starting the server
pnpm note: Strapi requires dependency hoisting. For pnpm, add
hoist=trueto.npmrcor use--use-pnpmflag so the scaffold writes the correctpnpm-workspace.yaml/package.json#pnpm.onlyBuiltDependencies. Strapi Cloud does not support pnpm.
Known Bugs in Freshly Scaffolded v5 Projects (5.49β5.50.x)#
Several regressions introduced between 5.49.0 and 5.50.1 break the admin panel in freshly generated projects. All are rooted in Vite bundle configuration.
1. ReferenceError: Prism is not defined β Blank Admin Panel#
Versions affected: 5.49.0β5.50.1 (5.48.1 is unaffected)
Symptom: Admin panel renders a completely blank page; browser console shows ReferenceError: Prism is not defined. Reproduces on a fresh npx create-strapi-app@5.50.1 project with no modifications.
Root cause: @strapi/content-manager's Blocks Code.mjs references Prism.languages and Prism.tokenize as globals, but Vite does not expose the imported prismjs module as a global after bundling.
Fix: PR #26978 (merged 2026-07-14) β adds prismjs/components/*.js to Vite's optimizeDeps.include globally and moves the prismjs preload import to the top of the content-manager admin entry.
Workaround (pre-fix): Add as the first import in src/admin/app.[t|j]sx:
import Prism from 'prismjs';
if (typeof window !== 'undefined') { window.Prism = Prism; }
Or downgrade all @strapi/* packages to 5.48.1.
2. CodeMirror Duplicate Instance β JSON Fields / Nested Components Crash#
Versions affected: 5.50.0β5.50.1
Symptom: Opening any content entry with a JSON field or nested component throws:
Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.
The error sticks for all subsequent entries in the same session. Affects JSON fields (#26951) and nested/sub-components (#26985) equally.
Root cause: Vite bundles multiple copies of @codemirror/state and related packages at runtime, breaking instanceof checks that CodeMirror relies on internally.
Fix: PR #27007 β adds @codemirror/state, @codemirror/view, @codemirror/language, @codemirror/lang-json, @codemirror/commands, @codemirror/lint, and @uiw/react-codemirror to resolve.dedupe, resolve.alias, and optimizeDeps.include in both Vite and Webpack configs. Scheduled for release 2026-07-15.
Workaround (pre-fix): Create src/admin/vite.config.js:
const path = require("path");
const { mergeConfig } = require("vite");
module.exports = (config) => mergeConfig(config, {
resolve: {
dedupe: ["@codemirror/state", "@codemirror/view", "@codemirror/language",
"@codemirror/commands", "@uiw/react-codemirror", "@strapi/design-system"],
alias: {
"@codemirror/state": path.resolve(__dirname, "../../node_modules/@codemirror/state"),
"@codemirror/view": path.resolve(__dirname, "../../node_modules/@codemirror/view"),
},
},
});
3. package-lock.json Out of Sync (zod@3 vs zod@4) β npm ci Fails#
Versions affected: 5.50.1
Symptom: A fresh scaffold's package-lock.json pins zod@3.25.67 but the resolved dependency tree requires zod@4.4.3. npm ci fails immediately on the untouched project:
npm error Invalid: lock file's zod@3.25.67 does not satisfy zod@4.4.3
Breaks CI/CD workflows that use npm ci for reproducible installs.
Workaround: Run npm install --package-lock-only in the project root to regenerate a synced lockfile, after which npm ci will succeed.
4. Redux Duplicate Context in pnpm Monorepos β Blank Admin Panel#
Versions affected: 5.48.1 in pnpm monorepos containing packages that depend on @reduxjs/toolkit@^2
Symptom: Admin panel loads blank with "Duplicate middleware references found when creating the store".
Root cause: getModulePath() used a bare require.resolve() scoped to @strapi/strapi's location, picking up the hoisted RTK 2.x instead of the RTK 1.9.7 pinned by @strapi/admin.
Fix: PR #26756 β scopes resolution to @strapi/admin's package directory using resolveFrom. See also Monorepo Module Resolution for the full context.
5. Homepage Crash β RangeError: Start Date is invalid#
Versions affected: 5.50.1
Symptom: Admin homepage crashes with RangeError: Start Date is invalid when "Last Published" / "Last Edited" widgets render. The /content-manager/homepage/recent-documents API serializes valid Postgres updatedAt/publishedAt timestamps as empty objects {} instead of ISO strings, causing date-fns's intervalToDuration() to throw.
Version Compatibility Quick Reference#
| Bug | 5.48.1 | 5.49.0 | 5.50.0β5.50.1 | Fix version |
|---|---|---|---|---|
| Prism / blank admin | β | β | β | >5.50.1 (PR #26978) |
| CodeMirror / JSON crash | β | β | β | 5.51 (PR #27007) |
Lock desync / npm ci | β | β | β | TBD |
| Redux / pnpm monorepo | β | β | β | >5.48.1 (PR #26756) |
β = working, β = broken, β = not confirmed
Key Source Files#
| File | Purpose |
|---|---|
packages/cli/create-strapi/ | Thin CLI wrapper; delegates to create-strapi-app |
packages/cli/create-strapi-app/src/ | Core scaffolding logic |
packages/cli/create-strapi-app/templates/ | Bundled project templates |
packages/core/strapi/src/node/vite/config.ts | Vite config factory (pre-bundling, dedupe, alias) |
packages/core/strapi/src/node/core/resolve-module.ts | getModulePath() β resolves package roots for aliases |