
English | 简体中文
Rin 是一个基于 Cloudflare 开发者平台构建的现代化、无服务器博客系统,完全利用 Cloudflare Pages 托管、Workers 提供无服务器函数、D1 作为 SQLite 数据库、R2 进行对象存储。仅需一个指向 Cloudflare 的域名即可部署你的个人博客,无需服务器运维。
https://xeu.life
https://yourblog.com/about。#博客 #Cloudflare 的标签文本,自动解析并展示为标签。@rin/api 包在客户端和服务器之间共享 TypeScript 类型,实现端到端类型安全。# 1. 克隆仓库
git clone https://github.com/openRin/Rin.git && cd Rin
# 2. 安装依赖
bun install
# 3. 配置环境变量
cp .env.example .env.local
# 编辑 .env.local 填入你的配置信息
# 4. 启动开发服务器
bun run dev
访问 http://localhost:5173 开始开发!
运行测试套件以确保一切正常:
# 运行所有测试(客户端 + 服务器)
bun run test
# 仅运行服务器测试
bun run test:server
# 运行测试并设置覆盖率
bun run test:coverage
使用一条命令即可将前端和后端同时部署到 Cloudflare:
# 部署所有内容(前端+后端)
bun run deploy
# 仅部署后端
bun run deploy:server
# 仅部署前端
bun run deploy:client
必需的环境变量:
CLOUDFLARE_API_TOKEN - 您的 Cloudflare API 令牌CLOUDFLARE_ACCOUNT_ID - 您的 Cloudflare 帐户 ID可选的环境变量:
WORKER_NAME - 后端工作进程名称(默认值:rin-server)PAGES_NAME - 前端页面名称(默认值:rin-client)DB_NAME - D1 数据库名称(默认值:rin)R2_BUCKET_NAME - R2 存储桶名称。设置后,部署会自动推导对应的 S3_* 配置;未设置时,不会自动选择任何 bucket。部署脚本将自动执行以下操作:
R2_BUCKET_NAME 时,自动推导对应的 S3_* 存储配置存储库包含多个自动化工作流程:
ci.yml - 每次推送/PR 都会运行类型检查和格式验证test.yml - 运行全面的测试(服务器+客户端),并生成覆盖率报告build.yml - 构建项目并触发部署deploy.yml - 部署到 Cloudflare Pages 和 Workers必备变量 (Repository Settings → Secrets and variables → Actions):
CLOUDFLARE_API_TOKEN - 您的 Cloudflare API 令牌,包含 Workers 和 Pages 权限CLOUDFLARE_ACCOUNT_ID - 您的 Cloudflare 帐户 ID可选配置(Repository Settings → Secrets and variables → Variables):
WORKER_NAME, PAGES_NAME, DB_NAME - 资源名称NAME, DESCRIPTION, AVATAR - 站点配置R2_BUCKET_NAME - 要使用的特定 R2 存储桶完整文档请访问 https://docs.openrin.org。
我们欢迎各种形式的贡献——代码、文档、设计和想法。请查阅我们的贡献指南,一起参与 Rin 的构建!
MIT License
Copyright (c) 2024 Xeu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.