xiaohongshufabu/README.md
2026-07-22 10:55:17 +08:00

113 lines
3.1 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.

# 小红书千帆店铺矩阵工具
一套完整的「内容工厂 + 分发工具」,实现店铺与商品信息的集中管理、商品笔记的批量 AI 生成、多浏览器并行自动化批量发布。
## 架构
```
┌─────────────────────────────┐
│ 本地服务 (localhost:3000) │
│ Node.js + Express + SQLite │
└──────────┬──────────────────┘
│ HTTP API
┌──────┴──────┐
│ │
┌───▼───┐ ┌────▼────────┐
│网页管理端│ │浏览器插件(多开)│
│React │ │Manifest V3 │
└────────┘ └──────────────┘
```
## 快速开始
### 1. 启动本地服务
```bash
cd server
npm install
npm start
```
服务运行在 `http://localhost:3000`
### 2. 启动网页管理端(开发模式)
```bash
cd web
npm install
npm run dev
```
访问 `http://localhost:5173`(自动代理 API 到 :3000
### 3. 生产构建
```bash
cd web
npm run build
```
构建产物在 `web/dist/`,服务端会自动提供静态文件。
### 4. 安装浏览器插件
1. Chrome 打开 `chrome://extensions/`
2. 开启「开发者模式」
3. 「加载已解压的扩展程序」→ 选择 `extension/` 目录
## 使用流程
1. **网页端**:创建店铺 → 添加商品
2. **网页端**:配置 AI设置页 → 填写 API Key
3. **网页端**:商品管理 → 点击「批量生成笔记」
4. **网页端**:笔记管理 → 审核通过笔记
5. **插件端**:配置店铺 ID → 打开千帆发布页 → 启动
## 目录结构
```
├── server/ # 本地服务
│ ├── index.js # 入口
│ ├── lib/db.js # 数据库初始化
│ └── routes/ # API 路由
├── web/ # 网页管理端 (React + Vite)
│ └── src/pages/ # 页面组件
├── extension/ # 浏览器插件 (Manifest V3)
│ ├── background.js # Service Worker
│ ├── content_scripts/ # DOM 自动化
│ ├── popup/ # 插件弹窗
│ └── options/ # 高级设置页
└── README.md
```
## 技术栈
| 层 | 技术 |
|---|---|
| 服务端 | Node.js 18+ / Express 5 / SQLite (better-sqlite3) |
| 前端 | React / Vite / TailwindCSS |
| 插件 | Chrome Extension Manifest V3 |
| AI | Deepseek API用户自行配置 Key |
| 图片 | Sharp压缩/去重) / 用户配置的生图 API |
### 3.1 Windows 正式发布包
适合发给最终用户,不要求对方手动安装 Node.js。
```bash
powershell -ExecutionPolicy Bypass -File scripts/build-release.ps1
```
执行后会生成:
- `release/windows/小红书千帆店铺矩阵工具/`
- `release/小红书千帆店铺矩阵工具-Windows.zip`
说明:
- 脚本会先构建 `web/dist`
- 再用 `pkg``server` 打包为 Windows `exe`
- 最后把 `web/dist`、`extension/`、用户说明一起组装成可交付压缩包