# vinit1936/recall. architecture

> Architecture diagram of the GitHub repository vinit1936/recall., generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinit1936/recall.
- Repository: https://github.com/vinit1936/recall.

## Overview

#### Purpose and Runtime
recall. is a Next.js 16/React 19 application for tracking DSA problems and scheduling reviews through deterministic spaced repetition. It runs as an App Router server/client application, with REST-style route handlers backed by Prisma and Neon PostgreSQL. Primary roots are `src/app/layout.tsx`, `src/app/(landing)/page.tsx`, and `src/app/(app)/layout.tsx`.

#### Authentication and Access Boundary
NextAuth v5 authenticates users through Google, GitHub, or credential login; Prisma persists users, sessions, accounts, and credentials. Protected application views and user-scoped API operations form the core tenant boundary. Relevant paths: `src/auth.ts`, `src/app/api/auth/[...nextauth]/route.ts`, `src/app/auth/login/page.tsx`.

#### Persistent Domain Model
Prisma owns the durable model for users, problems, revisions, streak logs, and per-user column definitions. `Problem` carries platform metadata, lifecycle state, ladder step, due timestamp, and JSON custom fields; `Revision` records transitions and ratings. PostgreSQL uses pooled and direct Neon connections for serverless runtime versus migrations. Paths: `prisma/schema.prisma`, `src/lib/prisma.ts`, `prisma/migrations/20260707153101_add_nextauth_tables/migration.sql`.

#### Spaced-Repetition State Engine
The scheduling engine is a pure domain layer defining the 3/7/14/30-day ladder, rating-driven transitions, mastered/recheck handling, due-date normalization, and streak behavior. API handlers invoke it when a user submits a review, then persist both the changed problem and revision/streak records. Paths: `src/lib/scheduling.ts`, `src/app/api/problems/[id]/revise/route.ts`, `src/app/api/problems/[id]/revise-again/route.ts`.

#### Problem Management API and Dashboard
The problem API is the main CRUD/control surface: create/list/filter problems, update/delete metadata, find due work, retire items, and mutate custom values. The dashboard renders this collection through an interactive table; client fetching/caching uses SWR/native fetch abstractions. Paths: `src/app/api/problems/route.ts`, `src/app/api/problems/[id]/route.ts`, `src/components/problems-table/index.tsx`.

#### Daily Review and Habit Flow
The `/daily` page requests due-or-overdue active problems, presents a focused review deck, submits confidence ratings, and then refreshes aggregate streak/activity state. Separate endpoints produce streak status and 365-day heatmap data. Paths: `src/app/(app)/daily/page.tsx`, `src/components/daily/focus-deck.tsx`, `src/app/api/problems/due/route.ts`.

#### Platform Metadata Resolution
New problems are enriched locally rather than through runtime third-party platform calls. A central resolver registry dispatches by platform to resolver implementations, which query bundled JSON catalogs and apply URL/identifier fallback parsing. Build scripts generate/download catalog data. Paths: `src/lib/platforms/index.ts`, `src/lib/platforms/types.ts`, `src/data/leetcode-problems.json`.

#### Customization and Export
Users define table columns independently of the relational schema; definitions are persisted while values live in `Problem.customFields` JSON and are updated atomically. Settings also exposes full user-data export across problems, revisions, and streaks. Paths: `src/app/api/columns/route.ts`, `src/app/api/problems/[id]/custom-fields/route.ts`, `src/app/api/export/route.ts`.

