Astro + tRPC + Drizzle app scaffold template
Go to file
noelorin 96b3d8679b fix(mount): shorter generic WebDAV error copy 2026-09-27 17:12:00 +08:00
app fix(mount): reuse stored password when editing 2026-09-27 16:30:48 +08:00
assets/brand chore(product): checkpoint working tree before dandanplay alignment 2026-09-26 18:36:16 +08:00
docs/superpowers docs(specs): record merged dandanplay implementation final state 2026-09-27 12:26:50 +08:00
e2e feat(settings,auth): admin open-network config with role visibility 2026-09-27 11:52:17 +08:00
packages fix(mount): shorter generic WebDAV error copy 2026-09-27 17:12:00 +08:00
.dockerignore chore(docker): runtime env defaults, healthcheck, ignore review artifacts 2026-09-26 02:58:47 +08:00
.env.example feat(settings): settings-page-first open-network config, drop env-directed copy 2026-09-27 13:22:52 +08:00
.gitignore chore(product): checkpoint working tree before dandanplay alignment 2026-09-26 18:36:16 +08:00
.node-version chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
.prettierrc chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
.yarnrc.yml chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
AGENTS.md test(danmaku): assert openCommentXml withRelated contract 2026-09-27 00:04:58 +08:00
DESIGN.md chore(product): checkpoint working tree before dandanplay alignment 2026-09-26 18:36:16 +08:00
Dockerfile build(docker): include packages/danmaku in deps layer 2026-09-27 11:27:08 +08:00
README.md feat: close product loop for online danmaku 2026-09-27 15:41:20 +08:00
biome.json chore(product): checkpoint working tree before dandanplay alignment 2026-09-26 18:36:16 +08:00
commitlint.config.mjs chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
lefthook.yml chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
package.json fix(danmaku): browser-safe entry, yarn test wiring, AGENTS map 2026-09-26 23:46:21 +08:00
playwright.config.ts feat(settings,auth): admin open-network config with role visibility 2026-09-27 11:52:17 +08:00
tsconfig.base.json chore: initial app template scaffold 2026-09-24 15:21:45 +08:00
turbo.json fix(danmaku): browser-safe entry, yarn test wiring, AGENTS map 2026-09-26 23:46:21 +08:00
yarn.lock feat(web): watch rematch candidates, import persist, danmaku filters 2026-09-26 21:03:01 +08:00
全流程链路测试报告.md chore(product): checkpoint working tree before dandanplay alignment 2026-09-26 18:36:16 +08:00

README.md

帆幕 — 私有影音库 · 弹幕观影 · 网盘挂载

帆幕(Fanmu) 是自建私有影音库:WebDAV/OpenList 挂载片源、媒体库扫描与 Bangumi 刮削、ArtPlayer 播放与弹幕(开放网络 + 本地 XML),多用户进度与权限。

基于 monorepo 分层(types → models → db → dao → trpc → web),本仓库按产品仓维护。

.
├── app/
│   └── web/           @app/web      — Astro SSR + React islands + i18n 路由
├── packages/
│   ├── types/         @app/types    — Zod 入参 schema + 共享 DTO
│   ├── models/        @app/models   — Drizzle 表定义(唯一 schema 源)
│   ├── db/            @app/db       — libSQL/Turso 连接单例 + drizzle-kit
│   ├── dao/           @app/dao      — 数据访问层
│   ├── trpc/          @app/trpc     — tRPC 路由 + service
│   ├── ui/            @app/ui       — shadcn 风格基础组件 + Storybook
│   ├── design-tokens/ @app/design-tokens
│   ├── seo-geo/       @app/seo-geo  — SEO/GEO 纯函数
│   ├── i18n/          @app/i18n     — zh-CN / en 文案与 locale 工具
│   └── adsense/       @app/adsense  — AdSense 加载(可选)
└── docs/

快速开始

yarn install

cp .env.example .env
# 填入 TURSO_DATABASE_URL / TURSO_AUTH_TOKEN / PUBLIC_SITE_URL

yarn db:push          # 推 schema
yarn dev:web          # Astro :4321

技术栈

层 技术
前端 Astro 7 + React 19 islands
API tRPC v11
ORM Drizzle + @libsql/client(Turso)
样式 Tailwind CSS 4 + design-tokens
校验 Zod 4
工程 TypeScript 7 · Biome · Yarn 4 · Turbo

分层(必须遵守)

web → trpc → dao → db → models,横切 types。禁止循环依赖;跨包只走 package.json 的 exports。

新增业务实体请按既有分层接线:types schema → models 表 → dao 查询 → trpc service/router → web 页面。细节见根目录 AGENTS.md。

首次运行配置(产品闭环)

  1. 注册第一个账号(自动成为管理员)
  2. 设置 → 开放弹幕网络:填写弹弹play DevCenter 申请的 AppId / AppSecret(dev.dandanplay.com)
  3. 设置 → 弹弹play 账号:登录弹弹play 账号(站点共用会话,用于拉在线弹幕)
  4. 挂载 WebDAV → 扫描/入库 → 播放页自动匹配或手选作品/集数

未完成 2/3 时播放页会提示「去设置」;本地 XML 导入不受影响。

Docker

docker build -t fanmu:local .
docker run -d -p 4330:4321 \
  -e MEDIA_SECRET_KEY=<64-hex> \
  -v $PWD/packages/db/local.db:/app/data/local.db \
  fanmu:local
# 然后走上面「首次运行配置」