Current Focus
AI Coding Learning Platform
一个围绕 Java 后端成长路径设计的 AI 学习训练平台,把学习任务、技术笔记、Bug 复盘、AI 面试官和学习统计整合成可持续迭代的系统。
Architecture Overview
Layer 01
Client 提交学习任务、笔记、复盘和 AI 面试请求。
Layer 02
API 层负责参数校验、JWT 鉴权、异常归一和响应封装。
Layer 03
Service 层编排业务逻辑、AI 调用、日志记录和缓存失效。
Layer 04
MySQL 保留长期业务数据,Redis 承接可重建的统计缓存。
API Example
创建一次 AI 面试会话,后端根据学习方向生成问题,并记录模型调用日志。
{
"topic": "Spring Boot JWT authentication",
"level": "junior",
"questionCount": 5
}{
"interviewId": 128,
"questions": [
{
"id": 1,
"content": "How does a JWT interceptor extract user context?"
}
],
"traceId": "ai-call-128"
}Data Model
User
- id
- passwordHash
- nickname
- createdAt
Relations
owns learning tasks, owns notes, owns bug reviews
LearningTask
- id
- userId
- title
- status
- priority
- dueDate
Relations
belongs to user, can be linked to notes
AiCallLog
- id
- userId
- model
- status
- durationMs
- errorMessage
Relations
belongs to user, can be linked to interview session
Deployment Notes
- Use Docker Compose for local MySQL and Redis so the backend can start consistently.
- Store model API keys in environment variables and never commit local secret files.
- Expose health checks for API, MySQL connectivity, Redis connectivity, and AI provider availability.
- Keep AI call logs queryable before adding heavier observability tooling.
Engineering Decisions
Treat AI calls as business events
Each model call is logged with status, duration, model, and error metadata because latency and failure affect product behavior.
Keep MySQL as the source of truth
Redis only stores derived learning statistics and short-lived state that can be rebuilt from database records.
Design auth before adding AI features
AI interview history, cost tracking, and learning statistics all depend on a stable user identity model.
项目背景
很多学习项目停留在 CRUD 练习,缺少鉴权、缓存、日志、部署和外部 AI 服务可靠性等真实工程问题。这个项目把 AI 能力作为后端业务链路的一部分处理,而不是只在前端展示一个模型回复。
解决的问题
- 学习任务、技术笔记和 Bug 复盘分散,难以形成可追踪的成长路径。
- AI 接口存在延迟、失败、成本和输出不稳定问题,需要后端记录和兜底。
- 普通练习项目很少覆盖鉴权、缓存、异常处理、接口文档和 Docker 部署。
核心功能
- 用户注册、登录、JWT 鉴权和用户上下文解析。
- 学习任务、技术笔记和 Bug 复盘模块。
- AI 面试官根据学习方向生成问题、评分和改进建议。
- AI 调用日志记录模型、耗时、状态、失败原因和重试结果。
- 学习统计数据通过 Redis 缓存,减少高频数据库查询。
技术架构
- Spring Boot 按 Controller、Service、Repository 分层组织业务。
- MySQL 存储用户、任务、笔记、复盘、面试会话和 AI 调用日志。
- Redis 用于缓存学习统计、短期状态和高频读取结果。
- 统一异常处理和参数校验保证 API 响应稳定。
- Docker 管理后端服务、数据库和缓存的基础部署。
技术难点
- JWT 过期、鉴权失败和业务异常需要统一返回结构。
- AI 接口延迟高且失败场景多,不能按普通 HTTP 接口处理。
- 学习统计既要响应快,又要避免缓存与数据库长期不一致。
我的解决方案
- 用统一异常处理封装认证失败、参数错误和业务异常。
- 为 AI 调用增加日志表、耗时统计、错误分类和有限重试策略。
- 把高频统计结果缓存到 Redis,并在任务变化时主动失效。
Evidence to Add
下一步计划
- 补充用户学习画像和任务推荐逻辑。
- 增加 RAG 知识库问答模块。
- 完善 Docker 部署文档和线上演示环境。