Services (the brain)
Path: hono-backend/src/services/
If routes are waiters, services are chefs. All important rules live here.
Baby rules
- Services never read HTTP headers directly — pass
userIdand DTOs from routes. - Services may call other services and models.
- Throw meaningful errors; routes map them to status codes.
- Unit tests target services (
src/__tests__/).
File groups
Auth & external APIs
| File | Job |
|---|---|
google.service.ts | Verify Google tokens |
token.service.ts | JWT + refresh rotation |
youtube.service.ts | YouTube Data API |
Practice PYQ
| File | Job |
|---|---|
practice-pyq-learner.service.ts | Student sessions |
practice-pyq-questions.service.ts | Question fetching |
practice-pyq-taxonomy.service.ts | Catalog tree |
practice-pyq-srs-scheduler.ts | SRS intervals |
practice-pyq-ce-asrs-scheduler.ts | Alternate scheduler variant |
practice-pyq-week-review.service.ts | Weekly review bundles |
practice-pyq-grade.ts | Grading logic |
practice-review-summary.service.ts | Summaries after practice |
Current affairs
| File | Job |
|---|---|
current-affairs.service.ts | Core CA operations |
current-affairs-ancillary.service.ts | Supporting CA workflows |
current-affairs-bookmark.service.ts | Bookmarks |
current-affairs-revision.service.ts | Revision queues |
current-affairs-bookmark-news-revision.service.ts | News revision |
current-affairs-bookmark-news-revision.scheduler.ts | Schedule news revisions |
Other
| File | Job |
|---|---|
continue-learning.service.ts | Resume pointers |
marketing-deal-coupon.service.ts | Coupon validation |
Subfolders
- Notifications —
services/notifications/* - Study stats —
services/user-study-stats/* - Current affairs search —
services/current-affairs-search/*text-search-backend.ts— regex vs Atlas Search selector + window-days helpervector-search-backend.ts— in-app vs Atlas Vector Search selector + embedding model/version- Documented inside Current affairs
- Rate limit —
services/rate-limit/*— policy engine, fixed/sliding/token-bucket algorithms, memory / mongo stores, in-process config cache. Used byrate-limit.middleware.ts. Full design in API rate limiting.
Deep pages
Last updated on