# se1-flux/prepify architecture

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

- Interactive diagram: https://gitdiagram.com/se1-flux/prepify
- Repository: https://github.com/se1-flux/prepify

## Overview

Prepify is a study platform whose main workflow is: a learner opens the web app, uploads study material, and receives AI-generated study content to review or use in The Dive. The server extracts PDF text, requests a study pack, and saves materials when MongoDB is available; the app also supports account flows and game-score leaderboards. The README describes broader multiplayer and real-time features, but the sampled tree does not show their implementation, so they are not mapped as runtime components.

Main entry points: [`client/src/services/api.js`](https://github.com/se1-flux/prepify/blob/main/client/src/services/api.js) (API client), [`client/src/pages/LandingPage.jsx`](https://github.com/se1-flux/prepify/blob/main/client/src/pages/LandingPage.jsx) (Landing experience), [`server/server.js`](https://github.com/se1-flux/prepify/blob/main/server/server.js) (Express API), [`server/routes/materialRoutes.js`](https://github.com/se1-flux/prepify/blob/main/server/routes/materialRoutes.js) (Material workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App and routes<br/>[App.jsx]"]
  node_landing["Landing experience<br/>[LandingPage.jsx]"]
  node_upload["Material upload<br/>[UploadModal.jsx]"]
  node_studyview["Study viewer<br/>[StudyViewModal.jsx]"]
  node_dive["Dive game"]
  node_toolkit["Study toolkit<br/>[StudyToolkit.jsx]"]
  node_authpages["Account and onboarding"]
  node_authlayout["Auth presentation<br/>[AuthLayout.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_server["API and workflows"]
  node_express["Express API<br/>[server.js]"]
  node_materials["Material workflow<br/>[materialRoutes.js]"]
  node_auth["Auth routes<br/>[authRoutes.js]"]
  node_game["Game routes<br/>[gameRoutes.js]"]
end

subgraph group_services["Study services"]
  node_pdf["PDF extraction<br/>[pdfService.js]"]
  node_gemini["Study-pack generation<br/>[geminiService.js]"]
end

subgraph group_storage["Persistence"]
  node_dbconfig["Database connection<br/>[db.js]"]
  node_studydata[("Study materials<br/>[StudyMaterial.js]")]
  node_userdata[("User records<br/>[User.js]")]
  node_scores[("High scores<br/>[HighScore.js]")]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_landing -->|"opens"| node_upload
node_landing -->|"renders"| node_studyview
node_landing -->|"renders"| node_toolkit
node_landing -->|"renders"| node_dive
node_app -->|"checks health"| node_api_client
node_app -->|"loads demo"| node_api_client
node_upload -->|"uploads"| node_api_client
node_dive -->|"scores game"| node_api_client
node_authpages -->|"uses"| node_authlayout
node_authpages -->|"calls auth"| node_api_client
node_api_client -->|"requests API"| node_express
node_express -->|"mounts"| node_materials
node_express -->|"mounts"| node_game
node_express -->|"mounts"| node_auth
node_express -->|"connects"| node_dbconfig
node_materials -->|"extracts text"| node_pdf
node_materials -->|"generates pack"| node_gemini
node_materials -->|"stores materials"| node_studydata
node_materials -->|"checks status"| node_dbconfig
node_auth -->|"reads and updates"| node_userdata
node_auth -->|"checks status"| node_dbconfig
node_game -->|"reads and writes"| node_scores
node_game -->|"checks status"| node_dbconfig

click node_app "https://github.com/se1-flux/prepify/blob/main/client/src/App.jsx"
click node_landing "https://github.com/se1-flux/prepify/blob/main/client/src/pages/LandingPage.jsx"
click node_upload "https://github.com/se1-flux/prepify/blob/main/client/src/components/UploadModal.jsx"
click node_studyview "https://github.com/se1-flux/prepify/blob/main/client/src/components/StudyViewModal.jsx"
click node_dive "https://github.com/se1-flux/prepify/blob/main/client/src/components/DiveGameSection.jsx"
click node_toolkit "https://github.com/se1-flux/prepify/blob/main/client/src/components/StudyToolkit.jsx"
click node_authpages "https://github.com/se1-flux/prepify/tree/main/client/src/pages"
click node_authlayout "https://github.com/se1-flux/prepify/blob/main/client/src/components/auth/AuthLayout.jsx"
click node_api_client "https://github.com/se1-flux/prepify/blob/main/client/src/services/api.js"
click node_express "https://github.com/se1-flux/prepify/blob/main/server/server.js"
click node_materials "https://github.com/se1-flux/prepify/blob/main/server/routes/materialRoutes.js"
click node_auth "https://github.com/se1-flux/prepify/blob/main/server/routes/authRoutes.js"
click node_game "https://github.com/se1-flux/prepify/blob/main/server/routes/gameRoutes.js"
click node_pdf "https://github.com/se1-flux/prepify/blob/main/server/services/pdfService.js"
click node_gemini "https://github.com/se1-flux/prepify/blob/main/server/services/geminiService.js"
click node_dbconfig "https://github.com/se1-flux/prepify/blob/main/server/config/db.js"
click node_studydata "https://github.com/se1-flux/prepify/blob/main/server/models/StudyMaterial.js"
click node_userdata "https://github.com/se1-flux/prepify/blob/main/server/models/User.js"
click node_scores "https://github.com/se1-flux/prepify/blob/main/server/models/HighScore.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_app,node_landing,node_upload,node_studyview,node_dive,node_toolkit,node_authpages,node_authlayout,node_api_client toneBlue
class node_express,node_materials,node_auth,node_game toneAmber
class node_pdf,node_gemini toneMint
class node_dbconfig,node_studydata,node_userdata,node_scores toneRose
class node_learner toneIndigo
```

## Components

### Web application

- [App and routes](https://github.com/se1-flux/prepify/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Landing experience](https://github.com/se1-flux/prepify/blob/main/client/src/pages/LandingPage.jsx): `client/src/pages/LandingPage.jsx`
- [Material upload](https://github.com/se1-flux/prepify/blob/main/client/src/components/UploadModal.jsx): `client/src/components/UploadModal.jsx`
- [Study viewer](https://github.com/se1-flux/prepify/blob/main/client/src/components/StudyViewModal.jsx): `client/src/components/StudyViewModal.jsx`
- [Dive game](https://github.com/se1-flux/prepify/blob/main/client/src/components/DiveGameSection.jsx): `client/src/components/DiveGameSection.jsx`
- [Study toolkit](https://github.com/se1-flux/prepify/blob/main/client/src/components/StudyToolkit.jsx): `client/src/components/StudyToolkit.jsx`
- [Account and onboarding](https://github.com/se1-flux/prepify/tree/main/client/src/pages): `client/src/pages`
- [Auth presentation](https://github.com/se1-flux/prepify/blob/main/client/src/components/auth/AuthLayout.jsx): `client/src/components/auth/AuthLayout.jsx`
- [API client](https://github.com/se1-flux/prepify/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API and workflows

- [Express API](https://github.com/se1-flux/prepify/blob/main/server/server.js): `server/server.js`
- [Material workflow](https://github.com/se1-flux/prepify/blob/main/server/routes/materialRoutes.js): `server/routes/materialRoutes.js`
- [Auth routes](https://github.com/se1-flux/prepify/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Game routes](https://github.com/se1-flux/prepify/blob/main/server/routes/gameRoutes.js): `server/routes/gameRoutes.js`

### Study services

- [PDF extraction](https://github.com/se1-flux/prepify/blob/main/server/services/pdfService.js): `server/services/pdfService.js`
- [Study-pack generation](https://github.com/se1-flux/prepify/blob/main/server/services/geminiService.js): `server/services/geminiService.js`

### Persistence

- [Database connection](https://github.com/se1-flux/prepify/blob/main/server/config/db.js): `server/config/db.js`
- [Study materials](https://github.com/se1-flux/prepify/blob/main/server/models/StudyMaterial.js): `server/models/StudyMaterial.js`
- [User records](https://github.com/se1-flux/prepify/blob/main/server/models/User.js): `server/models/User.js`
- [High scores](https://github.com/se1-flux/prepify/blob/main/server/models/HighScore.js): `server/models/HighScore.js`

### Other components

- **Learner**

## Connections

- Learner → App and routes: uses (evidence: `README.md`)
- App and routes → Landing experience: routes to (evidence: `client/src/App.jsx`)
- Landing experience → Material upload: opens (evidence: `client/src/pages/LandingPage.jsx`)
- Landing experience → Study viewer: renders (evidence: `client/src/pages/LandingPage.jsx`)
- Landing experience → Study toolkit: renders (evidence: `client/src/pages/LandingPage.jsx`)
- Landing experience → Dive game: renders (evidence: `client/src/pages/LandingPage.jsx`)
- App and routes → API client: checks health (evidence: `client/src/App.jsx`)
- App and routes → API client: loads demo (evidence: `client/src/App.jsx`)
- Material upload → API client: uploads (evidence: `client/src/components/UploadModal.jsx`)
- Dive game → API client: scores game (evidence: `client/src/components/DiveGameSection.jsx`)
- Account and onboarding → Auth presentation: uses (evidence: `client/src/pages/CreateAccountPage.jsx`)
- Account and onboarding → API client: calls auth (evidence: `client/src/pages/CreateAccountPage.jsx`)
- API client → Express API: requests API (evidence: `README.md`)
- Express API → Material workflow: mounts (evidence: `server/server.js`)
- Express API → Game routes: mounts (evidence: `server/server.js`)
- Express API → Auth routes: mounts (evidence: `server/server.js`)
- Express API → Database connection: connects (evidence: `server/server.js`)
- Material workflow → PDF extraction: extracts text (evidence: `server/routes/materialRoutes.js`)
- Material workflow → Study-pack generation: generates pack (evidence: `server/routes/materialRoutes.js`)
- Material workflow → Study materials: stores materials (evidence: `server/routes/materialRoutes.js`)
- Material workflow → Database connection: checks status (evidence: `server/routes/materialRoutes.js`)
- Auth routes → User records: reads and updates (evidence: `server/routes/authRoutes.js`)
- Auth routes → Database connection: checks status (evidence: `server/routes/authRoutes.js`)
- Game routes → High scores: reads and writes (evidence: `server/routes/gameRoutes.js`)
- Game routes → Database connection: checks status (evidence: `server/routes/gameRoutes.js`)
