🎉 init: 小龙的工作空间

This commit is contained in:
大海
2026-06-06 10:40:48 +08:00
commit a188ee1426
3201 changed files with 231817 additions and 0 deletions
+443
View File
@@ -0,0 +1,443 @@
{
"projectName": "PetCare",
"domain": "pet",
"techStack": {
"frontend": "React Native 0.76 + Expo / Flutter 3.x",
"backend": "NestJS + Prisma",
"database": "PostgreSQL 15 + Redis 7 + MinIO(文件存储)",
"deployment": "Docker Compose + Nginx / K8s(规模化)",
"considerations": []
},
"architectureDiagram": "┌─────────────────────────────────────────────────────────┐\n│ PetCare — System Architecture │\n├─────────────────────────────────────────────────────────┤\n│ │\n│ ┌──────────────────────┐ ┌──────────────────────┐ │\n│ │ Client Layer │ │ Admin / Web │ │\n│ │ React Native 0.76 + Expo / Flutter 3.x │ │ React + Vite (Web) │ │\n│ └──────────┬───────────┘ └──────────┬───────────┘ │\n│ │ │ │\n│ └──────────┬────────────────┘ │\n│ │ │\n│ ┌─────────▼──────────┐ │\n│ │ API Gateway │ │\n│ │ Nginx / Kong │ │\n│ └─────────┬──────────┘ │\n│ │ │\n│ ┌─────────▼──────────┐ │\n│ │ Backend Services │ │\n│ │ NestJS + Prisma │ │\n│ └─────────┬──────────┘ │\n│ │ │\n│ ┌───────────────┼───────────────┐ │\n│ │ │ │ │\n│ ┌─────▼─────┐ ┌──────▼──────┐ ┌────▼─────┐ │\n│ │ PostgreSQL 15│ │ Redis Cache │ │ MinIO │ │\n│ │ Primary │ │ Session │ │ Files │ │\n│ └───────────┘ └─────────────┘ └──────────┘ │\n│ │\n├─────────────────────────────────────────────────────────┤\n│ Modules: │\n│ 1 宠物档案 │\n│ 2 Schedule │\n│ 3 日常记录 │\n│ 4 Storage │\n│ 5 附近医院 │\n│ 6 健康百科 │\n│ │\n└─────────────────────────────────────────────────────────┘",
"dataFlows": [
{
"page": "健康日程",
"route": "/schedule",
"description": "疫苗、驱虫、体检日历",
"dataFlow": [
"GET /api/schedules → 获取健康日程列表",
"POST /api/schedules → 创建健康日程"
],
"direction": "Client → API Gateway → Backend → Database → Response → Client"
},
{
"page": "日常记录",
"route": "/daily-log",
"description": "饮食/运动/排泄记录表单",
"dataFlow": [
"POST /api/daily-logs → 记录日常活动",
"GET /api/daily-logs → 查询日常记录"
],
"direction": "Client → API Gateway → Backend → Database → Response → Client"
},
{
"page": "成长相册",
"route": "/album",
"description": "时间线照片浏览",
"dataFlow": [
"POST /api/albums → 上传宠物照片"
],
"direction": "Client → API Gateway → Backend → Database → Response → Client"
}
],
"modules": [
{
"name": "宠物档案",
"label": "宠物档案",
"features": [
"宠物档案"
],
"responsibilities": [
"提供 宠物档案 相关功能"
]
},
{
"name": "schedule",
"label": "Schedule",
"features": [
"健康日程"
],
"responsibilities": [
"提供 健康日程 相关功能"
]
},
{
"name": "日常记录",
"label": "日常记录",
"features": [
"日常记录"
],
"responsibilities": [
"提供 日常记录 相关功能"
]
},
{
"name": "storage",
"label": "Storage",
"features": [
"成长相册"
],
"responsibilities": [
"提供 成长相册 相关功能"
]
},
{
"name": "附近医院",
"label": "附近医院",
"features": [
"附近医院"
],
"responsibilities": [
"提供 附近医院 相关功能"
]
},
{
"name": "健康百科",
"label": "健康百科",
"features": [
"健康百科"
],
"responsibilities": [
"提供 健康百科 相关功能"
]
},
{
"name": "content",
"label": "Content",
"features": [
"社区分享"
],
"responsibilities": [
"提供 社区分享 相关功能"
]
},
{
"name": "pet",
"label": "宠物管理",
"features": [
"宠物档案",
"健康日程"
],
"responsibilities": [
"提供 宠物档案 相关功能",
"提供 健康日程 相关功能"
]
}
],
"databaseSchema": [
{
"table": "users",
"description": "用户表",
"fields": [
{
"name": "id",
"type": "UUID",
"constraints": "PK, DEFAULT gen_random_uuid()"
},
{
"name": "phone",
"type": "VARCHAR(20)",
"constraints": "UNIQUE"
},
{
"name": "nickname",
"type": "VARCHAR(64)"
},
{
"name": "avatar_url",
"type": "TEXT"
},
{
"name": "created_at",
"type": "TIMESTAMPTZ",
"constraints": "DEFAULT NOW()"
},
{
"name": "updated_at",
"type": "TIMESTAMPTZ",
"constraints": "DEFAULT NOW()"
}
],
"indexes": [
"idx_users_phone ON users(phone)"
]
},
{
"table": "pets",
"description": "宠物档案表",
"fields": [
{
"name": "id",
"type": "UUID",
"constraints": "PK"
},
{
"name": "owner_id",
"type": "UUID",
"constraints": "FK → users.id"
},
{
"name": "name",
"type": "VARCHAR(64)",
"constraints": "NOT NULL"
},
{
"name": "species",
"type": "VARCHAR(32)"
},
{
"name": "breed",
"type": "VARCHAR(64)"
},
{
"name": "birth_date",
"type": "DATE"
},
{
"name": "weight_kg",
"type": "DECIMAL(5,2)"
},
{
"name": "avatar_url",
"type": "TEXT"
},
{
"name": "created_at",
"type": "TIMESTAMPTZ",
"constraints": "DEFAULT NOW()"
}
]
},
{
"table": "schedules",
"description": "健康日程表",
"fields": [
{
"name": "id",
"type": "UUID",
"constraints": "PK"
},
{
"name": "pet_id",
"type": "UUID",
"constraints": "FK → pets.id"
},
{
"name": "type",
"type": "VARCHAR(32)",
"constraints": "NOT NULL"
},
{
"name": "title",
"type": "VARCHAR(128)",
"constraints": "NOT NULL"
},
{
"name": "scheduled_at",
"type": "TIMESTAMPTZ"
},
{
"name": "completed",
"type": "BOOLEAN",
"constraints": "DEFAULT false"
}
]
},
{
"table": "daily_logs",
"description": "日常记录表",
"fields": [
{
"name": "id",
"type": "UUID",
"constraints": "PK"
},
{
"name": "pet_id",
"type": "UUID",
"constraints": "FK → pets.id"
},
{
"name": "category",
"type": "VARCHAR(32)",
"constraints": "NOT NULL"
},
{
"name": "value",
"type": "TEXT"
},
{
"name": "logged_at",
"type": "TIMESTAMPTZ",
"constraints": "DEFAULT NOW()"
}
]
}
],
"apiDesign": [
{
"resource": "albums",
"basePath": "/api/albums",
"endpoints": [
{
"method": "POST",
"path": "/api/albums",
"description": "上传宠物照片"
}
]
},
{
"resource": "daily-logs",
"basePath": "/api/daily-logs",
"endpoints": [
{
"method": "POST",
"path": "/api/daily-logs",
"description": "记录日常活动"
},
{
"method": "GET",
"path": "/api/daily-logs",
"description": "查询日常记录"
}
]
},
{
"resource": "hospitals",
"basePath": "/api/hospitals",
"endpoints": [
{
"method": "GET",
"path": "/api/hospitals",
"description": "查询附近医院"
}
]
},
{
"resource": "pets",
"basePath": "/api/pets",
"endpoints": [
{
"method": "POST",
"path": "/api/pets",
"description": "添加宠物档案"
},
{
"method": "GET",
"path": "/api/pets/:id",
"description": "获取宠物详情"
},
{
"method": "PUT",
"path": "/api/pets/:id",
"description": "更新宠物信息"
}
]
},
{
"resource": "schedules",
"basePath": "/api/schedules",
"endpoints": [
{
"method": "GET",
"path": "/api/schedules",
"description": "获取健康日程列表"
},
{
"method": "POST",
"path": "/api/schedules",
"description": "创建健康日程"
}
]
}
],
"directoryStructure": [
"petcare/",
"├── apps/",
"│ ├── mobile/ # React Native / Flutter 移动端",
"│ │ ├── src/",
"│ │ │ ├── screens/ # 页面组件",
"│ │ │ │ ├── 宠物档案/",
"│ │ │ │ ├── schedule/",
"│ │ │ │ ├── 日常记录/",
"│ │ │ │ ├── storage/",
"│ │ │ ├── components/ # 通用组件",
"│ │ │ ├── hooks/ # 自定义 Hooks",
"│ │ │ ├── services/ # API 调用层",
"│ │ │ ├── store/ # 状态管理",
"│ │ │ └── utils/ # 工具函数",
"│ │ ├── app.json",
"│ │ └── package.json",
"│ └── web/ # Web 管理后台",
"│ ├── src/",
"│ │ ├── pages/",
"│ │ ├── components/",
"│ │ └── layouts/",
"│ └── package.json",
"├── packages/",
"│ └── shared/ # 共享类型/常量",
"├── server/ # NestJS 后端服务",
"│ ├── src/",
"│ │ ├── modules/ # 业务模块",
"│ │ │ ├── 宠物档案/",
"│ │ │ │ ├── 宠物档案.controller.ts",
"│ │ │ │ ├── 宠物档案.service.ts",
"│ │ │ │ ├── 宠物档案.module.ts",
"│ │ │ │ └── dto/",
"│ │ │ ├── schedule/",
"│ │ │ │ ├── schedule.controller.ts",
"│ │ │ │ ├── schedule.service.ts",
"│ │ │ │ ├── schedule.module.ts",
"│ │ │ │ └── dto/",
"│ │ │ ├── 日常记录/",
"│ │ │ │ ├── 日常记录.controller.ts",
"│ │ │ │ ├── 日常记录.service.ts",
"│ │ │ │ ├── 日常记录.module.ts",
"│ │ │ │ └── dto/",
"│ │ │ ├── storage/",
"│ │ │ │ ├── storage.controller.ts",
"│ │ │ │ ├── storage.service.ts",
"│ │ │ │ ├── storage.module.ts",
"│ │ │ │ └── dto/",
"│ │ │ ├── 附近医院/",
"│ │ │ │ ├── 附近医院.controller.ts",
"│ │ │ │ ├── 附近医院.service.ts",
"│ │ │ │ ├── 附近医院.module.ts",
"│ │ │ │ └── dto/",
"│ │ ├── common/ # 通用(guards, filters, interceptors",
"│ │ ├── prisma/ # Prisma ORM",
"│ │ │ └── schema.prisma",
"│ │ ├── config/ # 环境配置",
"│ │ └── main.ts",
"│ ├── test/",
"│ ├── Dockerfile",
"│ └── package.json",
"├── docker-compose.yml",
"├── .github/workflows/ # CI/CD",
"│ └── ci.yml",
"├── .env.example",
"├── README.md",
"└── turbo.json # Monorepo 配置"
],
"deployment": {
"environments": [
"development",
"staging",
"production"
],
"strategy": "Docker Compose + Nginx / K8s(规模化)",
"services": [
"API Server (NestJS)",
"PostgreSQL 15",
"Redis 7"
],
"ci": "GitHub Actions → Build → Test → Deploy"
},
"meta": {
"generatedAt": "2026-06-04T22:58:48.869Z",
"sourceDomain": "pet",
"moduleCount": 8,
"tableCount": 4,
"apiEndpointCount": 9
}
}