How arun7296/mbbs works
1. This repository is a Next.js App Router application for medical education and assessment. The top-level product is split into two major experience areas: an auth/onboarding flow and the main learning platform.
2. The presentation layer lives under src/app. Routes are organized by user task, not by technical layer: learn, practice, revise, progress, search, study-plan, clinical, aetcom, and test/mock. Most pages are server-rendered route entries that compose reusable client components for interactive study and quiz behavior.
3. The main UI boundary is src/components. It is organized by domain: lesson viewers, quiz shells, revision/flashcards, clinical simulation, video playback, shared markdown/progress widgets, and a large catalog of diagram components for anatomy, physiology, pathology, pharmacology, biochemistry, and clinical topics. This suggests the UI is heavily content-driven and visualization-heavy rather than form- or transaction-heavy.
4. The backend API is implemented with tRPC under src/server/trpc, with one router per domain: content, curriculum, progress, search, study plan, video, visuals, clinical, clinical decision simulation, and assessment. The front end talks to these routers through the tRPC client/provider in src/lib/trpc, keeping type-safe RPC as the main data access path for app features.
5. Persistence is centered on Prisma. The schema and migrations in prisma/schema.prisma and prisma/migrations define the application data model, while src/lib/db/prisma.ts provides the database client. The database is the source of truth for curriculum structure, lessons, MCQs, cases, progress, and related learning artifacts.
6. Content population is a major subsystem and likely the most important architectural boundary in the repo. The prisma/seeds folder contains a large, modular seed corpus for subjects, lectures, lessons, MCQs, clinical scenarios, and “gap”/placeholder batches. Seeding is orchestrated by prisma/seed.ts, prisma/run-seed.ts, and numerous content-part files, indicating the platform’s educational library is assembled from structured seed data rather than authored directly in the app UI.
7. The curriculum model appears explicitly layered: subjects, modules, topics, lessons, questions, and scenarios. Supporting types and constants in src/types/curriculum.ts and src/lib/constants/curriculum.ts suggest the app navigates and queries content using a stable academic taxonomy, which is reflected in routes like /learn/[subjectCode]/[moduleCode]/[topicSlug].
8. Clinical learning has its own subdomain. There are dedicated clinical case routes and a clinical simulator UI under src/components/clinical-sim, plus decision/assessment routers on the server. This is separate from standard lesson and quiz content, implying a specialized interaction model for patient case progression, findings, investigations, and feedback.
9. Assessment and practice are separate flows. Practice pages use client components like QuizShell, QuestionRenderer, and ExplanationPanel, while test/mock pages have their own route tree and review screens. This indicates the app distinguishes between lightweight practice quizzes and higher-stakes exam simulations.
10. Progression and personalization are first-class features. The progress and study-plan areas, plus the progress tRPC router and revision/flashcard components, show a loop of content consumption → performance tracking → weak-area identification → personalized study output.
11. Visual and media content is treated as its own subsystem. There are diagram libraries in src/components/diagrams, video components in src/components/video, and data utilities in src/lib/visuals and src/lib/video. The scripts under scripts/ and seed maps for Servier/OpenStax/Wikimedia indicate external illustration and video sources are ingested, normalized, and mapped to curriculum topics.
12. Authentication and session handling are integrated at the app edge. NextAuth routes live under src/app/api/auth/[...nextauth], signup has its own route, and src/lib/auth/config.ts plus src/middleware.ts define auth behavior and route protection. The src/app/(auth) and src/app/(main) route groups reflect the protected-app boundary.
13. The codebase includes several domain algorithms and utilities that support learning logic rather than UI rendering: spaced repetition, clinical scoring, video ranking, and visual generation. These live in src/lib/algorithms, src/lib/utils, src/lib/video, and src/lib/visuals, and are consumed by server routers and interactive components.
14. Tooling and maintenance scripts are significant because they support content ops at scale. The scripts/ directory contains utilities for building image catalogues, seeding visuals/videos, matching external image sources to topics, fixing URLs, and creating demo users. This repository behaves like a content platform with a strong data pipeline, not just a conventional app.
15. In architecture-diagram terms, the key flows are: curriculum content is seeded into Prisma → tRPC routers expose typed read/write APIs → Next.js pages and client components render lessons, quizzes, cases, and progress views → user actions update persisted progress and feed personalized study/revision features. The critical boundary is between the content/database layer and the interactive learning UI.
Main entry points: layout.tsx Main shell · routers Domain routers · lesson Lesson UI · scripts Ops scripts
Components 30
Auth edge
Authentication routes, session config, and route protection.
- Auth flow · Login, signup, and onboarding entrypoints before the main app.
src/app/(auth) - Auth config · NextAuth configuration and middleware-based route protection.
src/lib/auth/config.ts
Next.js app
Route groups and page entrypoints for the user-facing product.
- Main shell · Protected application layout and shared loading/error boundaries.
src/app/(main)/layout.tsx - Learn routes · Subject → module → topic navigation for structured lesson browsing.
src/app/(main)/learn - Practice flow · Interactive quiz shell, question experience, and result review.
src/app/(main)/practice - Mock tests · Higher-stakes exam simulation and review screens.
src/app/(main)/test/mock - Clinical cases · Clinical case browser, case detail, and review pages.
src/app/(main)/clinical - Progress views · Progress dashboards by subject and overall learning status.
src/app/(main)/progress - Study plan · Personalized study-plan entrypoint for weak-area driven learning.
src/app/(main)/study-plan
Interactive UI
Reusable client components that implement lessons, quizzes, revision, clinical flow, diagrams, and media.
- Lesson UI · Lesson viewer, key points, mnemonics, and embedded clinical decision/visual layers.
src/components/lesson - Quiz UI · Question rendering, explanations, and quiz shell coordination.
src/components/quiz - Revision UI · Weak-area cards and flashcard review for spaced repetition loops.
src/components/revise - Clinical UI · Patient card, timeline, findings, and action selection for case progression.
src/components/clinical - Sim steps · Stepwise clinical simulation screens for history, exam, diagnosis, treatment, and feedback.
src/components/clinical-sim - Diagram library · Reusable diagram system spanning anatomy, biochemistry, pathology, pharmacology, physiology, and clinical visualizations.
src/components/diagrams - Video UI · Video list and playback UI for hosted or sourced educational media.
src/components/video - Shared widgets · Markdown rendering and progress indicators shared across routes.
src/components/shared
Server API
tRPC routers and adapters that expose typed domain services.
- tRPC root · Top-level tRPC router composition and server context.
src/server/trpc/root.ts - Domain routers · Content, curriculum, progress, search, study plan, video, visual, clinical, clinical decision, and assessment routers.
src/server/trpc/routers - tRPC client · Typed client and provider used by the app to call server routers.
src/lib/trpc/client.ts
Data & content
Prisma model, migrations, and structured seed corpus that populate the learning platform.
- Prisma schema · Application data model and migrations for lessons, MCQs, cases, progress, and related learning artifacts.
prisma/schema.prisma - Seed runner · Orchestrates database population from the modular content corpus.
prisma/seed.ts - Content seeds · Large subject- and artifact-specific seed corpus for lectures, lessons, MCQs, cases, and gaps.
prisma/seeds
Core logic
Shared algorithms and domain utilities used by routers and UI.
- Curriculum model · Subject, module, topic, lesson, question, and scenario definitions used across the app.
src/types/curriculum.ts - Curriculum constants · Stable curriculum metadata and subject mapping constants.
src/lib/constants/curriculum.ts - Learning logic · Spaced repetition, clinical scoring, and other learning-domain algorithms.
src/lib/algorithms/clinical-scoring.ts - Video logic · Video search and ranking utilities used to select relevant educational media.
src/lib/video/video-ranker.ts - Visual logic · Visual sourcing, SVG generation, and topic-to-image matching utilities.
src/lib/visuals/svg-generator.ts
Content ops
Maintenance scripts for seeding, cataloging, and media/content synchronization.
- Ops scripts · Cataloging, seeding, matching, and repair scripts for large-scale content operations.
scripts
Other components
- MBBS platform · Protected learning platform with seeded curriculum, practice, clinical simulation, progress tracking, and personalization.
Connections 33
- MBBS platform → Auth flow: entry · Auth and onboarding are the pre-app boundary.
- MBBS platform → Main shell: shell · The protected product renders inside the main app shell.
- Main shell → Learn routes: hosts · Main shell serves the curriculum browsing routes.
- Main shell → Practice flow: hosts · Main shell serves practice quizzes.
- Main shell → Mock tests: hosts · Main shell serves mock exam flows.
- Main shell → Clinical cases: hosts · Main shell serves clinical case workflows.
- Main shell → Progress views: hosts · Main shell serves progress tracking pages.
- Main shell → Study plan: hosts · Main shell serves personalization/study-plan pages.
- Learn routes → Lesson UI: renders · Lesson pages compose the lesson UI boundary.
- Practice flow → Quiz UI: renders · Practice pages use the quiz shell and question renderer.
- Mock tests → Quiz UI: renders · Mock exam pages reuse the assessment UI stack.
- Mock tests → Revision UI: reviews · Exam review flows feed revision-oriented components.
- Clinical cases → Clinical UI: renders · Clinical pages use patient/case interaction components.
- Clinical cases → Sim steps: simulates · Clinical case progression can enter the simulation stepper.
- Progress views → Shared widgets: shows · Progress pages use shared widgets and indicators.
- Study plan → Revision UI: personalizes · Study plans are fed by weak-area and flashcard views.
- Lesson UI → Diagram library: embeds · Lessons frequently include medical diagrams and visual theory layers.
- Lesson UI → Video UI: embeds · Lessons can incorporate video playback and lists.
- Lesson UI → Shared widgets: uses · Lesson rendering relies on shared markdown/progress widgets.
- Clinical UI → Sim steps: extends · Clinical case UI connects to stepwise simulation interactions.
- tRPC root → Domain routers: composes · The root tRPC layer aggregates domain routers.
- tRPC client → tRPC root: calls · The UI talks to the server through the typed RPC boundary.
- Domain routers → Prisma schema: queries · Routers read/write persisted curriculum and learner state.
- Domain routers → Learning logic: applies · Routers invoke domain logic for scoring and study planning.
- Domain routers → Video logic: applies · Video router logic selects and ranks media.
- Domain routers → Visual logic: applies · Visual router logic serves image and SVG assets.
- Seed runner → Content seeds: loads · The seed runner assembles structured content batches.
- Seed runner → Prisma schema: writes · Seed execution populates the database schema.
- Content seeds → Curriculum model: shaped by · Seed data follows the shared curriculum taxonomy.
- Curriculum model → Curriculum constants: aligned with · Navigation and subject codes are stabilized by constants.
- Ops scripts → Content seeds: maintains · Scripts catalog, fix, and normalize seed-driven content.
- Ops scripts → Visual logic: feeds · Content ops ingest and map external image sources.
- Ops scripts → Video logic: feeds · Content ops also seed and rank educational video assets.