@itgkey/integrate-itgkey
v0.4.10
Published
Add itgkey to an existing Next.js app with minimal setup.
Readme
@itgkey/integrate-itgkey
Add itgkey to an existing Next.js app with minimal setup.
Usage
npx @itgkey/integrate-itgkey@latestOr target a specific directory:
npx @itgkey/integrate-itgkey@latest ./my-next-appThe CLI will:
- Add
keystatic.config.ts - Add
page-builder.ts - Add
editor/device-visibility-*helper files for responsive block visibility controls - Add
app/renderBlocks.tsxandapp/LivePreviewPage.tsx(orsrc/app/...) - Add
app/page-records.tsfor page collection reads and nested navigation - Add
app/CmsWidget.tsxandapp/CmsSessionBeacon.tsxwhen scaffolding CMS-aware routes - Add API route files under
app/api/keystatic/[...params]/route.ts(orsrc/app/...) - Add
app/api/link-options/route.tsfor page/post link lookups - Add admin UI route files under
app/keystatic(orsrc/app/keystatic) - Add dynamic frontend routes (
/and/[...slug]) with block rendering - Add posts route rendering with block content (
/posts/[slug]) - Add starter content files (
pages/hi.yaml,settings/index.yaml,posts/first-post.yaml) - Add
itgkey-blocks.tsfor user-defined component/block schemas - Add
.github/prompts/itgkey-migration-agent.prompt.mdfor Codex-driven project-specific migration - Add
postcss.config.jsandtailwind.config.jsso block styling works like the template - Optionally install required runtime + styling dependencies
When existing frontend routes are detected, the CLI defaults to preserve mode:
- Keeps your existing frontend route files and layout files
- Adds preview routes under
/itgkey-preview - Adds
app/itgkey-responsive.tsxhelper to convert existing page sections into responsive blocks
When existing itgkey files are detected, the CLI can rebuild managed files to
the latest scaffold and remove legacy preview/live [slug] routes that can
shadow the new [...slug] routes.
Migration rule: user-facing copy should be CMS-driven.
- During migration, map current page titles/text/buttons into block fields in Keystatic.
- Avoid hardcoding site copy in components so content stays editable from
/keystatic. - Treat each existing frontend component/section as its own block (no mega catch-all block).
- After migration, verify multiple routes work (at minimum:
/,/keystatic,/itgkey-preview,/itgkey-preview/[slug], and one real/posts/[slug]route if posts exist).
