Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lemonhub

极简黑白论坛 / Minimal black-and-white forum.

Lemonhub 是一个追求极致简约美学的论坛应用:纯黑背景、纯白文字、最高对比度, 帖子卡片悬浮于虚空之中。本项目是一个 monorepo,包含论坛前端、后端服务与站点落地页。

目录结构

lemonhub/
├── forum/            # 论坛前端(Vue 3 + Vite + Pinia)
│   ├── src/          # 前端源码(api / components / views / stores / types)
│   ├── server/       # 后端服务(Cloudflare Workers + Hono + D1)
│   │   ├── src/      # 后端源码(routes / db / middleware / utils)
│   │   ├── schema.sql  # D1 数据库表结构
│   │   └── seed.sql  # 演示数据
│   ├── API.md        # API 接口文档
│   └── README.md     # 前端详细说明
├── site/             # 站点落地页(Vue 3 + Vite)
├── .husky/           # Git 钩子(pre-commit 运行 lint-staged)
├── LICENSE           # AGPL-3.0 许可证
└── README.md         # 本文件

技术栈

部分 技术
论坛前端 Vue 3(Composition API + <script setup>)、TypeScript、Vite、Pinia、Vue Router、Tailwind CSS v4
论坛后端 Cloudflare Workers、Hono、D1(SQLite)、Drizzle ORM、jose(JWT)、Cloudflare Turnstile、R2
站点落地页 Vue 3、TypeScript、Vite、Tailwind CSS v4
测试 Vitest、happy-dom、@testing-library/vue
代码规范 ESLint、Prettier、EditorConfig、Husky + lint-staged

功能特性

  • 帖子列表 / 详情(全屏遮罩展示,非页面跳转)
  • 分类筛选、搜索、发帖、回复、点赞
  • 用户注册 / 登录(JWT + Turnstile 人机验证)
  • 图片上传(Cloudflare R2 CDN)
  • 桌面侧边栏 + 移动端底部导航的响应式布局
  • 流畅的悬浮、过渡、遮罩弹出动画

环境要求

  • Node.js ≥ 18(推荐 20 LTS)
  • npm ≥ 9(或兼容的 pnpm / yarn)
  • 后端开发需要 Wrangler CLInpm i -g wrangler 或随 forum/server 依赖安装)
  • 后端使用 Cloudflare D1 数据库;首次开发需初始化本地数据库

快速开始

1. 论坛前端

cd forum
npm install
npm run dev      # 启动开发服务器(默认 http://localhost:5173)
npm run build    # 类型检查 + 生产构建
npm run preview  # 预览生产构建

前端默认使用 src/api/ 中的接口层对接后端。本地后端运行在 http://localhost:8787(由 wrangler dev 提供),按需在 forum 中配置请求地址。

2. 论坛后端(Cloudflare Workers)

cd forum/server
npm install

# 初始化并填充本地 D1 数据库(首次运行)
npm run db:init   # 执行 schema.sql
npm run db:seed   # 写入演示数据

npm run dev       # 本地开发(wrangler dev,默认 http://localhost:8787)
npm run deploy    # 部署到 Cloudflare(需先 wrangler login)

首次运行需准备配置文件:仓库已提供模板 wrangler.toml.example.env.example,复制为 wrangler.toml / .env 并填入你自己的值(D1 database_id、R2 端点等)。真实配置已被 .gitignore 忽略, 绝不会进入版本库;生产环境密钥请用 wrangler secret put <NAME> 注入,本地开发可写入 .dev.vars(同样被忽略)。

3. 站点落地页

cd site
npm install
npm run dev
npm run build

常用脚本

forum/ 目录下:

命令 说明
npm run dev 启动 Vite 开发服务器
npm run build vue-tsc 类型检查 + 生产构建
npm run test 运行 Vitest 单元测试(单次)
npm run test:watch 监听模式测试
npm run test:coverage 生成测试覆盖率报告
npm run lint ESLint 检查
npm run lint:fix ESLint 自动修复
npm run format Prettier 格式化
npm run format:check Prettier 格式检查
npm run check lint + format:check + test 一键校验

forum/server/ 目录下:

命令 说明
npm run dev wrangler dev 本地运行 Worker
npm run deploy 部署到 Cloudflare
npm run db:init 初始化本地 D1 数据库
npm run db:seed 写入演示数据

测试

论坛前端使用 Vitest(happy-dom 环境)与 @testing-library/vue 编写组件 / store 单元测试,测试文件与源码同目录(__tests__/*.test.ts)。

cd forum
npm test                 # 运行全部测试
npm run test:coverage    # 生成覆盖率(v8)

覆盖率阈值:分支 50%、函数 60%、行 / 语句 65%。

API 文档

完整的接口定义、数据模型与错误码见 forum/API.md

贡献

欢迎贡献!请先阅读 CONTRIBUTING.md 了解开发流程、提交规范与代码风格。

提交代码请遵循:

  1. Fork 仓库并创建功能分支;
  2. 本地通过 npm run check(前端)确保 lint / 格式 / 测试全绿;
  3. 提交清晰的提交信息;
  4. 发起 Pull Request 并描述改动与动机。

许可证

本项目基于 GNU Affero General Public License v3.0(AGPL-3.0-only)授权。

Copyright © 2026 LemonStudio.

AGPL 是一种强 copyleft 许可证:任何对本项目的使用、修改与分发(包括以网络服务形式 提供修改版本)都必须公开对应的源代码并同样采用 AGPL-3.0 许可。详见 LICENSE 全文与 https://www.gnu.org/licenses/agpl-3.0.html

About

极简黑白论坛 / Minimal black-and-white forum — Vue 3 + Cloudflare Workers + D1, AGPL-3.0

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages