{"id":47098638,"url":"https://github.com/zhangxiaowei6/zx-admin","last_synced_at":"2026-03-15T18:02:00.917Z","repository":{"id":343223652,"uuid":"1176769303","full_name":"zhangxiaowei6/ZX-Admin","owner":"zhangxiaowei6","description":"ZX-Admin 是一套开源的多平台多租户企业级管理后台，基于 React 18 + TypeScript + Ant Design 构建。","archived":false,"fork":false,"pushed_at":"2026-03-12T19:12:23.000Z","size":418,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-12T19:26:01.089Z","etag":null,"topics":["ant-design","pro-components","react","ts","vite","zustand"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhangxiaowei6.png","metadata":{"files":{"readme":"README.en.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.en.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-09T11:04:08.000Z","updated_at":"2026-03-12T19:12:26.000Z","dependencies_parsed_at":"2026-03-11T14:01:53.334Z","dependency_job_id":null,"html_url":"https://github.com/zhangxiaowei6/ZX-Admin","commit_stats":null,"previous_names":["zhangzhaowei865700/zx-admin","zhangxiaowei6/zx-admin"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/zhangxiaowei6/ZX-Admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxiaowei6%2FZX-Admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxiaowei6%2FZX-Admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxiaowei6%2FZX-Admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxiaowei6%2FZX-Admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangxiaowei6","download_url":"https://codeload.github.com/zhangxiaowei6/ZX-Admin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxiaowei6%2FZX-Admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30469843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ant-design","pro-components","react","ts","vite","zustand"],"created_at":"2026-03-12T15:00:34.124Z","updated_at":"2026-03-13T16:01:24.886Z","avatar_url":"https://github.com/zhangxiaowei6.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZX-Admin\n\nMulti-platform multi-tenant enterprise admin dashboard, built with React 18 + TypeScript + Ant Design, designed for SaaS scenarios.\n\n[![Version](https://img.shields.io/badge/version-1.4.0-blue)](https://github.com/zhangxiaowei6/ZX-Admin)\n[![Stars](https://img.shields.io/github/stars/zhangxiaowei6/ZX-Admin?style=flat)](https://github.com/zhangxiaowei6/ZX-Admin)\n[![License](https://img.shields.io/github/license/zhangxiaowei6/ZX-Admin)](LICENSE)\n\n[Live Demo](https://zhangxiaowei6.github.io/ZX-Admin/) | Test account: `admin` / `zx@123` | [Changelog](./CHANGELOG.md) | [中文](./README.md)\n\n---\n\n## Features\n\n- **Dual-Level Multi-Tenancy**: Platform and tenant sides share one codebase, supporting seamless multi-platform switching\n- **Enterprise-Grade Security**: Request signing (X-Sign + Timestamp + Nonce), optional AES encryption, cross-tab logout sync\n- **Highly Configurable**: 20+ auto-persisted settings — theme, layout, form, table preferences, all adjustable in real-time\n- **Modern Stack**: Vite 5 + Zustand + React Query, instant HMR, lightweight state management\n\n---\n\n## Tech Stack\n\n[![React](https://img.shields.io/badge/React-18.2-61DAFB?style=flat-square\u0026logo=react\u0026logoColor=white)](https://react.dev)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.3-3178C6?style=flat-square\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![Vite](https://img.shields.io/badge/Vite-5.0-646CFF?style=flat-square\u0026logo=vite\u0026logoColor=white)](https://vitejs.dev)\n[![Ant Design](https://img.shields.io/badge/Ant%20Design-5.21-0170FE?style=flat-square\u0026logo=antdesign\u0026logoColor=white)](https://ant.design)\n[![Zustand](https://img.shields.io/badge/Zustand-4.4-443E44?style=flat-square)](https://zustand-demo.pmnd.rs/)\n[![React Query](https://img.shields.io/badge/React%20Query-5-FF4154?style=flat-square\u0026logo=reactquery\u0026logoColor=white)](https://tanstack.com/query)\n[![React Router](https://img.shields.io/badge/React%20Router-6-CA4245?style=flat-square\u0026logo=reactrouter\u0026logoColor=white)](https://reactrouter.com)\n[![TailwindCSS](https://img.shields.io/badge/TailwindCSS-3-06B6D4?style=flat-square\u0026logo=tailwindcss\u0026logoColor=white)](https://tailwindcss.com)\n[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-339933?style=flat-square\u0026logo=node.js\u0026logoColor=white)](https://nodejs.org)\n\n---\n\n## Quick Start\n\n**Requirements**: Node.js \u003e= 18.0.0\n\n```bash\ngit clone https://github.com/zhangxiaowei6/ZX-Admin.git\ncd ZX-Admin\nnpm install\ncp .env.example .env.local   # fill in your config if needed\nnpm run dev\n```\n\nOpen http://localhost:3000 and log in with `admin` / `zx@123`.\n\n---\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `npm run dev` | Start dev server (port 3000, with Mock API) |\n| `npm run build` | Build for production |\n| `npm run build:demo` | Build demo version |\n| `npm run preview` | Preview production build |\n| `npm run preview:demo` | Build and preview demo version |\n| `npm run lint` | Run ESLint |\n\n---\n\n## Environment Variables\n\n```bash\n# .env.development\nVITE_API_BASE_URL=           # Empty = use Mock; set to backend URL to connect real API\nVITE_CRYPTO_ENABLED=false    # Enable AES encryption\nVITE_APP_KEY=merchant-admin  # Signing key (must match backend)\nVITE_APP_SECRET=dev-secret   # Signing secret (change in production)\nVITE_BASE_PATH=/             # Deployment sub-path\n```\n\nTo connect a real backend, create `.env.development.local` (not committed to git):\n\n```bash\nVITE_API_BASE_URL=http://your-backend-url.com\nVITE_CRYPTO_ENABLED=true\nVITE_APP_KEY=your-app-key\nVITE_APP_SECRET=your-app-secret\n```\n\n\u003e Signing algorithm: `src/utils/sign.ts`. Encryption algorithm: `src/utils/crypto.ts`.\n\n---\n\n## Project Structure\n\n```\nZX-Admin/\n├── mock/                    # Mock server (platform / tenant)\n├── src/\n│   ├── api/                 # API layer\n│   ├── components/          # Shared and layout components\n│   ├── config/              # Default settings (defaultSettings.json)\n│   ├── constants/           # Global constants and menu config\n│   ├── hooks/               # Custom hooks\n│   ├── locales/             # i18n translations (zh-CN/en-US/ja-JP)\n│   ├── pages/               # Page components\n│   ├── routes/              # Routes and guards\n│   ├── services/            # Business logic (role/menu tree utils)\n│   ├── stores/              # Zustand stores\n│   ├── types/               # TypeScript types\n│   └── utils/               # Utility functions\n├── .env.example\n├── .env.development\n├── .env.production\n├── vite.config.ts\n└── package.json\n```\n\n---\n\n## Deployment\n\n**Nginx**\n\n```bash\nnpm run build\n# Deploy dist/ to your web server\n```\n\n```nginx\nserver {\n    listen 80;\n    server_name your-domain.com;\n    root /path/to/dist;\n    index index.html;\n\n    location / {\n        try_files $uri $uri/ /index.html;\n    }\n\n    gzip on;\n    gzip_types text/plain text/css application/json application/javascript;\n}\n```\n\n**Docker**\n\n```dockerfile\nFROM node:20-alpine AS builder\nWORKDIR /app\nCOPY package*.json ./\nRUN npm install\nCOPY . .\nRUN npm run build\n\nFROM nginx:alpine\nCOPY --from=builder /app/dist /usr/share/nginx/html\nCOPY nginx.conf /etc/nginx/conf.d/default.conf\nEXPOSE 80\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n```\n\n```bash\ndocker build -t zx-admin .\ndocker run -d -p 80:80 zx-admin\n```\n\n---\n\n## FAQ\n\n**How to switch to a real API?**\nCreate `.env.development.local` with `VITE_API_BASE_URL` set, then restart the dev server.\n\n**Login fails?**\nIn Mock mode, ensure `VITE_API_BASE_URL` is empty and use `admin` / `zx@123`. For real backend, verify Key/Secret match and that CORS is enabled.\n\n**How to customize theme colors?**\nClick the ⚙️ icon in the top-right corner. All settings persist automatically in `localStorage`.\n\n**How to add a new menu?**\n- Platform menu: edit `src/constants/menu/platformMenu.tsx`\n- Tenant menu: edit `src/constants/menu/tenantMenu.tsx`\n\n**How to resolve CORS issues?**\nIn development, configure a proxy in `vite.config.ts`. In production, use Nginx reverse proxy or configure CORS on the backend.\n\n**How to disable AES encryption?**\nSet `VITE_CRYPTO_ENABLED=false`. Request signing cannot be disabled; to modify the logic edit `src/utils/sign.ts`.\n\n---\n\n## Adding a Business Module\n\nUsing \"Notice Management\" as an example:\n\n1. **Register route**: Add entry in `src/routes/modules/platform.tsx`\n2. **Add menu item**: Add entry in `src/constants/menu/platformMenu.tsx`\n3. **Create page**: Create `src/pages/Platform/Notice/index.tsx`\n4. **Define API**: Create `src/api/modules/platform/notice.ts`\n5. **Create hook** (optional): Create `src/pages/Platform/Notice/hooks/useNotice.ts`\n6. **Add mock**: Create `mock/platform/notice.ts` and import it in `mock/index.ts`\n\nNo framework code needs to be modified.\n\n---\n\n## Browser Support\n\nChrome 90+ / Firefox 88+ / Edge 90+ / Safari 14+\n\n\u003e Requires View Transition API and BroadcastChannel API. IE is not supported.\n\n---\n\n## Contributing\n\n1. Fork this repository\n2. Create a branch: `git checkout -b feature/AmazingFeature`\n3. Commit: `git commit -m 'feat: add some feature'`\n4. Push: `git push origin feature/AmazingFeature`\n5. Open a Pull Request\n\nCommits follow [Conventional Commits](https://www.conventionalcommits.org/). See [CONTRIBUTING.en.md](CONTRIBUTING.en.md) for details.\n\n---\n\n## License\n\n[MIT](LICENSE) © 2026 zhangxiaowei6\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangxiaowei6%2Fzx-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangxiaowei6%2Fzx-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangxiaowei6%2Fzx-admin/lists"}