feat: complete auth and gateway agnostic billing implementation

This commit is contained in:
2026-08-13 11:32:35 +05:30
parent f25e338430
commit 63bf71a50c
9 changed files with 652 additions and 188 deletions

35
PRD.md
View File

@@ -74,6 +74,41 @@ The stack is orchestrated using `docker-compose.yml` and consists of 8 distinct
- **Syllabus Tracker:** Granular chapter-by-chapter completion tracking.
- **Performance Analytics:** Visual charts tracking accuracy, speed, and subject-wise competence.
### 4.4 Comprehensive API Endpoints
The backend exposes the following RESTful APIs powered by FastAPI:
**Authentication**
- `POST /api/auth/register` - Create new student account
- `POST /api/auth/login` - Authenticate & receive JWT session
- `POST /api/auth/forgot-password` - Request password reset link
- `POST /api/auth/otp-request` / `otp-verify` - Phone number authentication
**Users & Profiles**
- `GET/PUT /api/users/{id}` - Fetch/update user profiles and settings
- `POST /api/users/{id}/avatar` - Upload profile picture to MinIO
- `GET /api/users/{id}/attempts` - Retrieve past test history
**CBT Engine**
- `GET /api/tests` - List active Mock Tests, PYQs, and Weekly Tests
- `GET /api/tests/{id}/questions` - Fetch test sections and questions
- `POST /api/attempts/submit` - Auto-grade and record a CBT session
**AI Coach**
- `GET /api/ai-coach/readiness/{id}` - Predict JEE/NEET rank and college
- `GET /api/ai-coach/study-plan/today` - Generate daily tasks
- `GET /api/mistakes/today` - Fetch spaced repetition flashcards (SM-2 algorithm)
- `POST /api/mistakes/review` - Update mistake mastery based on recall
- `POST /api/ai-coach/chat/stream` - AI Tutor socket connection
**Subscription & Billing (Gateway Agnostic)**
- `POST /api/billing/create-order` - Generate payment gateway order IDs
- `POST /api/billing/verify-payment` - Cryptographically verify webhooks and upgrade tier
**Admin & Parent Systems**
- `GET/POST/PUT/DELETE /api/admin/*` - Full CRUD for Tests, Users, Coupons, and System Settings
- `POST /api/parent/register` - Parent account creation
- `POST /api/parent/link-student` - Link student to parent dashboard
## 5. Technology Stack Summary
- **Frontend:** Next.js 14/15, TailwindCSS, Framer Motion, Lucide Icons, Shadcn UI.
- **Backend:** Python 3.11, FastAPI, Uvicorn.