Package Exports
- create-admin-platform
Readme
create-admin-platform
Production-ready CLI for generating a self-contained React management console. It creates a React 19 + Ant Design 6 + React Router 7 + Vite 8 admin app with source-landed runtime code, enterprise layout, auth, permission guards, theme switching, mocks and quality 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 pnpm dev command starts Vite at http://localhost:8500. To change the local port, edit --port 8500 in the generated package.json scripts.
CLI Flags
| Flag | 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> |
Dev-only source root override for local scaffold development. 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 version. | - |
Legacy --preset minimal | fintech flags are accepted for backward compatibility, but they warn and fall back to the normal preset. Operation/platform-side APIs are generated under @/api/enterprise/operation.
Generated Project
src/
api/ # auth APIs and business request clients
components/ # source-landed reusable components
config/ # app config, menu aggregation, feature flags, themes
layouts/ # BasicLayout and layout styles
lib/ # request / auth / permission / query / branding / 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 projects are self-contained. Runtime files are copied into normal project directories, so business apps do not need private @thsk/* runtime dependencies or file:../../packages/* links.
Generated 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. |
Package Contents
The published package ships these in-package assets:
dist/- CLI entry and type declarations.template/- project skeleton copied into the generated app.snapshot/packages/<name>/src/- frozen source files for the 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:e2eTo smoke-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 checkLicense
UNLICENSED.