# kishore-in2007/memorystack architecture

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

- Interactive diagram: https://gitdiagram.com/kishore-in2007/memorystack
- Repository: https://github.com/kishore-in2007/memorystack

## Overview

Memory Stack is an Expo mobile app for capturing solved DSA problems and retaining their concepts through a 10-stage spaced-repetition workflow. Users sign in or enter demo mode, add/search problems, review saved solutions, practice in a code editor, submit for evaluation, and see performance and memory metrics. Zustand provides persistent local state and offline behavior; Supabase Edge Functions support cloud revision, search, and code execution. The map preserves documented recommendation, analytics, and notification capabilities, while some unsampled function-level wiring is necessarily shown only where README documentation supports it.

Main entry points: [`store/useStore.ts`](https://github.com/kishore-in2007/memorystack/blob/main/store/useStore.ts) (Persistent app state), [`app/revision/[id]/review.tsx`](https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/review.tsx) (Review step), [`lib/edgeFunctions.ts`](https://github.com/kishore-in2007/memorystack/blob/main/lib/edgeFunctions.ts) (Edge function client), [`app/(tabs)/index.tsx`](https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/index.tsx) (Daily dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and identity"]
  node_login["Sign in / demo<br/>[login.tsx]"]
  node_home["Daily dashboard<br/>[index.tsx]"]
  node_notifications["Review alerts<br/>[notifications.ts]"]
  node_app_root["App root<br/>[_layout.tsx]"]
end

subgraph group_study["Problem capture and discovery"]
  node_capture["Add problem<br/>[add.tsx]"]
  node_search["Problem search"]
  node_search_hook["Search hook"]
  node_catalog_sync["Catalog sync<br/>[index.ts]"]
  node_queue["Due queue<br/>[queue.tsx]"]
end

subgraph group_revision["Revision and practice"]
  node_review["Review step<br/>[review.tsx]"]
  node_context_hook["Revision context"]
  node_revision_service["Revision service<br/>[revisionService.ts]"]
  node_previous_solution["Saved solution card"]
  node_practice["Practice step<br/>[practice.tsx]"]
  node_compiler["Code editor<br/>[compiler.tsx]"]
  node_draft_hook["Code drafts<br/>[useCodeDraft.ts]"]
  node_compiler_service["Submission service<br/>[compilerService.ts]"]
  node_result["Performance result<br/>[result.tsx]"]
  node_recommendations["Practice recommendations<br/>[index.ts]"]
end

subgraph group_state["State and scheduling"]
  node_stats["Memory analytics<br/>[stats.tsx]"]
  node_store[("Persistent app state<br/>[useStore.ts]")]
  node_scheduling["Spaced repetition"]
  node_memory_strength["Memory strength<br/>[memoryStrength.ts]"]
  node_offline_cache[("Offline revision cache<br/>[revisionCache.ts]")]
end

subgraph group_cloud["Cloud services"]
  node_edge_functions["Edge function client<br/>[edgeFunctions.ts]"]
  node_revision_context_fn["Revision context API<br/>[index.ts]"]
  node_reviewed_fn["Review marker API<br/>[index.ts]"]
  node_run_code_fn["Code execution API<br/>[index.ts]"]
  node_submit_fn["Solution submission API<br/>[index.ts]"]
  node_search_fn["Search API<br/>[index.ts]"]
end

node_learner(("Learner"))
node_supabase[("Supabase service")]
node_judge["Code judge"]
node_ai_provider["AI provider"]

node_learner -->|"signs in"| node_login
node_login -->|"sets user"| node_store
node_login -.->|"routes to"| node_home
node_home -->|"reads state"| node_store
node_home -->|"opens queue"| node_queue
node_home -->|"starts review"| node_review
node_home -->|"caches due items"| node_offline_cache
node_learner -.->|"adds problem"| node_capture
node_capture -.->|"searches catalog"| node_search_hook
node_search_hook -->|"requests matches"| node_search
node_search -.->|"invokes search"| node_search_fn
node_search_fn -.->|"queries catalog"| node_supabase
node_catalog_sync -.->|"updates catalog"| node_supabase
node_capture -.->|"records problem"| node_store
node_store -->|"generates schedule"| node_scheduling
node_learner -.->|"reviews work"| node_review
node_review -->|"loads context"| node_context_hook
node_context_hook -->|"requests context"| node_revision_service
node_context_hook -->|"caches context"| node_offline_cache
node_revision_service -->|"invokes API"| node_edge_functions
node_edge_functions -.->|"dispatches context"| node_revision_context_fn
node_edge_functions -.->|"dispatches review"| node_reviewed_fn
node_revision_context_fn -.->|"loads revision data"| node_supabase
node_review -->|"renders solution"| node_previous_solution
node_review -->|"marks reviewed"| node_revision_service
node_review -->|"continues to"| node_practice
node_practice -.->|"opens editor"| node_compiler
node_compiler -.->|"saves draft"| node_draft_hook
node_compiler -.->|"runs or submits"| node_compiler_service
node_compiler_service -->|"invokes API"| node_edge_functions
node_edge_functions -.->|"dispatches run"| node_run_code_fn
node_edge_functions -.->|"dispatches submission"| node_submit_fn
node_run_code_fn -.->|"executes tests"| node_judge
node_submit_fn -.->|"evaluates solution"| node_judge
node_compiler_service -->|"completes revision"| node_store
node_store -->|"updates strength"| node_memory_strength
node_compiler_service -->|"updates context"| node_offline_cache
node_compiler -.->|"shows outcome"| node_result
node_result -.->|"reads performance"| node_store
node_store -.->|"supplies metrics"| node_stats
node_revision_service -.->|"requests practice"| node_recommendations
node_recommendations -.->|"uses classification"| node_ai_provider
node_app_root -->|"schedules alerts"| node_notifications
node_app_root -->|"reads due schedule"| node_store
node_notifications -->|"routes alert tap"| node_review

click node_login "https://github.com/kishore-in2007/memorystack/blob/main/app/(auth)/login.tsx"
click node_home "https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/index.tsx"
click node_notifications "https://github.com/kishore-in2007/memorystack/blob/main/lib/notifications.ts"
click node_app_root "https://github.com/kishore-in2007/memorystack/blob/main/app/_layout.tsx"
click node_capture "https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/add.tsx"
click node_search "https://github.com/kishore-in2007/memorystack/blob/main/services/problemSearchService.ts"
click node_search_hook "https://github.com/kishore-in2007/memorystack/blob/main/hooks/useProblemSearch.ts"
click node_catalog_sync "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/sync-problem-catalog/index.ts"
click node_queue "https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/queue.tsx"
click node_review "https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/review.tsx"
click node_context_hook "https://github.com/kishore-in2007/memorystack/blob/main/hooks/useRevisionContext.ts"
click node_revision_service "https://github.com/kishore-in2007/memorystack/blob/main/services/revisionService.ts"
click node_previous_solution "https://github.com/kishore-in2007/memorystack/blob/main/components/revision/PreviousSolutionCard.tsx"
click node_practice "https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/practice.tsx"
click node_compiler "https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/compiler.tsx"
click node_draft_hook "https://github.com/kishore-in2007/memorystack/blob/main/hooks/useCodeDraft.ts"
click node_compiler_service "https://github.com/kishore-in2007/memorystack/blob/main/services/compilerService.ts"
click node_result "https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/result.tsx"
click node_recommendations "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/generate-practice-problem/index.ts"
click node_stats "https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/stats.tsx"
click node_store "https://github.com/kishore-in2007/memorystack/blob/main/store/useStore.ts"
click node_scheduling "https://github.com/kishore-in2007/memorystack/blob/main/lib/spacedRepetition.ts"
click node_memory_strength "https://github.com/kishore-in2007/memorystack/blob/main/lib/memoryStrength.ts"
click node_offline_cache "https://github.com/kishore-in2007/memorystack/blob/main/services/revisionCache.ts"
click node_edge_functions "https://github.com/kishore-in2007/memorystack/blob/main/lib/edgeFunctions.ts"
click node_revision_context_fn "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/get-revision-context/index.ts"
click node_reviewed_fn "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/mark-revision-reviewed/index.ts"
click node_run_code_fn "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/run-code/index.ts"
click node_submit_fn "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/submit-solution/index.ts"
click node_search_fn "https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/search-problems/index.ts"

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_login,node_home,node_notifications,node_app_root toneBlue
class node_capture,node_search,node_search_hook,node_catalog_sync,node_queue,node_supabase toneAmber
class node_review,node_context_hook,node_revision_service,node_previous_solution,node_practice,node_compiler,node_draft_hook,node_compiler_service,node_result,node_recommendations toneMint
class node_stats,node_store,node_scheduling,node_memory_strength,node_offline_cache toneRose
class node_edge_functions,node_revision_context_fn,node_reviewed_fn,node_run_code_fn,node_submit_fn,node_search_fn,node_learner,node_judge,node_ai_provider toneIndigo
```

## Components

### App entry and identity

- [Sign in / demo](https://github.com/kishore-in2007/memorystack/blob/main/app/(auth)/login.tsx): `app/(auth)/login.tsx`
- [Daily dashboard](https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Review alerts](https://github.com/kishore-in2007/memorystack/blob/main/lib/notifications.ts): `lib/notifications.ts`
- [App root](https://github.com/kishore-in2007/memorystack/blob/main/app/_layout.tsx): `app/_layout.tsx`

### Problem capture and discovery

- [Add problem](https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/add.tsx): `app/(tabs)/add.tsx`
- [Problem search](https://github.com/kishore-in2007/memorystack/blob/main/services/problemSearchService.ts): `services/problemSearchService.ts`
- [Search hook](https://github.com/kishore-in2007/memorystack/blob/main/hooks/useProblemSearch.ts): `hooks/useProblemSearch.ts`
- [Catalog sync](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/sync-problem-catalog/index.ts): `supabase/functions/sync-problem-catalog/index.ts`
- [Due queue](https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/queue.tsx): `app/(tabs)/queue.tsx`

### Revision and practice

- [Review step](https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/review.tsx): `app/revision/[id]/review.tsx`
- [Revision context](https://github.com/kishore-in2007/memorystack/blob/main/hooks/useRevisionContext.ts): `hooks/useRevisionContext.ts`
- [Revision service](https://github.com/kishore-in2007/memorystack/blob/main/services/revisionService.ts): `services/revisionService.ts`
- [Saved solution card](https://github.com/kishore-in2007/memorystack/blob/main/components/revision/PreviousSolutionCard.tsx): `components/revision/PreviousSolutionCard.tsx`
- [Practice step](https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/practice.tsx): `app/revision/[id]/practice.tsx`
- [Code editor](https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/compiler.tsx): `app/revision/[id]/compiler.tsx`
- [Code drafts](https://github.com/kishore-in2007/memorystack/blob/main/hooks/useCodeDraft.ts): `hooks/useCodeDraft.ts`
- [Submission service](https://github.com/kishore-in2007/memorystack/blob/main/services/compilerService.ts): `services/compilerService.ts`
- [Performance result](https://github.com/kishore-in2007/memorystack/blob/main/app/revision/%5Bid%5D/result.tsx): `app/revision/[id]/result.tsx`
- [Practice recommendations](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/generate-practice-problem/index.ts): `supabase/functions/generate-practice-problem/index.ts`

### State and scheduling

- [Memory analytics](https://github.com/kishore-in2007/memorystack/blob/main/app/(tabs)/stats.tsx): `app/(tabs)/stats.tsx`
- [Persistent app state](https://github.com/kishore-in2007/memorystack/blob/main/store/useStore.ts): `store/useStore.ts`
- [Spaced repetition](https://github.com/kishore-in2007/memorystack/blob/main/lib/spacedRepetition.ts): `lib/spacedRepetition.ts`
- [Memory strength](https://github.com/kishore-in2007/memorystack/blob/main/lib/memoryStrength.ts): `lib/memoryStrength.ts`
- [Offline revision cache](https://github.com/kishore-in2007/memorystack/blob/main/services/revisionCache.ts): `services/revisionCache.ts`

### Cloud services

- [Edge function client](https://github.com/kishore-in2007/memorystack/blob/main/lib/edgeFunctions.ts): `lib/edgeFunctions.ts`
- [Revision context API](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/get-revision-context/index.ts): `supabase/functions/get-revision-context/index.ts`
- [Review marker API](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/mark-revision-reviewed/index.ts): `supabase/functions/mark-revision-reviewed/index.ts`
- [Code execution API](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/run-code/index.ts): `supabase/functions/run-code/index.ts`
- [Solution submission API](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/submit-solution/index.ts): `supabase/functions/submit-solution/index.ts`
- [Search API](https://github.com/kishore-in2007/memorystack/blob/main/supabase/functions/search-problems/index.ts): `supabase/functions/search-problems/index.ts`

### Other components

- **Learner**
- **Supabase service**
- **Code judge**
- **AI provider**

## Connections

- Learner → Sign in / demo: signs in (evidence: `app/(auth)/login.tsx`)
- Sign in / demo → Persistent app state: sets user (evidence: `app/(auth)/login.tsx`)
- Sign in / demo → Daily dashboard: routes to
- Daily dashboard → Persistent app state: reads state (evidence: `app/(tabs)/index.tsx`)
- Daily dashboard → Due queue: opens queue (evidence: `app/(tabs)/index.tsx`)
- Daily dashboard → Review step: starts review (evidence: `app/(tabs)/index.tsx`)
- Daily dashboard → Offline revision cache: caches due items (evidence: `app/(tabs)/index.tsx`)
- Learner → Add problem: adds problem
- Add problem → Search hook: searches catalog
- Search hook → Problem search: requests matches (evidence: `hooks/useProblemSearch.ts`)
- Problem search → Search API: invokes search
- Search API → Supabase service: queries catalog
- Catalog sync → Supabase service: updates catalog
- Add problem → Persistent app state: records problem
- Persistent app state → Spaced repetition: generates schedule (evidence: `store/useStore.ts`)
- Learner → Review step: reviews work
- Review step → Revision context: loads context (evidence: `app/revision/[id]/review.tsx`)
- Revision context → Revision service: requests context (evidence: `hooks/useRevisionContext.ts`)
- Revision context → Offline revision cache: caches context (evidence: `hooks/useRevisionContext.ts`)
- Revision service → Edge function client: invokes API (evidence: `services/revisionService.ts`)
- Edge function client → Revision context API: dispatches context
- Edge function client → Review marker API: dispatches review
- Revision context API → Supabase service: loads revision data
- Review step → Saved solution card: renders solution (evidence: `app/revision/[id]/review.tsx`)
- Review step → Revision service: marks reviewed (evidence: `app/revision/[id]/review.tsx`)
- Review step → Practice step: continues to (evidence: `app/revision/[id]/review.tsx`)
- Practice step → Code editor: opens editor
- Code editor → Code drafts: saves draft
- Code editor → Submission service: runs or submits
- Submission service → Edge function client: invokes API (evidence: `services/compilerService.ts`)
- Edge function client → Code execution API: dispatches run
- Edge function client → Solution submission API: dispatches submission
- Code execution API → Code judge: executes tests
- Solution submission API → Code judge: evaluates solution
- Submission service → Persistent app state: completes revision (evidence: `services/compilerService.ts`)
- Persistent app state → Memory strength: updates strength (evidence: `store/useStore.ts`)
- Submission service → Offline revision cache: updates context (evidence: `services/compilerService.ts`)
- Code editor → Performance result: shows outcome
- Performance result → Persistent app state: reads performance
- Persistent app state → Memory analytics: supplies metrics
- Revision service → Practice recommendations: requests practice
- Practice recommendations → AI provider: uses classification
- App root → Review alerts: schedules alerts (evidence: `app/_layout.tsx`)
- App root → Persistent app state: reads due schedule (evidence: `app/_layout.tsx`)
- Review alerts → Review step: routes alert tap
