Package Exports
- create-admin-platform
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-admin --features=mock,admin,security --router-mode hash --theme defaultAlternatives:
npm create admin-platform@latest my-admin -- --features=mock,admin,security --router-mode hash --theme default
yarn create admin-platform my-admin --features=mock,admin,security --router-mode hash --theme defaultThen 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:
create-admin-platform my-admin --features=mock,admin,security --router-mode hash --theme defaultUpgrade to the latest version:
pnpm add -g create-admin-platform@latest
pnpm update -g create-admin-platformCLI Options
| Option | Description | Default |
|---|---|---|
--features <list> |
Comma-separated feature flags: mock, admin, security, form-builder. |
mock |
--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 | fintech flags are accepted for backward compatibility. They warn and fall back to the normal preset. Operation and platform-side APIs are generated under @/api/enterprise/operation.
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.
License
UNLICENSED.