create-admin-platform
v1.0.9
Published
CLI generator for React 19 + Ant Design 6 + React Router 7 + Vite 8 management console projects. Source-landing scaffolding with pluggable presets, themes, mock backend and feature flags.
Maintainers
Readme
create-admin-platform
Production-ready CLI for creating self-contained React management console projects.
create-admin-platform creates a React 19 + Ant Design 6 + React Router 7 + Vite 8 admin app, with runtime source code, enterprise layout, auth, permissions, themes, local mocks and quality scripts already wired together.
What You Get
- A Vite, React and Ant Design admin project.
- Built-in routing, layout, auth, permissions and themes.
- Self-contained runtime source code with no private package dependencies.
- Ready-to-use dev, lint, typecheck, test and build scripts.
Requirements
- Node.js >= 20
- pnpm >= 10 is recommended
npm and yarn are also supported.
Create A Project
Recommended:
pnpm dlx create-admin-platform@latest my-adminThe defaults give you a runnable, mock-backed admin app. The line above is equivalent to spelling every default out explicitly:
pnpm dlx create-admin-platform@latest my-admin --features=mock,admin,security,form-builder --router-mode hash --theme defaultWhat each flag does:
--features=mock,admin,security,form-builder— Comma-separated feature modules.mockboots the MSW browser worker so the app runs offline;adminadds the operations console;securityadds auth guards and the login flow;form-builderadds the iframe-embedded form designer integration. Trim the list to drop modules you do not need.--router-mode hash—hashuses/#/path(works on any static host with no extra config);browseruses/path(requires the host to fall back toindex.htmlfor unknown URLs).--theme default— Initial theme key. Built-ins:default,fintech,compact,dark,linear,stripe,apple,ibm.
See the CLI Options table below for every flag and its default.
Alternatives (npm and yarn):
npm create admin-platform@latest my-admin
yarn create admin-platform my-adminThen run the generated app:
cd my-admin
pnpm install
pnpm check
pnpm devThe generated development server runs at http://localhost:8500.
Global Installation
If you prefer installing the admin scaffold CLI globally, use the commands below.
Install:
pnpm add -g create-admin-platformCheck the installed CLI version:
create-admin-platform --versionCreate a project directory — the simplest form, all defaults:
create-admin-platform my-adminOr spell every flag out explicitly (equivalent to the line above):
create-admin-platform my-admin --features=mock,admin,security,form-builder --router-mode hash --theme defaultWhat each flag does:
--features=mock,admin,security,form-builder— Comma-separated feature modules.mockboots the MSW browser worker so the app runs offline;adminadds the operations console;securityadds auth guards and the login flow;form-builderadds the iframe-embedded form designer integration. Trim the list to drop modules you do not need.--router-mode hash—hashuses/#/path(works on any static host with no extra config);browseruses/path(requires the host to fall back toindex.htmlfor unknown URLs).--theme default— Initial theme key. Built-ins:default,fintech,compact,dark,linear,stripe,apple,ibm.
Upgrade to the latest version (either re-install or update; the first form also works if the CLI is not installed yet):
pnpm add -g create-admin-platform@latest
pnpm update -g create-admin-platformCLI Options
| Option | Description | Default |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| --preset <name> | Project preset. blank is the OSS scaffold; chain-bill is a fuller business example. | blank |
| --features <list> | Comma-separated feature flags: mock, admin, security, form-builder. | mock,admin,security,form-builder |
| --router-mode <mode> | Router mode: hash or browser. | hash |
| --theme <key> | Initial theme: default, fintech, compact, dark, linear, stripe, apple, ibm. | default |
| --registry <url> | Optional package registry written into the generated .npmrc. | none |
| --link-workspace-root <path> | Development-only source root override for local scaffold work. Published-package users should not need it. | auto |
| --interactive | Force prompts even when <project-name> is provided. | false |
| -h, --help | Show help. | - |
| -v, --version | Show CLI version. | - |
Legacy --preset minimal | normal | fintech flags are accepted for backward compatibility. They warn on stderr and fall back to blank.
Generated Project Layout
src/
api/ # auth APIs and business request clients
components/ # source-landed reusable components
config/ # app config, menu aggregation, feature flags and themes
layouts/ # BasicLayout and layout styles
lib/ # request, auth, permission, query, branding and dictionary
pages/ # route pages, hooks and page-private components
router/ # route creation, guards and business route adapters
stores/ # Zustand stores
styles/ # global Less styles
utils/ # pure utilities split by topic
types/ # project-level runtime types
mock/ # local mock handlers
public/ # static assetsGenerated Scripts
| Command | Purpose |
| --------------- | ------------------------------------------------ |
| pnpm dev | Start the development server on port 8500. |
| pnpm dev:test | Start the app with .env.test on port 8500. |
| pnpm dev:uat | Start the app with .env.uat on port 8500. |
| pnpm check | Run lint, typecheck, tests and production build. |
| pnpm build | Typecheck and build for production. |
| pnpm test | Run Vitest. |
| pnpm preview | Preview production output locally. |
To change the development port, edit --port 8500 in the generated package.json scripts.
Package Contents
The published package ships all assets needed to create a project:
dist/- CLI entry and type declarations.template/- project skeleton copied into the generated app.snapshot/packages/<name>/src/- frozen source files for runtime and preset modules.
template/ and snapshot/ are produced by scripts/build-assets.mjs during pnpm build and prepublishOnly. Published installs do not require this monorepo on disk.
Local Development
From the monorepo root:
pnpm install
pnpm --filter create-admin-platform build
pnpm --filter create-admin-platform test:e2eSmoke-test the local CLI without absolute machine paths:
pnpm --filter create-admin-platform build
node packages/create-admin-platform/dist/index.js ../admin-platform-verify --features=mock,admin,security,form-builder --router-mode hash --theme default
cd ../admin-platform-verify
pnpm install
pnpm checkFAQ
Does the generated app depend on this monorepo?
No. Runtime code is copied into the generated app, so the business project can be installed, built and deployed independently.
Should this CLI be added to generated app dependencies?
No. Use it as a project initializer through pnpm dlx, npm create or yarn create.
