c1562a27f4
feat: add self-registration with email verification
...
Backend:
- New endpoint: POST /api/auth/register
- New endpoint: GET /api/auth/verify/{token}
- Migration: Add email_verified, verification_token, verification_expires
- Helper: send_email() for reusable SMTP
- Validation: email format, password length (min 8), name
- Auto-login after verification (returns session token)
- Rate limit: 3 registrations per hour per IP
Features:
- Verification token valid for 24h
- Existing users marked as verified (grandfather clause)
- SMTP configured via .env (SMTP_HOST, SMTP_USER, SMTP_PASS)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:53:11 +01:00
b4a1856f79
refactor: modular backend architecture with 14 router modules
...
Deploy Development / deploy (push) Successful in 58s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
Phase 2 Complete - Backend Refactoring:
- Extracted all endpoints to dedicated router modules
- main.py: 1878 → 75 lines (-96% reduction)
- Created modular structure for maintainability
Router Structure (60 endpoints total):
├── auth.py - 7 endpoints (login, logout, password reset)
├── profiles.py - 7 endpoints (CRUD + current user)
├── weight.py - 5 endpoints (tracking + stats)
├── circumference.py - 4 endpoints (body measurements)
├── caliper.py - 4 endpoints (skinfold tracking)
├── activity.py - 6 endpoints (workouts + Apple Health import)
├── nutrition.py - 4 endpoints (diet + FDDB import)
├── photos.py - 3 endpoints (progress photos)
├── insights.py - 8 endpoints (AI analysis + pipeline)
├── prompts.py - 2 endpoints (AI prompt management)
├── admin.py - 7 endpoints (user management)
├── stats.py - 1 endpoint (dashboard stats)
├── exportdata.py - 3 endpoints (CSV/JSON/ZIP export)
└── importdata.py - 1 endpoint (ZIP import)
Core modules maintained:
- db.py: PostgreSQL connection + helpers
- auth.py: Auth functions (hash, verify, sessions)
- models.py: 11 Pydantic models
Benefits:
- Self-contained modules with clear responsibilities
- Easier to navigate and modify specific features
- Improved code organization and readability
- 100% functional compatibility maintained
- All syntax checks passed
Updated CLAUDE.md with new architecture documentation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 11:15:35 +01:00