catalog/repos/ahmed-lotfy-dev--bun-monorepo-vite-elysia-spa.md

54 lines
1.5 KiB
Markdown
Raw Permalink 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.

# Bun全栈单仓脚手架
`Bun` `Monorepo` `Vite` `Elysia` `React` `TypeScript` `全栈` `SPA`
# Bun Monorepo Vite Elysia SPA
使用官方最新生成器创建或重新生成 Bun 工作区单仓monorepo
- 后端:`bun create elysia@latest`
- 前端SPA`bun create vite@latest --template react-ts`
本 skill 针对内部工具和管理后台场景优化,不要求强公开 SEO。
然后应用后端生产默认配置(后端默认端口:`8000`),后端模式参考 `ahmed-lotfy-dev/elysia-core-backend`
- Better Auth 认证
- Drizzle ORM + Postgres
- 通过 `elysia-mcp` 提供 MCP 端点
- OpenAPI 文档
- CORS 白名单
- 非认证 Cookie 变更的 CSRF 防护
- 安全响应头
## 适用场景
在以下情况使用本 skill
- 初始化一个新的全栈 Bun 工作区单仓
- 将现有后端/前端重置为生成器最新基线
- 避免旧有手动脚手架带来的过时包版本
- 强制使用 Vite + React + TypeScript 的 SPA 前端
## 常用命令
```bash
# 后端
bun create elysia@latest apps/backend
# 前端 SPA
bun create vite@latest apps/frontend --template react-ts
# 安装工作区依赖
bun install
# 运行所有应用的 dev 脚本
bun run --filter "*" dev
# 运行单个应用
bun run --filter frontend dev
bun run --filter backend dev
```
## Skill 文件说明
- `SKILL.md`:触发条件与工作流说明
- `references/workflow.md`:详细命令与参考指南
- `agents/openai.yaml`skill 列表的 UI 元数据