Files
Blizzard 0250355dcd feat: RSS 订阅源 + 仓库 README
- GET /rss.xml 输出 RSS 2.0(已发布文章,SUNDYNIX_SITE_URL 可配)
- vite 代理补 /rss.xml,页脚 RSS 链接生效
- README:结构、开发流程、环境变量、后端规范、API 速览

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 11:06:21 +08:00

59 lines
2.3 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.
# sundynix-site
[sundynix-agentix](https://git.sundynix.cn/Blizzard/sundynix-agentix)(事件驱动的 AI Agent 工作台)的产品官网 + 内容管理端。
## 结构
```
├── web/ 用户端官网 Vite + React + TS + Tailwind(挂 /
├── admin/ 内容管理端 同栈,JWT 登录(挂 /admin
├── server/ Go 后端 Gin + GORMMySQL / SQLite
│ └── internal/webfs/ 两个前端的构建产物 embed 到这里
└── Makefile 构建入口
```
生产形态:`make build` 把 web、admin 的 dist 打进 Go 二进制,单文件部署整站(`bin/sundynix-site`)。
## 本地开发
```bash
cp .env.example .env # 填 SUNDYNIX_DB(留空用本地 SQLite
make dev-server # 后端 :8090
make dev-web # 用户端 http://localhost:5173/api 已代理)
make dev-admin # 管理端 http://localhost:5174/admin/
```
管理端默认账号 `admin / admin123`(务必用环境变量覆盖)。
## 环境变量
| 变量 | 说明 | 默认 |
|------|------|------|
| `SUNDYNIX_DB` | 数据库 DSN;含 `@tcp(` 走 MySQL,否则视为 SQLite 文件路径 | `sundynix-site.db` |
| `SUNDYNIX_ADDR` | 监听地址 | `:8090` |
| `SUNDYNIX_ADMIN_USER` / `SUNDYNIX_ADMIN_PASS` | 管理端账号 | `admin` / `admin123` |
| `SUNDYNIX_JWT_SECRET` | JWT 密钥 | 开发默认值(生产必配) |
| `SUNDYNIX_NODE_ID` | 雪花算法节点号 | `1` |
| `SUNDYNIX_SITE_URL` | RSS 等对外链接的站点地址 | `https://sundynix.com` |
支持根目录 `.env`(已 gitignore)。
## 后端规范
- 表名前缀 `sundynix_`,单数表名(GORM NamingStrategy
- 主键为**字符串雪花 ID**`internal/pkg/idgen`,模型嵌入 `BaseModel` 自动生成)
- 列名 snake_case,禁止驼峰
- 统一响应信封 `{code, message, data}``internal/pkg/resp`),code=0 成功
- 公共分页参数 `page / page_size / keyword``internal/pkg/req.PageQuery`
## API 速览
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | `/api/posts` · `/api/posts/:slug` | 公开文章列表 / 详情 |
| GET | `/rss.xml` | RSS 2.0 订阅源 |
| POST | `/api/admin/login` | 登录,签发 JWT |
| GET/POST | `/api/admin/posts` | 文章分页列表(含草稿)/ 新建 |
| GET/PUT/DELETE | `/api/admin/posts/:id` | 详情 / 更新(含发布切换)/ 删除 |