{"id":48901244,"url":"https://github.com/halolight/halolight","last_synced_at":"2026-04-16T15:10:10.162Z","repository":{"id":326313973,"uuid":"1104431312","full_name":"halolight/halolight","owner":"halolight","description":"🟦 Next.js 15 企业级管理后台 Admin Dashboard - App Router, React 19, TypeScript, RBAC 权限, shadcn/ui, 拖拽仪表盘, 11 种主题 → halolight.h7ml.cn","archived":false,"fork":false,"pushed_at":"2025-12-19T04:58:29.000Z","size":5365,"stargazers_count":138,"open_issues_count":0,"forks_count":11,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T00:43:41.747Z","etag":null,"topics":["admin-template","dashboard","halolight","nextjs","pwa","rbac","react","shadcn-ui","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"https://halolight.docs.h7ml.cn/guide/nextjs","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/halolight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":null,"dco":null,"cla":null}},"created_at":"2025-11-26T07:52:06.000Z","updated_at":"2025-12-18T04:47:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/halolight/halolight","commit_stats":null,"previous_names":["dext7r/halolight"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/halolight/halolight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halolight%2Fhalolight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halolight%2Fhalolight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halolight%2Fhalolight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halolight%2Fhalolight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halolight","download_url":"https://codeload.github.com/halolight/halolight/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halolight%2Fhalolight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31891306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["admin-template","dashboard","halolight","nextjs","pwa","rbac","react","shadcn-ui","tailwindcss","typescript"],"created_at":"2026-04-16T15:10:09.424Z","updated_at":"2026-04-16T15:10:10.150Z","avatar_url":"https://github.com/halolight.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Halolight | Admin Pro\n\n[![CI](https://github.com/dext7r/halolight/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/dext7r/halolight/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/dext7r/halolight/blob/main/LICENSE)\n[![Vercel](https://img.shields.io/badge/Vercel-Deployed-000000.svg?logo=vercel)](https://halolight.h7ml.cn)\n[![pnpm](https://img.shields.io/badge/pnpm-10.23.0-ffa41c.svg)](https://pnpm.io)\n[![Next.js](https://img.shields.io/badge/Next.js-14-%23000000.svg)](https://nextjs.org/)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-%233178C6.svg)](https://www.typescriptlang.org/)\n[![React](https://img.shields.io/badge/React-18-%2361DAFB.svg)](https://react.dev/)\n[![Tailwind CSS](https://img.shields.io/badge/Tailwind%20CSS-4-%2306B6D4.svg)](https://tailwindcss.com/)\n[![Zustand](https://img.shields.io/badge/Zustand-5-%23E9D5FF.svg)](https://github.com/pmndrs/zustand)\n[![React Query](https://img.shields.io/badge/React%20Query-5-%23FF4154.svg)](https://tanstack.com/query)\n\n基于 Next.js 14 App Router 的现代化中文后台管理系统，内置可拖拽仪表盘、权限与状态管理、Server Actions、PWA 能力与可选 Mock 数据，适合快速搭建中后台应用。\n\n- 在线预览：\u003chttps://halolight.h7ml.cn\u003e\n- GitHub：\u003chttps://github.com/dext7r/halolight\u003e\n\n## 功能亮点\n\n- **Next.js 14 App Router + TypeScript**：支持 PWA、SEO 优化与全路由类型安全\n- **Server Actions**：内置用户、文档、日历、文件等服务端操作\n- **Tailwind CSS 4 + shadcn/ui**：原子化样式、Radix UI 原语、流畅主题切换（深色/浅色/系统）\n- **增强交互体验**：framer-motion 动画、Command Menu 全局搜索、TabBar/KeepAlive、加载遮罩\n- **状态与数据流**：React Query 5 + Axios 请求层，Zustand 5 管理认证/仪表盘/导航/UI 设置等全局状态\n- **可配置仪表盘**：react-grid-layout 支持拖拽、添加/删除/重置、布局持久化到 localStorage\n- **快捷设置面板**：快速切换主题、导航栏、TabBar、页脚等布局选项\n- **页脚与加载控制**：独立页脚组件，导航加载遮罩显示开关\n- **Mock.js 集成**：环境变量一键启用，无后端快速演示开发\n- **完整 CI/CD**：GitHub Actions 自动化测试、构建、安全审计\n\n## 目录结构\n\n```\nsrc/\n├── actions/               # Server Actions（用户、文档、日历、文件操作）\n├── app/\n│   ├── (auth)/            # 认证页分组（login/register/reset，独立布局）\n│   └── (dashboard)/       # 主业务分组（analytics/messages/users 等，共享布局）\n├── components/\n│   ├── ui/                # shadcn/ui 基础组件（Button/Dialog/Table 等）\n│   ├── auth/              # 认证相关碎片组件\n│   ├── layout/            # AdminLayout、Header、Sidebar、TabBar、CommandMenu\n│   ├── dashboard/         # ConfigurableDashboard 与图表/统计卡片部件\n│   └── data-table/        # 表格封装与工具\n├── config/                # 集中配置（路由、权限映射）\n├── hooks/                 # React Query hooks（按资源拆分：useUsers/useAuth 等）\n├── lib/\n│   ├── api/               # 服务定义、Axios client、API 类型\n│   ├── store-factory.ts   # Zustand store 工厂函数\n│   └── validations/       # 表单/数据校验 schema（zod）\n├── mock/                  # Mock.js 数据拦截规则\n├── providers/             # 全局 Provider 组合（Theme/Mock/Query/Auth/Permission/WebSocket/Error）\n├── stores/                # Zustand 状态管理（auth、dashboardLayout、tabs、uiSettings）\n├── types/                 # 通用 TypeScript 类型定义\n└── __tests__/             # 测试文件（Vitest + React Testing Library）\n```\n\n## 快速开始\n\n环境要求：Node.js \u003e= 18、pnpm \u003e= 8（项目锁定 pnpm@10.23.0）。\n\n```bash\npnpm install\npnpm dev         # 本地开发，默认 http://localhost:3000\n```\n\n可选：启用 Mock 数据（仅前端模拟）\n\n```bash\nexport NEXT_PUBLIC_MOCK=true\npnpm dev\n```\n\n生产构建与预览\n\n```bash\npnpm build\npnpm start       # 使用构建产物启动\n```\n\n## 环境变量\n\n| 变量名 | 说明 | 默认值 |\n|--------|------|--------|\n| `NEXT_PUBLIC_API_URL` | API 基础地址 | `/api` |\n| `NEXT_PUBLIC_MOCK` | `true` 时启用 Mock.js 拦截 | `false` |\n| `NEXT_PUBLIC_DEMO_EMAIL` | 演示账号邮箱 | - |\n| `NEXT_PUBLIC_DEMO_PASSWORD` | 演示账号密码 | - |\n| `NEXT_PUBLIC_SHOW_DEMO_HINT` | 显示演示账号提示 | `false` |\n| `NEXT_PUBLIC_WS_URL` | WebSocket 服务器地址 | - |\n| `NEXT_PUBLIC_APP_TITLE` | 应用标题 | `Admin Pro` |\n| `NEXT_PUBLIC_BRAND_NAME` | 品牌名称 | `Halolight` |\n\n在项目根目录创建 `.env.local` 文件来覆盖默认值：\n\n```bash\n# .env.local 示例\nNEXT_PUBLIC_API_URL=https://api.halolight.h7ml.cn\nNEXT_PUBLIC_MOCK=true\nNEXT_PUBLIC_DEMO_EMAIL=admin@halolight.h7ml.cn\nNEXT_PUBLIC_DEMO_PASSWORD=123456\n```\n\n## 常用脚本\n\n```bash\npnpm dev          # 启动开发服务器（http://localhost:3000）\npnpm build        # 生产构建，输出到 .next 目录\npnpm start        # 使用构建产物启动生产服务\npnpm lint         # ESLint 检查代码规范\npnpm lint:fix     # 自动修复 ESLint 问题\npnpm type-check   # TypeScript 类型检查（不输出文件）\npnpm preview      # 完整构建并本地预览（build + start）\npnpm test         # 运行测试（watch 模式）\npnpm test:run     # 运行测试（单次执行）\npnpm test:coverage # 运行测试并生成覆盖率报告\n```\n\n## 代码规范\n\n- **路径别名**：使用 `@/*` 别名指向 `./src/*`\n- **ESLint 规则**：\n  - 自动排序 import 语句（`simple-import-sort`）\n  - 自动移除未使用的 import（`unused-imports/no-unused-imports`）\n  - Next.js 官方规则集\n- **Provider 层级**：`ThemeProvider → MockProvider → QueryProvider → AuthProvider → PermissionProvider → WebSocketProvider → ErrorProvider`\n- **类型命名**：避免与全局类型冲突（如使用 `Document as DocumentType`）\n- **组件范式**：优先使用服务端组件（Server Components），需要客户端交互时使用 `'use client'` 指令\n\n## CI/CD\n\n项目配置了 GitHub Actions 自动化工作流 (`.github/workflows/ci.yml`)：\n\n| Job | 说明 |\n|-----|------|\n| `lint` | ESLint 检查 + TypeScript 类型检查 |\n| `test` | 单元测试 + 覆盖率报告上传到 Codecov |\n| `build` | Next.js 生产构建 + 构建产物缓存 |\n| `security` | 依赖安全审计（pnpm audit） |\n| `dependency-review` | PR 依赖变更检查（仅 Pull Request） |\n\n## 部署\n\n### Vercel（推荐）\n\n点击一键部署到 Vercel：\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/dext7r/halolight)\n\n### 自托管部署\n\n1. **环境准备**：确保 Node.js \u003e= 18 和 pnpm \u003e= 8 已安装\n2. **配置环境变量**：复制 `.env.example` 为 `.env.local` 并设置必要变量\n3. **构建项目**：\n   ```bash\n   pnpm install\n   pnpm build\n   ```\n4. **启动服务**：\n   ```bash\n   pnpm start  # 生产模式启动\n   ```\n5. **进程守护**（可选）：使用 PM2、systemd 或 Docker 运行\n\n### Docker 部署\n\n```dockerfile\nFROM node:20-alpine AS builder\nWORKDIR /app\nRUN npm install -g pnpm\nCOPY package.json pnpm-lock.yaml ./\nRUN pnpm install --frozen-lockfile\nCOPY . .\nRUN pnpm build\n\nFROM node:20-alpine AS runner\nWORKDIR /app\nENV NODE_ENV=production\nCOPY --from=builder /app/.next/standalone ./\nCOPY --from=builder /app/.next/static ./.next/static\nCOPY --from=builder /app/public ./public\nEXPOSE 3000\nCMD [\"node\", \"server.js\"]\n```\n\n构建并运行：\n\n```bash\ndocker build -t halolight .\ndocker run -p 3000:3000 halolight\n```\n\n## 浏览器支持\n\n- Chrome \u003e= 90\n- Firefox \u003e= 88\n- Safari \u003e= 14\n- Edge \u003e= 90\n\n## 贡献\n\n欢迎提交 Issue 和 Pull Request 来帮助改进项目！\n\n1. Fork 本仓库\n2. 创建特性分支 (`git checkout -b feature/amazing-feature`)\n3. 提交更改 (`git commit -m 'feat: add amazing feature'`)\n4. 推送到分支 (`git push origin feature/amazing-feature`)\n5. 创建 Pull Request\n\n## 相关链接\n\n- [在线预览](https://halolight.h7ml.cn)\n- [GitHub 仓库](https://github.com/dext7r/halolight)\n- [问题反馈](https://github.com/dext7r/halolight/issues)\n\n## 许可证\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalolight%2Fhalolight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalolight%2Fhalolight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalolight%2Fhalolight/lists"}