# sofidascanio/repaso architecture

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

- Interactive diagram: https://gitdiagram.com/sofidascanio/repaso
- Repository: https://github.com/sofidascanio/repaso

## Overview

Repaso is a flashcard study platform. Users authenticate, organize material through workspaces, projects, and collections, then study cards and record reviews; the API calculates spaced-repetition schedules and supports progress, search, profile, and import/export features. The web client and NestJS API communicate over HTTP/REST, with Prisma and PostgreSQL behind the API. Edges between sampled controllers and services are visible in excerpts; broader feature flows and persistence links rely on README documentation, so they are shown only at that documented level.

Main entry points: [`web/src/lib`](https://github.com/sofidascanio/repaso/tree/main/web/src/lib) (API clients), [`api/src/prisma/prisma.service.ts`](https://github.com/sofidascanio/repaso/blob/main/api/src/prisma/prisma.service.ts) (PostgreSQL), [`api/src/review/review.service.ts`](https://github.com/sofidascanio/repaso/blob/main/api/src/review/review.service.ts) (Review scheduling), [`web/src/app`](https://github.com/sofidascanio/repaso/tree/main/web/src/app) (Next.js app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Next.js app"]
  node_authui["Login and register"]
  node_libraryui["Library navigation"]
  node_studyui["Study mode<br/>[page.tsx]"]
  node_webclients["API clients"]
  node_pwa["Offline PWA"]
end

subgraph group_api["API services"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_search["Global search<br/>[search.service.ts]"]
  node_importexport["Import and export"]
  node_profile["Profile management<br/>[profile.service.ts]"]
end

subgraph group_study["Study and progress"]
  node_review["Review scheduling<br/>[review.service.ts]"]
  node_sm2["SM-2 algorithm<br/>[sm2.service.ts]"]
  node_stats["Progress statistics<br/>[stats.service.ts]"]
end

subgraph group_content["Learning content"]
  node_workspace["Workspaces"]
  node_project["Projects<br/>[project.service.ts]"]
  node_collection["Collections"]
  node_flashcard["Flashcards"]
end

subgraph group_storage["Persistence"]
  node_database[("PostgreSQL<br/>[prisma.service.ts]")]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_webapp
node_webapp -->|"offers sign-in"| node_authui
node_webapp -->|"navigates content"| node_libraryui
node_libraryui -->|"opens study"| node_studyui
node_authui -.->|"requests auth"| node_webclients
node_studyui -->|"submits reviews"| node_webclients
node_webclients -.->|"HTTP/REST"| node_auth
node_webclients -.->|"HTTP/REST"| node_workspace
node_webclients -.->|"HTTP/REST"| node_project
node_webclients -.->|"HTTP/REST"| node_collection
node_webclients -.->|"HTTP/REST"| node_flashcard
node_webclients -->|"HTTP/REST"| node_review
node_webclients -.->|"HTTP/REST"| node_stats
node_webclients -.->|"HTTP/REST"| node_search
node_webclients -.->|"HTTP/REST"| node_importexport
node_webclients -->|"HTTP/REST"| node_profile
node_review -->|"calculates schedule"| node_sm2
node_review -->|"checks ownership"| node_flashcard
node_review -->|"validates collection"| node_collection
node_collection -.->|"persists content"| node_database
node_flashcard -.->|"persists cards"| node_database
node_review -->|"stores review logs"| node_database
node_auth -->|"stores credentials"| node_database
node_stats -.->|"reads progress"| node_database
node_search -.->|"searches content"| node_database
node_importexport -.->|"transfers cards"| node_database
node_profile -.->|"updates account"| node_database
node_webapp -.->|"supports offline"| node_pwa

click node_webapp "https://github.com/sofidascanio/repaso/tree/main/web/src/app"
click node_authui "https://github.com/sofidascanio/repaso/tree/main/web/src/app/(auth)"
click node_libraryui "https://github.com/sofidascanio/repaso/tree/main/web/src/app/(protected)/library"
click node_studyui "https://github.com/sofidascanio/repaso/blob/main/web/src/app/(protected)/study/%5BcollectionId%5D/page.tsx"
click node_webclients "https://github.com/sofidascanio/repaso/tree/main/web/src/lib"
click node_auth "https://github.com/sofidascanio/repaso/blob/main/api/src/auth/auth.service.ts"
click node_workspace "https://github.com/sofidascanio/repaso/tree/main/api/src/workspace"
click node_project "https://github.com/sofidascanio/repaso/blob/main/api/src/project/project.service.ts"
click node_collection "https://github.com/sofidascanio/repaso/blob/main/api/src/collection/collection.service.ts"
click node_flashcard "https://github.com/sofidascanio/repaso/blob/main/api/src/flashcard/flashcard.service.ts"
click node_review "https://github.com/sofidascanio/repaso/blob/main/api/src/review/review.service.ts"
click node_sm2 "https://github.com/sofidascanio/repaso/blob/main/api/src/review/sm2.service.ts"
click node_stats "https://github.com/sofidascanio/repaso/blob/main/api/src/stats/stats.service.ts"
click node_search "https://github.com/sofidascanio/repaso/blob/main/api/src/search/search.service.ts"
click node_importexport "https://github.com/sofidascanio/repaso/blob/main/api/src/import-export/import-export.service.ts"
click node_profile "https://github.com/sofidascanio/repaso/blob/main/api/src/profile/profile.service.ts"
click node_database "https://github.com/sofidascanio/repaso/blob/main/api/src/prisma/prisma.service.ts"
click node_pwa "https://github.com/sofidascanio/repaso/blob/main/web/public/swe-worker-5c72df51bb1f6ee0.js"

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_webapp,node_authui,node_libraryui,node_studyui,node_webclients,node_pwa toneBlue
class node_auth,node_search,node_importexport,node_profile toneAmber
class node_review,node_sm2,node_stats toneMint
class node_workspace,node_project,node_collection,node_flashcard toneRose
class node_database,node_learner toneIndigo
```

## Components

### Web experience

- [Next.js app](https://github.com/sofidascanio/repaso/tree/main/web/src/app): `web/src/app`
- [Login and register](https://github.com/sofidascanio/repaso/tree/main/web/src/app/(auth)): `web/src/app/(auth)`
- [Library navigation](https://github.com/sofidascanio/repaso/tree/main/web/src/app/(protected)/library): `web/src/app/(protected)/library`
- [Study mode](https://github.com/sofidascanio/repaso/blob/main/web/src/app/(protected)/study/%5BcollectionId%5D/page.tsx): `web/src/app/(protected)/study/[collectionId]/page.tsx`
- [API clients](https://github.com/sofidascanio/repaso/tree/main/web/src/lib): `web/src/lib`
- [Offline PWA](https://github.com/sofidascanio/repaso/blob/main/web/public/swe-worker-5c72df51bb1f6ee0.js): `web/public/swe-worker-5c72df51bb1f6ee0.js`

### API services

- [Authentication](https://github.com/sofidascanio/repaso/blob/main/api/src/auth/auth.service.ts): `api/src/auth/auth.service.ts`
- [Global search](https://github.com/sofidascanio/repaso/blob/main/api/src/search/search.service.ts): `api/src/search/search.service.ts`
- [Import and export](https://github.com/sofidascanio/repaso/blob/main/api/src/import-export/import-export.service.ts): `api/src/import-export/import-export.service.ts`
- [Profile management](https://github.com/sofidascanio/repaso/blob/main/api/src/profile/profile.service.ts): `api/src/profile/profile.service.ts`

### Study and progress

- [Review scheduling](https://github.com/sofidascanio/repaso/blob/main/api/src/review/review.service.ts): `api/src/review/review.service.ts`
- [SM-2 algorithm](https://github.com/sofidascanio/repaso/blob/main/api/src/review/sm2.service.ts): `api/src/review/sm2.service.ts`
- [Progress statistics](https://github.com/sofidascanio/repaso/blob/main/api/src/stats/stats.service.ts): `api/src/stats/stats.service.ts`

### Learning content

- [Workspaces](https://github.com/sofidascanio/repaso/tree/main/api/src/workspace): `api/src/workspace`
- [Projects](https://github.com/sofidascanio/repaso/blob/main/api/src/project/project.service.ts): `api/src/project/project.service.ts`
- [Collections](https://github.com/sofidascanio/repaso/blob/main/api/src/collection/collection.service.ts): `api/src/collection/collection.service.ts`
- [Flashcards](https://github.com/sofidascanio/repaso/blob/main/api/src/flashcard/flashcard.service.ts): `api/src/flashcard/flashcard.service.ts`

### Persistence

- [PostgreSQL](https://github.com/sofidascanio/repaso/blob/main/api/src/prisma/prisma.service.ts): `api/src/prisma/prisma.service.ts`

### Other components

- **Learner**

## Connections

- Learner → Next.js app: uses
- Next.js app → Login and register: offers sign-in
- Next.js app → Library navigation: navigates content (evidence: `web/src/app/(protected)/library/page.tsx`)
- Library navigation → Study mode: opens study
- Login and register → API clients: requests auth
- Study mode → API clients: submits reviews (evidence: `web/src/lib/reviews.ts`)
- API clients → Authentication: HTTP/REST
- API clients → Workspaces: HTTP/REST
- API clients → Projects: HTTP/REST
- API clients → Collections: HTTP/REST
- API clients → Flashcards: HTTP/REST
- API clients → Review scheduling: HTTP/REST (evidence: `web/src/lib/reviews.ts`)
- API clients → Progress statistics: HTTP/REST
- API clients → Global search: HTTP/REST
- API clients → Import and export: HTTP/REST
- API clients → Profile management: HTTP/REST
- Review scheduling → SM-2 algorithm: calculates schedule (evidence: `api/src/review/review.service.ts`)
- Review scheduling → Flashcards: checks ownership (evidence: `api/src/review/review.service.ts`)
- Review scheduling → Collections: validates collection (evidence: `api/src/review/review.service.ts`)
- Collections → PostgreSQL: persists content
- Flashcards → PostgreSQL: persists cards
- Review scheduling → PostgreSQL: stores review logs (evidence: `api/src/review/review.service.ts`)
- Authentication → PostgreSQL: stores credentials (evidence: `api/src/auth/auth.service.ts`)
- Progress statistics → PostgreSQL: reads progress
- Global search → PostgreSQL: searches content
- Import and export → PostgreSQL: transfers cards
- Profile management → PostgreSQL: updates account
- Next.js app → Offline PWA: supports offline
