cohort-harbor README

The project's README from github.com/lantingzhang1119/cohort-harbor. As one markdown file: README.md.

CohortHarbor

可自托管的员工入职、制度学习与考试平台。CohortHarbor 把员工账号、入职资料、制度版本、在线学习、考试任务、通知邮件和私有文件保护放在一个全栈应用中,适合内部部署、二次开发和开源协作。

CI CodeQL License: MIT

当前仓库提供的是可公开使用的通用代码与 mock 数据。仓库不包含真实员工、生产数据库、企业制度原件或 SMTP/API 密钥;部署时请通过环境变量和私有存储注入组织自己的数据。

项目介绍

平台面向企业 HR、行政、IT 和新员工,支持从员工账号建立、入职资料发布、制度阅读到考试与通知的完整闭环。管理员可以管理组织内容和员工,员工只能访问当前账号有权限且已发布的内容。

核心能力

Features

“AI knowledge assistant”目前是清晰的扩展方向:当前运行时没有接入 OpenAI 或其他 LLM,也没有虚构一个已上线的 Agent。现有代码提供制度/文档内容、权限边界、预览和业务流程基础,后续可在此基础上接入检索增强问答。详见 docs/ai-agent.md。

Tech Stack

Quick Start

corepack enable
corepack prepare [email protected] --activate
pnpm install --frozen-lockfile
cp .env.example .env
# 编辑 .env,至少填写 ADMIN_USERNAME、满足策略的 ADMIN_PASSWORD,
# 以及由密码管理器生成的 32 字符以上 AUTH_TOKEN_SECRET
pnpm db:ensure
pnpm db:generate
pnpm db:migrate
pnpm db:seed
pnpm dev

打开 http://localhost:3000。生产构建使用:

pnpm build
pnpm start

完整环境变量说明、SQLite 初始化、邮件配置和私有存储注意事项见 docs/deployment.md。.env、数据库、上传目录和常见 Office/PDF 文件均已加入 .gitignore,不要将组织数据复制到 Git 工作树。

Architecture

Browser
  ├─ Employee UI ─┐
  └─ Admin UI ────┼─ Next.js App Router pages + API routes
                  ├─ session/RBAC guards
                  ├─ feature services
                  ├─ Prisma 7 / SQLite
                  └─ private storage + optional SMTP / local document tools

src/app 负责页面和 API 路由,src/features 按认证、员工、制度、资料包、考试、邮件、门户和审计等领域组织业务服务,prisma 保存 schema 与迁移,storage/private 保存不应公开的运行时资产,tests 与 e2e 提供自动化验证。数据流和边界见 docs/architecture.md。

Security Design

更多边界和部署建议见 docs/security.md。

Public Release Integrity

公开仓库使用独立的干净 Git 历史,不包含私有源仓库的分支、标签、评审记录或本机运行产物。示例邮箱使用 .invalid 保留域名;固定测试口令只服务于自动化测试,不是部署默认值。发布时同时提供 NOTICE、第三方归属清单、REUSE SPDX 声明 和 SPDX SBOM。

Roadmap

Documentation

Contributing

欢迎提交 Issue、改进文档、修复 bug 或贡献功能。请先阅读 贡献指南 和 行为准则,并在提交 Pull Request 前运行 lint、typecheck、build 和相关测试。安全问题请按 SECURITY.md 私下报告。

License

项目原创代码与 SVG 品牌资源使用 MIT License。依赖和 vendored 资产保留各自许可证,详见 NOTICE、THIRD_PARTY_NOTICES.md 与 LICENSES/。MIT 许可证不授予第三方商标权,也不覆盖部署者自行导入的组织数据或内容。

cohort-harbor (lantingzhang1119/cohort-harbor)

Searching Database…

What is this?CohortHarbor is a self-hosted platform that combines employee accounts, onboarding materials, versioned company policies, online learning, exams, automated welcome emails, and private file protection into a single full-stack app, meant for internal deployment and further customization.
Is this a SaaS I sign up for, or something I run myself?It's self-hosted: you deploy the Next.js app yourself and point it at your own SQLite database and private file storage, rather than using a hosted service.
How do I get it running?Clone the repo, install dependencies with pnpm, run 'prisma generate' (wired into postinstall), then start it with 'pnpm dev' (next dev) for development or 'pnpm build && pnpm start' for production; full environment variable and SQLite setup details are in docs/deployment.md.
What do I need to run it?You need Node.js 24.14.0 and pnpm 11.16.0; the database runs on SQLite via the better-sqlite3 Prisma adapter, so no separate database server or Docker is required.
Does it come with real policy data or a working AI assistant already?No — the public repo only ships generic mock data (sample org, sample employees, generic exam questions) and does not include real employees, a production database, or SMTP/API keys; an 'AI knowledge assistant' is listed as a roadmap item and is not wired to any LLM yet.
What does the MIT license actually cover here?Only the original CohortHarbor code and its SVG brand assets are MIT-licensed; bundled and vendored dependencies keep their own licenses, and the MIT grant doesn't cover trademarks or any organizational data you import when deploying it.
What roles does the permission system support?CohortHarbor ships with three roles — SUPERADMIN, ADMIN, and EMPLOYEE — enforced by server-side guards on admin routes, superadmin-only actions, employee APIs, and file downloads, since hiding UI elements alone isn't treated as a security boundary.
What can employees actually do in the exam system?The platform includes online exams with question banks, exam assignments, retakes for failed attempts, and centralized result management, on top of policy reading and onboarding material delivery.
Why does it add a watermark instead of stricter DRM?Policy, guide, and exam views can show the current session's name as a watermark to trace and discourage leaking content, but the README is explicit that it doesn't replace access control and can't stop screenshots.
What's planned next for CohortHarbor?The roadmap covers permission-aware AI policy Q&A with citations, broader onboarding workflow automation and approvals, and pluggable knowledge-base/vector-index integration for production deployments.
Size
19.7 MB
Stars
198
Updated
CommitAug 12
Age
2mo
Commits · 90 Days