Skip to content
dairongpengPublic

About

Full-stack TypeScript template with Bun, React 19, TailwindCSS, and monorepo. Includes testing, Docker, and docs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Teg

Bun full-stack 用户管理示例项目。一个 Bun 服务器同时提供 React 页面、TailwindCSS 样式和 REST API,当前数据与认证均为内存 mock 实现。

技术栈

  • Bun + TypeScript
  • React 19
  • TailwindCSS 4 + bun-plugin-tailwind
  • Bun workspaces:packages/utils、packages/constants
  • Biome:格式化与 lint
  • Bun test:单元测试

快速开始

bun install
bun run dev

默认服务地址:http://localhost:3000

可访问页面:

  • /:用户管理页面
  • /dashboard:控制面板页面
  • /api/health:健康检查

注意:当前 server/index.ts 会构建 ./src/styles.css,但仓库中暂缺该文件;启动开发服务前需要补齐 Tailwind 入口样式。

常用命令

bun run dev        # 开发服务
bun run start      # 生产模式启动 server/index.ts
bun run lint       # Biome 检查
bun run lint:fix   # Biome 自动修复
bun test           # 运行测试
bun test --watch   # 测试监听模式

当前没有 build 脚本;生产启动依赖 NODE_ENV=production bun run server/index.ts。

项目结构

server/             Bun 后端入口、配置、middleware、API 路由
src/                React 前端应用与 API client
public/             HTML 入口和静态资源
packages/utils/     workspace 工具函数
packages/constants/ workspace 常量
tests/              Bun test 测试
docs/               架构、Tailwind、部署、monorepo 等详细文档

API

用户管理:

  • GET /api/users
  • POST /api/users
  • GET /api/users/:id
  • PUT /api/users/:id
  • DELETE /api/users/:id

认证:

  • POST /api/auth/login
  • POST /api/auth/register
  • POST /api/auth/logout
  • GET /api/auth/status

其他:

  • GET /api/health

默认登录账号:

  • zhangsan@example.com / password123
  • lisi@example.com / password123

开发说明

  • Mock 用户数据位于 server/routers/users.ts,服务重启后会重置。
  • Mock 认证数据位于 server/routers/auth.ts,token 仅为演示用途。
  • 共享常量和工具通过 @pkg/constants、@pkg/utils 引用,路径映射见 tsconfig.json。
  • 更多背景文档见 docs/;后续协作记忆见 AGENTS.md。

License

MIT

About

Full-stack TypeScript template with Bun, React 19, TailwindCSS, and monorepo. Includes testing, Docker, and docs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages