Skip to Content
Every file (A–Z)Master index

Complete file index

Every .ts file under hono-backend/src (except tests).

(root)/

FileWhat it does (short)
index.tsThink of this file as the reception desk of hono-backend.

config/

FileWhat it does (short)
db.tsMongoDB is the database where all persistent data lives (users, questions,
env.tsEnvironment configuration (loaded once at process start)
permissions.tsAdmin permissions (central registry)

constants/

FileWhat it does (short)
practice-catalog-kind.tsPractice catalog kind (per subject)
practice-pyq-exam-category.tsPractice PYQ exam category (learner-facing bucket)

lib/

FileWhat it does (short)
format-zod-issue-path.tsFormat Zod validation paths for API error messages
json-parse-location.tsJSON parse error locations (line / column)

middleware/

FileWhat it does (short)
admin.middleware.tsTwo layers of admin security (used together on /api/v1/admin/*):
auth.middleware.tsThis runs before protected route handlers. It answers one question:
internal-key.middleware.tsSome endpoints must NOT use Google login — they are called by our own

models/

FileWhat it does (short)
content.model.tsSimple CMS-style pages: announcements and exam-info articles shown in
crowd-video-timestamp.model.tsCommunity-submitted time markers on videos (“there’s a question here”)
device-token.model.tsStores Firebase Cloud Messaging (FCM) tokens per user device so push
localized-text.schema.tsA reusable embedded sub-schema for text that can appear in English (en)
marketing-deal.model.tsA commercial deal with a sponsor: amounts, status, and optional **coupon
marketing-sponsor.model.tsCRM record for a sponsor (YouTuber/creator) we run marketing deals with.
mock-test.model.tsTimed mock exams built from existing Question documents, with per-
notification-daily-rollup.model.tsPre-aggregated daily metrics for push notifications (sent, opened, by
notification-log.model.tsAudit log of every push notification we attempt: template, variables,
notification-preference.model.tsPer-user push notification settings in India Standard Time (IST): when
playlist.model.tsCurated playlists of catalog videos — usually admin-built study paths
question.model.tsMultiple-choice questions tied to a moment in a YouTube video
refresh-token.model.tsStores long-lived refresh tokens so clients can get new access tokens without
user-library-channel.model.tsPer-user subscribed/saved YouTube channels with cached channel metadata.
user-library-video.model.tsPer-user saved videos in their library (bookmark list). Denormalized
user-playlist.model.tsUser-created playlists of YouTube videos (by youtubeVideoId strings),
user.model.tsThe Mongoose model for app users — people who sign in with Google and use
video-timestamp.model.tsA marker on a video timeline (e.g. “question at 10:33”) — either added
video.model.tsCanonical catalog of YouTube videos the product knows about — metadata

models/current-affairs/

FileWhat it does (short)
current-affair-flashcard.model.tsMONGODB: currentaffairflashcards | SRS via UserRevisionItem (flashcard)
current-affair-item.model.tsMONGODB: currentaffairitems | dailyIssueId → DailyIssue
current-affair-mcq.model.tsMONGODB: currentaffairmcqs | SRS via UserRevisionItem (contentType mcq)
current-affair-related-pyq.model.tsMONGODB: currentaffairrelatedpyqs
daily-issue.model.tsMONGODB: dailyissues | Unique date (YYYY-MM-DD)
nexus-entity.model.tsMONGODB: nexusentities | Referenced from CurrentAffairItem.entities
user-ca-news-bookmark.model.tsMONGODB: usercanewsbookmarks | Unique (userId, itemId)
user-ca-news-revision.model.tsMONGODB: usercanewsrevisions | itemId → CurrentAffairItem
user-revision-item.model.tsMONGODB: userrevisionitems | contentId → Mcq or Flashcard collections

models/practice-pyq/

FileWhat it does (short)
practice-pyq-import-meta.schema.tsNOT a collection — merged into PracticePyqQuestion root for import fidelity.
practice-pyq-question.model.tsMONGODB: practicepyqquestions | subtopicId → PracticePyqSubtopic
practice-pyq-subject.model.tsMONGODB: practicepyqsubjects | Hierarchy: Subject → Topic → Subtopic → Question
practice-pyq-subtopic.model.tsMONGODB: practicepyqsubtopics | topicId → PracticePyqTopic; questions hang here
practice-pyq-topic.model.tsMONGODB: practicepyqtopics | subjectId → PracticePyqSubject (unique slug per subject)
practice-pyq-user-question-card.model.tsMONGODB: practicepyquserquestioncards | Unique (userId, questionId)

models/user-study-stats/

FileWhat it does (short)
practice-attempt-event.model.tsMONGODB: practiceattemptevents | One row per graded attempt (IST dayKey)
user-practice-daily-rollup.model.tsMONGODB: userpracticedailyrollups | Unique (userId, catalog, dayKey)
user-practice-topic-rollup.model.tsMONGODB: userpracticetopicrollups | Unique (userId, catalog, topicId)
user-recent-practice-subtopic.model.tsMONGODB: userrecentpracticesubtopics | Updated by record-recent-practice-subtopic.ts

routes/

FileWhat it does (short)
admin.route.tsadmin.route.ts — Staff / admin API (content, users, videos, nested catalogs)
auth.route.tsauth.route.ts — Authentication & session tokens
current-affairs-admin.routes.tscurrent-affairs-admin.routes.ts — Staff CRUD for daily CA issues & Nexus
current-affairs-public.routes.tscurrent-affairs-public.routes.ts — Daily CA reader, revision, search (learners)
marketing-admin.routes.tsmarketing-admin.routes.ts — Sponsors & signup coupon deals
notification.route.tsnotification.route.ts — Push notifications (FCM), prefs, admin metrics, cron
practice-pyq-admin.routes.tspractice-pyq-admin.routes.ts — Admin CRUD for practice catalogs
practice-pyq-public.routes.tspractice-pyq-public.routes.ts — Learner practice catalog (PYQ + Practice YT)
timestamps.route.tstimestamps.route.ts — Public merged video markers (admin + crowd)
user.route.tsuser.route.ts — Logged-in learner API (profile, library, playlists)

services/

FileWhat it does (short)
continue-learning.service.tsCONTINUE LEARNING SERVICE — last 5 practiced subtopics with progress %
current-affairs-ancillary.service.tsCURRENT AFFAIRS ANCILLARY — Nexus entities, search, PYQ links
current-affairs-bookmark-news-revision.scheduler.tsBOOKMARK NEWS REVISION SCHEDULER — when bookmarked news items come due
current-affairs-bookmark-news-revision.service.tsCA BOOKMARK NEWS REVISION — spaced review for bookmarked news snippets
current-affairs-bookmark.service.tsCURRENT AFFAIRS BOOKMARK SERVICE — save news items for later + SRS row
current-affairs-revision.service.tsCURRENT AFFAIRS REVISION SERVICE — MCQ/flashcard SRS queue for CA
current-affairs.service.tsCURRENT AFFAIRS SERVICE — daily issues, news items, MCQs, flashcards
google.service.tsGOOGLE SERVICE — verify Google Sign-In tokens
marketing-deal-coupon.service.tsMARKETING DEAL COUPON — unique sponsor coupon codes
practice-pyq-ce-asrs-scheduler.tsPRACTICE PYQ CE-ASRS SCHEDULER — exam-tuned SRS (ladder + phase II)
practice-pyq-grade.tsPRACTICE PYQ GRADE — shared SRS button labels
practice-pyq-learner.service.tsPRACTICE PYQ LEARNER SERVICE — public practice flow + SRS grading
practice-pyq-questions.service.tsPRACTICE PYQ QUESTIONS SERVICE — admin CRUD + public question lists
practice-pyq-srs-scheduler.tsPRACTICE PYQ SRS SCHEDULER — SM-2 style intervals from four grades
practice-pyq-taxonomy.service.tsPRACTICE PYQ TAXONOMY SERVICE — subjects, topics, subtopics (admin + public tree)
practice-pyq-week-review.service.tsPRACTICE PYQ WEEK REVIEW — kanban “this week” due cards by subtopic/day
practice-review-summary.service.tsPRACTICE REVIEW SUMMARY — due today / overdue counts for review hub
token.service.tsTOKEN SERVICE — login sessions (access + refresh JWT)
youtube.service.tsYOUTUBE SERVICE — video/channel metadata for study content

services/notifications/

FileWhat it does (short)
fcm-sender.service.tsFCM SENDER — deliver push notifications via Firebase Cloud Messaging
notification-metrics.service.tsNOTIFICATION METRICS — admin dashboards for push campaigns
notification-templates.tsNOTIFICATION TEMPLATES — push title/body copy (EN + HI)
record-notification-open.service.tsRECORD NOTIFICATION OPEN — analytics when user taps a push
send-due-reminders.service.tsSEND DUE REMINDERS — “you have revisions due” push campaign
send-streak-warnings.service.tsSEND STREAK WARNINGS — evening push if streak at risk (no practice today)

services/user-study-stats/

FileWhat it does (short)
record-practice-attempt-analytics.tsRECORD PRACTICE ATTEMPT ANALYTICS — streaks + rollups per attempt
record-recent-practice-subtopic.tsRECORD RECENT PRACTICE SUBTOPIC — “continue learning” recency list
study-stats-window.tsSTUDY STATS WINDOW — IST day-key helpers for analytics range
study-stats.service.tsSTUDY STATS SERVICE — dashboard aggregates for a user

types/

FileWhat it does (short)
index.tsTypeScript types are compile-time only — they disappear when JavaScript

utils/

FileWhat it does (short)
ca-local-datetime.tsCurrent Affairs: local date/time without extra libraries
current-affairs-date.tsCurrent Affairs date string validation
current-affairs-search-expand.tsCurrent Affairs global search: query expansion
dto.ts”DTO” = Data Transfer Object = the JSON shape we send to clients.
india-study-calendar.tsIndia study calendar (single timezone for CA + PYQ week boards)
localized-display-title.tsLocalized display titles (English + Hindi)
nexus-entity-status.tsNexus entity status & MongoDB filters
yt-solution-stored.tsPractice YT: yt_solution field normalization
yt-solution-url.tsYouTube solution URL validation (Practice YT bulk import)

validators/

FileWhat it does (short)
current-affairs.schemas.tsAll request bodies/queries for daily issues, news items, MCQs, flashcards,
notification.schemas.tsRequest/query/body schemas for notification.route.ts. Validates before
practice-pyq-public.schemas.tsQuery/body for fetching question queues and grading attempts (SRS).
practice-pyq-question.schemas.tsValidates bulk JSON paste into PracticePyqQuestion (flat PYQ fields + en/hi).
practice-pyq-taxonomy.schemas.tsCALLED BY: practice-pyq-admin.routes, practice-pyq-taxonomy.service
practice-review-summary.schemas.tsQuery validation for GET /users/me/review-summary — home-screen badge
user-study-stats.schemas.tsValidates GET /users/me/study-stats query params and documents the
Last updated on