Main entry points: [`src/lib/prisma.ts`](https://github.com/vinit1936/recall./blob/main/src/lib/prisma.ts) (Prisma data access), [`src/components/problems-table/index.tsx`](https://github.com/vinit1936/recall./blob/main/src/components/problems-table/index.tsx) (Problems dashboard), [`src/app/(app)/layout.tsx`](https://github.com/vinit1936/recall./blob/main/src/app/(app)/layout.tsx) (App Router layouts), [`src/components/daily/focus-deck.tsx`](https://github.com/vinit1936/recall./blob/main/src/components/daily/focus-deck.tsx) (Focus deck)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App UI"]
  node_app_shell["App Router layouts<br/>Next.js shell<br/>[layout.tsx]"]
  node_landing["Landing page<br/>public page<br/>[page.tsx]"]
  node_login["Login page<br/>auth UI<br/>[page.tsx]"]
  node_dashboard["Problems dashboard<br/>interactive table<br/>[index.tsx]"]
  node_daily_page["Daily review<br/>review page<br/>[page.tsx]"]
  node_focus_deck["Focus deck<br/>review client<br/>[focus-deck.tsx]"]
end

subgraph group_api["Server API"]
  node_auth_route["Auth route handler<br/>[route.ts]"]
  node_problems_api["Problems API<br/>CRUD route handlers<br/>[route.ts]"]
  node_problem_api["Problem detail API<br/>CRUD route handler<br/>[route.ts]"]
  node_due_api["Due work API<br/>route handler<br/>[route.ts]"]
  node_review_api["Review API<br/>route handlers<br/>[route.ts]"]
  node_columns_api["Columns API<br/>route handler<br/>[route.ts]"]
  node_custom_fields_api["Custom fields API<br/>route handler<br/>[route.ts]"]
  node_export_api["Data export API<br/>route handler<br/>[route.ts]"]
end

subgraph group_domain["Domain Services"]
  node_nextauth{{"NextAuth<br/>authentication service<br/>[auth.ts]"}}
  node_scheduling["Scheduling engine<br/>pure domain logic<br/>[scheduling.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma data access<br/>database client<br/>[prisma.ts]"]
  node_schema["Prisma domain schema<br/>data model<br/>[schema.prisma]"]
  node_postgres[("Neon PostgreSQL<br/>database")]
end

subgraph group_metadata["Platform Metadata"]
  node_platform_resolver["Platform resolver registry<br/>metadata resolver<br/>[index.ts]"]
  node_leetcode_catalog["LeetCode catalog<br/>bundled JSON catalog"]
end

node_app_shell -->|"serves public route"| node_landing
node_app_shell -->|"hosts protected UI"| node_dashboard
node_app_shell -->|"hosts protected UI"| node_daily_page
node_login -->|"signs in through"| node_auth_route
node_auth_route -->|"delegates to"| node_nextauth
node_nextauth -->|"persists identity and sessions"| node_prisma
node_dashboard -->|"lists and creates"| node_problems_api
node_dashboard -->|"updates and deletes"| node_problem_api
node_dashboard -->|"configures columns"| node_columns_api
node_dashboard -->|"edits custom values"| node_custom_fields_api
node_daily_page -->|"renders"| node_focus_deck
node_focus_deck -->|"loads due work"| node_due_api
node_focus_deck -->|"submits rating"| node_review_api
node_problems_api -->|"enriches new problems"| node_platform_resolver
node_platform_resolver -->|"queries local catalog"| node_leetcode_catalog
node_problems_api -->|"reads and writes problems"| node_prisma
node_problem_api -->|"mutates problem metadata"| node_prisma
node_due_api -->|"queries active due problems"| node_prisma
node_review_api -->|"computes transition"| node_scheduling
node_review_api -->|"persists problem, revision, streak"| node_prisma
node_columns_api -->|"persists definitions"| node_prisma
node_custom_fields_api -->|"updates JSON values"| node_prisma
node_export_api -->|"reads user data"| node_prisma
node_prisma -->|"implements model"| node_schema
node_prisma -->|"uses pooled/direct connections"| node_postgres

click node_app_shell "https://github.com/vinit1936/recall./blob/main/src/app/(app)/layout.tsx"
click node_landing "https://github.com/vinit1936/recall./blob/main/src/app/(landing)/page.tsx"
click node_login "https://github.com/vinit1936/recall./blob/main/src/app/auth/login/page.tsx"
click node_dashboard "https://github.com/vinit1936/recall./blob/main/src/components/problems-table/index.tsx"
click node_daily_page "https://github.com/vinit1936/recall./blob/main/src/app/(app)/daily/page.tsx"
click node_focus_deck "https://github.com/vinit1936/recall./blob/main/src/components/daily/focus-deck.tsx"
click node_nextauth "https://github.com/vinit1936/recall./blob/main/src/auth.ts"
click node_auth_route "https://github.com/vinit1936/recall./blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_problems_api "https://github.com/vinit1936/recall./blob/main/src/app/api/problems/route.ts"
click node_problem_api "https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/route.ts"
click node_due_api "https://github.com/vinit1936/recall./blob/main/src/app/api/problems/due/route.ts"
click node_review_api "https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/revise/route.ts"
click node_scheduling "https://github.com/vinit1936/recall./blob/main/src/lib/scheduling.ts"
click node_columns_api "https://github.com/vinit1936/recall./blob/main/src/app/api/columns/route.ts"
click node_custom_fields_api "https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/custom-fields/route.ts"
click node_export_api "https://github.com/vinit1936/recall./blob/main/src/app/api/export/route.ts"
click node_platform_resolver "https://github.com/vinit1936/recall./blob/main/src/lib/platforms/index.ts"
click node_leetcode_catalog "https://github.com/vinit1936/recall./blob/main/src/data/leetcode-problems.json"
click node_prisma "https://github.com/vinit1936/recall./blob/main/src/lib/prisma.ts"
click node_schema "https://github.com/vinit1936/recall./blob/main/prisma/schema.prisma"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_shell,node_landing,node_login,node_dashboard,node_daily_page,node_focus_deck toneBlue
class node_auth_route,node_problems_api,node_problem_api,node_due_api,node_review_api,node_columns_api,node_custom_fields_api,node_export_api toneAmber
class node_nextauth,node_scheduling toneMint
class node_prisma,node_schema,node_postgres toneRose
class node_platform_resolver,node_leetcode_catalog toneIndigo
```

## Components

### App UI

- [App Router layouts](https://github.com/vinit1936/recall./blob/main/src/app/(app)/layout.tsx): Next.js shell · Separates landing and protected application experiences. · `src/app/(app)/layout.tsx`
- [Landing page](https://github.com/vinit1936/recall./blob/main/src/app/(landing)/page.tsx): public page · `src/app/(landing)/page.tsx`
- [Login page](https://github.com/vinit1936/recall./blob/main/src/app/auth/login/page.tsx): auth UI · `src/app/auth/login/page.tsx`
- [Problems dashboard](https://github.com/vinit1936/recall./blob/main/src/components/problems-table/index.tsx): interactive table · Fetches and manages the user's problem collection. · `src/components/problems-table/index.tsx`
- [Daily review](https://github.com/vinit1936/recall./blob/main/src/app/(app)/daily/page.tsx): review page · `src/app/(app)/daily/page.tsx`
- [Focus deck](https://github.com/vinit1936/recall./blob/main/src/components/daily/focus-deck.tsx): review client · Rates due problems and refreshes habit state. · `src/components/daily/focus-deck.tsx`

### Server API

- [Auth route handler](https://github.com/vinit1936/recall./blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): route handler · `src/app/api/auth/[...nextauth]/route.ts`
- [Problems API](https://github.com/vinit1936/recall./blob/main/src/app/api/problems/route.ts): CRUD route handlers · User-scoped problem lifecycle and collection operations. · `src/app/api/problems/route.ts`
- [Problem detail API](https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/route.ts): CRUD route handler · `src/app/api/problems/[id]/route.ts`
- [Due work API](https://github.com/vinit1936/recall./blob/main/src/app/api/problems/due/route.ts): route handler · `src/app/api/problems/due/route.ts`
- [Review API](https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/revise/route.ts): route handlers · Applies ratings or recheck actions to a problem. · `src/app/api/problems/[id]/revise/route.ts`
- [Columns API](https://github.com/vinit1936/recall./blob/main/src/app/api/columns/route.ts): route handler · Persists per-user table column definitions. · `src/app/api/columns/route.ts`
- [Custom fields API](https://github.com/vinit1936/recall./blob/main/src/app/api/problems/%5Bid%5D/custom-fields/route.ts): route handler · Atomically updates Problem JSON custom values. · `src/app/api/problems/[id]/custom-fields/route.ts`
- [Data export API](https://github.com/vinit1936/recall./blob/main/src/app/api/export/route.ts): route handler · Exports user problems, revisions, and streaks. · `src/app/api/export/route.ts`

### Domain Services

- [NextAuth](https://github.com/vinit1936/recall./blob/main/src/auth.ts): authentication service · Authenticates Google, GitHub, and credential users. · `src/auth.ts`
- [Scheduling engine](https://github.com/vinit1936/recall./blob/main/src/lib/scheduling.ts): pure domain logic · Computes ladder transitions, due dates, and streak behavior. · `src/lib/scheduling.ts`

### Persistence

- [Prisma data access](https://github.com/vinit1936/recall./blob/main/src/lib/prisma.ts): database client · Server-side access to the durable user-scoped model. · `src/lib/prisma.ts`
- [Prisma domain schema](https://github.com/vinit1936/recall./blob/main/prisma/schema.prisma): data model · Defines users, sessions, problems, revisions, streaks, and columns. · `prisma/schema.prisma`
- **Neon PostgreSQL**: database · Stores application and NextAuth records.

### Platform Metadata

- [Platform resolver registry](https://github.com/vinit1936/recall./blob/main/src/lib/platforms/index.ts): metadata resolver · Resolves platform metadata from local catalogs and URL fallbacks. · `src/lib/platforms/index.ts`
- [LeetCode catalog](https://github.com/vinit1936/recall./blob/main/src/data/leetcode-problems.json): bundled JSON catalog · `src/data/leetcode-problems.json`

## Connections

- App Router layouts → Landing page: serves public route
- App Router layouts → Problems dashboard: hosts protected UI
- App Router layouts → Daily review: hosts protected UI
- Login page → Auth route handler: signs in through
- Auth route handler → NextAuth: delegates to
- NextAuth → Prisma data access: persists identity and sessions
- Problems dashboard → Problems API: lists and creates
- Problems dashboard → Problem detail API: updates and deletes
- Problems dashboard → Columns API: configures columns
- Problems dashboard → Custom fields API: edits custom values
- Daily review → Focus deck: renders
- Focus deck → Due work API: loads due work
- Focus deck → Review API: submits rating
- Problems API → Platform resolver registry: enriches new problems
- Platform resolver registry → LeetCode catalog: queries local catalog
- Problems API → Prisma data access: reads and writes problems
- Problem detail API → Prisma data access: mutates problem metadata
- Due work API → Prisma data access: queries active due problems
- Review API → Scheduling engine: computes transition
- Review API → Prisma data access: persists problem, revision, streak
- Columns API → Prisma data access: persists definitions
- Custom fields API → Prisma data access: updates JSON values
- Data export API → Prisma data access: reads user data
- Prisma data access → Prisma domain schema: implements model
- Prisma data access → Neon PostgreSQL: uses pooled/direct connections
