app-template/README.md

53 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 弹弹 Web — 本地片源 · 在线弹幕
多用户 Web 媒体中心: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/
```
## 快速开始
```bash
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`。
新增业务实体请复制 `user` 垂直切片:`types` schema → `models` 表 → `dao` 查询 → `trpc` service/router → `web` 页面。细节见根目录 `AGENTS.md`。