Skip to Content
Services (brain)Overview

Services (the brain)

Path: hono-backend/src/services/

If routes are waiters, services are chefs. All important rules live here.

Baby rules

  1. Services never read HTTP headers directly — pass userId and DTOs from routes.
  2. Services may call other services and models.
  3. Throw meaningful errors; routes map them to status codes.
  4. Unit tests target services (src/__tests__/).

File groups

Auth & external APIs

FileJob
google.service.tsVerify Google tokens
token.service.tsJWT + refresh rotation
youtube.service.tsYouTube Data API

Practice PYQ

FileJob
practice-pyq-learner.service.tsStudent sessions
practice-pyq-questions.service.tsQuestion fetching
practice-pyq-taxonomy.service.tsCatalog tree
practice-pyq-srs-scheduler.tsSRS intervals
practice-pyq-ce-asrs-scheduler.tsAlternate scheduler variant
practice-pyq-week-review.service.tsWeekly review bundles
practice-pyq-grade.tsGrading logic
practice-review-summary.service.tsSummaries after practice

Current affairs

FileJob
current-affairs.service.tsCore CA operations
current-affairs-ancillary.service.tsSupporting CA workflows
current-affairs-bookmark.service.tsBookmarks
current-affairs-revision.service.tsRevision queues
current-affairs-bookmark-news-revision.service.tsNews revision
current-affairs-bookmark-news-revision.scheduler.tsSchedule news revisions

Other

FileJob
continue-learning.service.tsResume pointers
marketing-deal-coupon.service.tsCoupon validation

Subfolders

  • Notificationsservices/notifications/*
  • Study statsservices/user-study-stats/*
  • Current affairs searchservices/current-affairs-search/*
    • text-search-backend.ts — regex vs Atlas Search selector + window-days helper
    • vector-search-backend.ts — in-app vs Atlas Vector Search selector + embedding model/version
    • Documented inside Current affairs
  • Rate limitservices/rate-limit/* — policy engine, fixed/sliding/token-bucket algorithms, memory / mongo stores, in-process config cache. Used by rate-limit.middleware.ts. Full design in API rate limiting.

Deep pages

Last updated on