How mathanponsingh/vhero-backend works
VHERO is a FastAPI backend whose main workflow lets a client request an email OTP and then verify it. The router validates request shapes, generates and hashes codes, persists expiry and attempt state, and schedules email delivery; verification checks the stored hash and marks successful codes verified. Rate limits and database access support these endpoints. The README describes the API, while the sampled code shows the concrete OTP workflow. The map omits unsampled details and treats PostgreSQL and SMTP as external services.
Main entry points: router.py OTP endpoints · db.py Database access · app.py FastAPI app · service/app.py Email delivery
Components 13
API runtime
- FastAPI app
app.py - OTP endpoints
controller/router.py - Request schemas
schemas/user.py
OTP authentication
- OTP generation
controller/router.py - OTP hashing
controller/router.py - Request OTP
controller/router.py - Verify OTP
controller/router.py
Supporting services
- Email delivery
service/app.py - Database access
service/db.py - Rate limiter
service/limiter.py
Other components
- API client
- PostgreSQL
- SMTP server
Connections 16
- API client → FastAPI app: sends requests
README.md - FastAPI app → OTP endpoints: mounts routes
app.py - OTP endpoints → Request schemas: validates input
controller/router.py - OTP endpoints → Request OTP: dispatches
controller/router.py - OTP endpoints → Verify OTP: dispatches
controller/router.py - Request OTP → OTP generation: generates code
controller/router.py - Request OTP → OTP hashing: hashes code
controller/router.py - Verify OTP → OTP hashing: hashes submitted code
controller/router.py - Request OTP → Database access: stores code state
controller/router.py - Verify OTP → Database access: checks and updates
controller/router.py - OTP endpoints → Database access: injects connection
controller/router.py - Database access → PostgreSQL: connects to
service/db.py - Request OTP → Email delivery: schedules email
controller/router.py - Email delivery → SMTP server: sends message
service/app.py - OTP endpoints → Rate limiter: limits endpoints
controller/router.py - FastAPI app → Rate limiter: configures limiter
app.py