- NestJS backend: Prisma + PostgreSQL, JWT auth, CRUD for goods/categories/countries/tags/positions, SDS sync with cron, public API, Swagger docs - Vue3 Admin: Element Plus, goods/categories/countries/tags/positions/sync management pages, batch operations, login with JWT - Nuxt4 Website: product-center page with sidebar navigation, country filter, search, product grid, pagination, skeleton loading - Nitro proxy routes for backend API - 54 backend tests passing - Updated docs and README
3.3 KiB
3.3 KiB
InkReach Product Center
InkReach 官方产品中心项目,包含三个协同工作的子项目:
| 子项目 | 技术栈 | 端口 | 角色 |
|---|---|---|---|
inkreach-official-nestjs |
NestJS 10 + Prisma 5 + PostgreSQL | 3001 | 后端 API(鉴权 / CRUD / SDS 同步 / 公开 API / Swagger) |
inkreach-official-admin |
Vue 3 + Vite + Element Plus + Pinia | 5173 | 后台管理(登录 / 商品 / 品类 / 国家 / 标签 / 坑位 / 同步) |
inkreach-official-website |
Nuxt 4 + Vue 3 + Tailwind v4 | 3000 | 官方展示站 + 产品中心页 |
快速开始
1. 启动顺序
后端必须先于前两个子项目启动,否则前端代理会失败。
# Terminal 1:后端(需要 PostgreSQL)
cd inkreach-official-nestjs
npm install
npm run prisma:generate
npm run prisma:migrate
npm run start:dev
# → http://localhost:3001 · Swagger: http://localhost:3001/api/docs
# Terminal 2:官网
cd inkreach-official-website
npm install
npm run dev
# → http://localhost:3000
# Terminal 3:后台
cd inkreach-official-admin
npm install
npm run dev
# → http://localhost:5173
2. 环境变量
在仓库根目录的 .env 中配置数据库:
DATABASE_URL=postgresql://postgres:<password>@localhost:5432/inkreach-official
后端额外需要的变量(在 inkreach-official-nestjs/.env 中):
JWT_SECRET=<your-secret>
SDS_API_BASE=https://api.sds.example.com
SDS_API_KEY=<your-key>
PORT=3001
官网默认通过 NUXT_PUBLIC_BACKEND_URL=http://localhost:3001 指向后端,可写入 inkreach-official-website/.env 覆盖。
后台无需额外环境变量;Vite 代理已把 /api/* 转给 http://localhost:3001。
端口分配
| 端口 | 项目 | 入口 |
|---|---|---|
| 3001 | NestJS 后端 | inkreach-official-nestjs/src/main.ts |
| 5173 | Vue Admin | inkreach-official-admin/vite.config.ts |
| 3000 | Nuxt 官网 | inkreach-official-website/nuxt.config.ts |
数据流概览
[SDS 外部 API]
│ (同步)
▼
[NestJS 后端 :3001] ── public/goods ──► [Nitro 代理 /api/backend/*] ──► [Nuxt 官网 :3000]
│ ▲
├── /auth /goods /categories ... ──► │ Vite proxy /api/*
│ │
[PostgreSQL] [Vue Admin :5173]
常用命令
# 后端
cd inkreach-official-nestjs
npm run start:dev # 开发
npm run build # 编译
npm run test # 单元测试
npm run prisma:studio # 打开 Prisma Studio
# 官网
cd inkreach-official-website
npm run dev # 开发
npm run build # 构建
npm run generate # 静态站点生成
# 后台
cd inkreach-official-admin
npm run dev # 开发
npm run build # 构建(含 vue-tsc 类型检查)
文档
- 整体目录结构:
docs/references/structs.md - 数据库表设计:
docs/dev/database-table-design.md - 产品中心 PRD:
docs/dev/product-center-prd.md - 官网子项目结构:
inkreach-official-website/docs/references/structs.md - 开发规范:
AGENTS.md