Umi max enterprise
Conventions and patterns for building enterprise apps with Umi Max (@umijs/max), Ant Design Pro, RBAC, ProTable, ProForm, all ProComponents, antd components, Ant Design Charts, GraphQL, and the built-in REST request layer. Use this whenever the user is working in an Umi Max project — mentions "umi", "@umijs/max", "umi max", "Ant Design Pro", ProTable, ProForm, ModalForm, DrawerForm, StepsForm, ProCard, ProDescriptions, ProList, ProLayout, "@ant-design/charts", or files like config/config.ts, src/app.tsx, src/access.ts, src/models, or src/services in a project using the `max` CLI. Covers convention-based routing, the Model data-flow system (useModel), the built-in request layer (axios + ahooks useRequest), the access/permissions plugin (useAccess, <Access>), RBAC with dynamic server-driven menus, ProTable for data-heavy list pages, all ProComponents (ProForm/ModalForm/DrawerForm/StepsForm/ProCard/ProDescriptions/ProList), key antd components and enterprise patterns, Ant Design Charts for dashboards, GraphQL integration via Apollo Client or urql, and the ProLayout-based layout & menu system.From its SKILL.md
npx -y skills add mik284/umi-max-enterpriseAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
7.4 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
Umi Max — Enterprise Patterns
Umi Max (@umijs/max) is a curated bundle of plugins on top of UmiJS: convention-based routing, a hooks-based global data store ("Model"), a unified request layer, role-based access control, and a ProLayout-based shell — all wired together so an enterprise admin app needs almost no boilerplate. The defaults are opinionated. The biggest mistake an agent can make here is reaching for generic React patterns (Redux, raw fetch, hand-rolled route guards, custom admin shells, plain antd Table) when Umi Max and ProComponents already have a convention-based answer.
Before writing code in an Umi Max project, identify which system the task touches, and read the matching reference file:
| Task involves... | Read |
|---|---|
Global state, shared data between components, useModel, @@initialState | references/data-flow.md |
Calling a REST backend, useRequest, error handling, interceptors, request config | references/request.md |
Permissions, roles, "can this user see/do X", route guards, <Access> | references/access.md |
| Page shell, sidebar menu, route config, page title/icon, hiding nav items | references/layout-routing.md |
| Data tables, search forms, CRUD list pages, column actions, toolbar | references/pro-table.md |
| ProForm, ModalForm, DrawerForm, StepsForm, ProCard, ProDescriptions, ProList, ProSkeleton | references/pro-components.md |
| antd Form, Upload, Modal, Drawer, Notification, ConfigProvider, Statistic | references/antd-components.md |
| Dynamic server-driven menus, multi-tenant roles, fine-grained permissions | references/rbac.md |
| GraphQL queries, mutations, subscriptions, Apollo/urql setup | references/graphql.md |
| Dashboard charts, Line, Bar, Pie, DualAxes, Gauge, Tiny sparklines, org charts | references/charts.md |
If a task touches more than one (e.g. "add a dashboard page with charts that only managers can see"), read all relevant files — they're short and meant to be combined.
Mental model
Umi Max + ProComponents + antd replace almost everything you'd normally hand-roll:
- Redux / Zustand / Context → Model (
src/models/*.ts) +useModel() - axios/fetch wrapper → built-in
request/useRequestfrom@umijs/max - Manual
<PrivateRoute>guards → routeaccess:key +src/access.ts - Hand-built admin shell →
layoutplugin renders ProLayout from route config - Custom table + search form →
ProTablefrom@ant-design/pro-components - antd Form boilerplate →
ProForm,ModalForm,DrawerForm,StepsForm - antd Card layouts →
ProCardwithsplit,colSpan, tabs - Record detail views →
ProDescriptions - Chart.js / Recharts →
@ant-design/charts(Line, Column, Pie, Gauge, etc.) - Custom GraphQL wiring → Apollo Client or urql via
rootContainerinsrc/app.tsx
Project conventions an agent must respect
- Use the
maxCLI, notumi. Scaffolding commands arenpx max g .... - Respect directory conventions:
- Models:
src/models/*.tsor co-locatedsrc/pages/xxx/models/ - Services (API calls):
src/services/*.ts - Access rules:
src/access.ts(single file, default export) - Route config:
config/config.tsorconfig/routes.ts— check which exists - Runtime config (interceptors, layout, GraphQL provider):
src/app.ts/src/app.tsx - GraphQL:
src/graphql/client.ts,src/graphql/queries/,src/graphql/generated/
- Models:
- Import from
@umijs/max, not fromreact-redux,axios,react-router-domfor things Umi Max provides. - Import ProComponents from
@ant-design/pro-components, not fromantd. - Import charts from
@ant-design/charts, not fromrecharts,chart.js, orecharts. - TypeScript types:
RequestConfigandRunTimeLayoutConfigare exported from@umijs/max. - Backend is the source of truth for permissions. Client-side RBAC is UX polish only.
- Wrap the app in
<App>from antd and useApp.useApp()formessage/modal/notification— never call them as static module imports. - Do not override antd styles with
.ant-*CSS selectors — useConfigProviderdesign tokens.
Quick examples
Model + useModel:
// src/models/userModel.ts
import { useState, useCallback } from 'react';
import { getUser } from '@/services/user';
export default function useUserModel() {
const [user, setUser] = useState<any>(null);
const fetchUser = useCallback(async () => setUser(await getUser()), []);
return { user, fetchUser };
}
// In a component:
const { user } = useModel('userModel');
REST request:
const { data, loading } = useRequest(() => getUserList({ page: 1 }));
Access:
// src/access.ts
export default function access(initialState: any) {
const perms = new Set<string>(initialState?.currentUser?.permissions ?? []);
return { canAdmin: initialState?.currentUser?.role === 'admin', canWriteUsers: perms.has('user:write') };
}
// Route:
{ path: '/admin', component: 'Admin', access: 'canAdmin' }
ProTable:
<ProTable rowKey="id" request={async (params) => {
const res = await getUserList(params);
return { data: res.data, success: true, total: res.total };
}} columns={columns} />
ModalForm:
<ModalForm title="Create User" trigger={<Button type="primary">+ New</Button>}
modalProps={{ destroyOnClose: true }}
onFinish={async (values) => { await createUser(values); return true; }}>
<ProFormText name="name" label="Name" rules={[{ required: true }]} />
</ModalForm>
Dashboard chart:
import { Line } from '@ant-design/charts';
<div style={{ height: 280 }}>
<Line data={data} xField="month" yField="revenue" smooth />
</div>
GraphQL provider (src/app.tsx):
import { ApolloProvider } from '@apollo/client';
import { apolloClient } from './graphql/client';
export function rootContainer(container: React.ReactNode) {
return <ApolloProvider client={apolloClient}>{container}</ApolloProvider>;
}
RBAC dynamic menu:
export const layout: RunTimeLayoutConfig = ({ initialState }) => ({
menu: { request: async () => fetchMenuByRole(initialState?.currentUser?.role) },
});
Read the relevant reference file before writing real code — each one covers configuration options, gotchas, and patterns that are not safe to guess.
What ships with it: 12 files
81.5 KB alongside SKILL.md
references/
- access.md4.3 KB
- antd-components.md9.1 KB
- charts.md10.8 KB
- data-flow.md5.3 KB
- graphql.md8.4 KB
- layout-routing.md4.3 KB
- pro-components.md11.6 KB
- pro-table.md6.9 KB
- rbac.md7.3 KB
- request.md6.8 KB