# Ant Design Pro Cheatsheet
[](https://github.com/ant-design/ant-design-pro) [](https://github.com/ant-design/ant-design-pro) [](https://nodejs.org/)

## π What's New in v6
- **React 19 + antd 6 + Umi Max 4**: Full upgrade to the latest stack, powered by utoopack (Turbopack)
- **Style Overhaul**: Less β Tailwind CSS v4 + antd-style + CSS Modules, CSS variable theming enabled
- **AI Assistant Page**: Chat interface example built with Ant Design X
- **React Query**: Migrated from useRequest to @tanstack/react-query
- **Biome**: Replaces ESLint + Prettier for unified linting and formatting
- **Cloudflare Worker Backend**: Standalone demo API deployment using Hono
- **And more**: Route prefetch, skeleton Loading, D3 map, Cheatsheet docs, moment β dayjs, class β functional components
β [View full changelog](https://github.com/ant-design/ant-design-pro/releases/tag/v6.0.0)
## Getting Started
**Create a project:**
```bash
git clone --depth 1 https://github.com/ant-design/ant-design-pro.git my-project
cd my-project
npm install
```
The project offers two modes:
- **Full mode**: Includes all demo pages (Dashboard, Forms, Lists, Access, etc.), great for reference and learning
- **Simple mode**: Only keeps login page and basic layout, ideal for starting from scratch
Switch to simple mode:
```bash
git add -A && git commit -m "chore: save before simple" # Commit first to allow revert
npm run simple # Remove demo pages and unused deps
npm install # Update dependencies
```
> π‘ Start with full mode to learn the project structure, then switch to simple mode for development.
**Directory structure:**
```
βββ config/ # Configuration (routes, proxy, theme)
β βββ config.ts # Main config
β βββ routes.ts # Route definitions
β βββ defaultSettings.ts # Layout & theme settings
β βββ proxy.ts # Dev proxy config
βββ mock/ # Mock data
βββ src/
β βββ components/ # Shared components
β βββ locales/ # i18n resources
β βββ models/ # Global data models
β βββ services/ # API service layer
β βββ utils/ # Utility functions
β βββ access.ts # Permission definitions
β βββ app.tsx # Runtime configuration
βββ docs/ # Project documentation
βββ types/ # Type declarations
```
**Common commands:**
| Command | Description |
|---------|-------------|
| `npm start` | Start dev server (UMI_ENV=dev, with Mock) |
| `npm run dev` | Start dev server (UMI_ENV=dev, no Mock) |
| `npm run start:no-mock` | Start without Mock |
| `npm run start:pre` | Pre-production environment |
| `npm run start:test` | Test environment |
| `npm run build` | Build for production |
| `npm run preview` | Preview built output (run `npm run build` first, port 8000) |
| `npm run preview:build` | Build and preview (port 8000) |
| `npm run deploy` | Build and deploy to GitHub Pages |
| `npm run analyze` | Analyze bundle size |
| `npm run lint` | Lint (Biome + TypeScript) |
| `npm run biome` | Auto-fix with Biome |
| `npm test` | Run tests |
| `npm run test:coverage` | Test with coverage |
| `npm run test:update` | Update test snapshots |
| `npm run tsc` | Type check without emitting |
| `npm run i18n-remove` | Remove i18n wrappers (locale=zh-CN) |
| `npm run record` | Record request data for login scene |
| `npm run openapi` | Generate API code from OpenAPI schema |
| `npm run simple` | Strip demo pages and unused deps |
> π‘ `UMI_ENV` switches environment configs, mapping to different proxy rules in `config/proxy.ts`.
> π‘ `npm run simple` removes demo pages (dashboard, form, list etc.) and unused dependencies (plots, etc.), replacing with minimal routes. Ideal for starting from scratch. **Commit your code first so you can revert if needed.**
**Build tool:** This project uses [utoopack](https://github.com/utooland/utoo) (a next-gen bundler powered by Turbopack) as the default build tool, configured via the `utoopack` field in `config/config.ts`. utoopack is Webpack-compatible and supports `module.rules` for custom loaders.
β See [umi Getting Started](https://umijs.org/docs/guides/getting-started), [utoo Docs](https://utoo.land)
## Routes & Menu
**Route config** is in `config/routes.ts`:
```ts
export default [
{
path: '/welcome',
name: 'welcome', // maps to menu.welcome i18n key
icon: 'home',
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
icon: 'crown',
access: 'canAdmin', // route-level access control
routes: [...],
},
{ path: '/', redirect: '/dashboard/analysis' },
{ component: '404', path: './*' },
];
```
**Route navigation:**
```tsx
import { useNavigate, useParams, useLocation } from '@umijs/max';
const navigate = useNavigate();
navigate('/dashboard'); // navigate
navigate(-1); // go back
const { id } = useParams(); // dynamic param /user/:id
const location = useLocation(); // current route info
```
**Menu & access:** The `access` field in route config controls menu visibility β unauthorized routes won't appear in the menu.
> π‘ The `name` field is automatically mapped to `menu.xxx` i18n keys. Configure translations in `src/locales/`.
β See [umi Routes](https://umijs.org/docs/guides/routes), [Umi Max Layout & Menu](https://umijs.org/docs/max/layout-menu)
## Layout
**ProLayout config** is in `config/defaultSettings.ts`:
```ts
export default {
navTheme: 'light', // nav theme: light / dark
colorPrimary: '#1890ff', // primary color
layout: 'mix', // layout mode: side / top / mix
contentWidth: 'Fluid', // content width: Fluid / Fixed
fixSiderbar: true, // fixed sidebar
};
```
**Layout modes:**
- `side` β Side navigation
- `top` β Top navigation
- `mix` β Top + side mixed navigation
**Page container:**
```tsx
import { PageContainer } from '@ant-design/pro-components';
const Page = () => (