# victormbojorquez/capu architecture

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

- Interactive diagram: https://gitdiagram.com/victormbojorquez/capu
- Repository: https://github.com/victormbojorquez/capu
- Video tour (about a minute): https://gitdiagram.com/victormbojorquez/capu/video

## Overview

CAPU is a student agenda with Google Classroom synchronization, deadline alerts and reminders, and token-based rewards. The main workflow is: a student connects Google or uses demo data, requests synchronization, reviews courses and tasks, tracks or completes work, and earns tokens to redeem rewards. Authentication, administration, notifications, and metrics are additional capabilities. Edges reflect the sampled app, server, and service references plus README-documented API behavior; unsampled implementation details are not inferred.

Main entry points: [`backend/src/app.js`](https://github.com/victormbojorquez/capu/blob/main/backend/src/app.js) (HTTP API), [`backend/src/server.js`](https://github.com/victormbojorquez/capu/blob/main/backend/src/server.js) (Server runtime), [`backend/src/db.js`](https://github.com/victormbojorquez/capu/blob/main/backend/src/db.js) (SQLite database), [`backend/src/services/auth.js`](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/auth.js) (Account auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student interface"]
  node_web["Web app<br/>[app.js]"]
  node_api["HTTP API<br/>[app.js]"]
  node_server["Server runtime<br/>[server.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Account auth<br/>[auth.js]"]
  node_oauth["Google OAuth<br/>[oauth.js]"]
  node_jwt["JWT access<br/>[jwt.js]"]
  node_profile["User profile<br/>[usuario.js]"]
end

subgraph group_agenda["Agenda and Classroom"]
  node_google["Classroom adapter<br/>[google.js]"]
  node_mock["Demo adapter<br/>[mock.js]"]
  node_sync["Course sync<br/>[sync.js]"]
  node_tasks["Task management<br/>[tareas.js]"]
end

subgraph group_engagement["Reminders and rewards"]
  node_alerts["Deadline alerts<br/>[alertas.js]"]
  node_reminders["Reminder scheduling<br/>[reminders.js]"]
  node_tokens["Token rewards<br/>[tokens.js]"]
  node_notifications["Notifications<br/>[notificaciones.js]"]
  node_email["Email delivery<br/>[email.js]"]
end

subgraph group_operations["Administration"]
  node_admin["Admin operations<br/>[admin.js]"]
  node_database[("SQLite database<br/>[db.js]")]
  node_schema["Relational schema<br/>[schema.sql]"]
end

node_student(("Student"))
node_google_service["Google Classroom"]

node_student -->|"uses"| node_web
node_web -->|"calls API"| node_api
node_server -->|"creates"| node_api
node_api -->|"opens"| node_database
node_api -->|"routes auth"| node_auth
node_api -->|"routes OAuth"| node_oauth
node_api -->|"authenticates via"| node_jwt
node_auth -->|"issues tokens"| node_jwt
node_auth -->|"sends mail"| node_email
node_oauth -->|"requests OAuth"| node_google_service
node_api -->|"routes sync"| node_sync
node_server -->|"schedules sync"| node_sync
node_server -->|"gets credential"| node_oauth
node_server -->|"selects adapter"| node_google
node_server -->|"selects fallback"| node_mock
node_google -->|"fetches courses"| node_google_service
node_sync -->|"stores sync"| node_database
node_api -->|"routes tasks"| node_tasks
node_api -->|"routes alerts"| node_alerts
node_api -->|"routes reminders"| node_reminders
node_server -->|"schedules reminders"| node_reminders
node_api -->|"routes rewards"| node_tokens
node_api -->|"routes notifications"| node_notifications
node_api -->|"routes profile"| node_profile
node_api -->|"routes admin"| node_admin
node_auth -.->|"reads/writes users"| node_database
node_oauth -->|"stores credentials"| node_database
node_schema -->|"defines tables"| node_database

click node_web "https://github.com/victormbojorquez/capu/blob/main/frontend/app.js"
click node_api "https://github.com/victormbojorquez/capu/blob/main/backend/src/app.js"
click node_server "https://github.com/victormbojorquez/capu/blob/main/backend/src/server.js"
click node_auth "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/auth.js"
click node_oauth "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/oauth.js"
click node_jwt "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/jwt.js"
click node_google "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/classroom/google.js"
click node_mock "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/classroom/mock.js"
click node_sync "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/sync.js"
click node_tasks "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/tareas.js"
click node_alerts "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/alertas.js"
click node_reminders "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/reminders.js"
click node_tokens "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/tokens.js"
click node_notifications "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/notificaciones.js"
click node_email "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/email.js"
click node_admin "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/admin.js"
click node_profile "https://github.com/victormbojorquez/capu/blob/main/backend/src/services/usuario.js"
click node_database "https://github.com/victormbojorquez/capu/blob/main/backend/src/db.js"
click node_schema "https://github.com/victormbojorquez/capu/blob/main/database/schema.sql"

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_web,node_api,node_server toneBlue
class node_auth,node_oauth,node_jwt,node_profile toneAmber
class node_google,node_mock,node_sync,node_tasks toneMint
class node_alerts,node_reminders,node_tokens,node_notifications,node_email toneRose
class node_admin,node_database,node_schema,node_student,node_google_service toneIndigo
```

## Components

### Student interface

- [Web app](https://github.com/victormbojorquez/capu/blob/main/frontend/app.js): `frontend/app.js`
- [HTTP API](https://github.com/victormbojorquez/capu/blob/main/backend/src/app.js): `backend/src/app.js`
- [Server runtime](https://github.com/victormbojorquez/capu/blob/main/backend/src/server.js): `backend/src/server.js`

### Identity and access

- [Account auth](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/auth.js): `backend/src/services/auth.js`
- [Google OAuth](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/oauth.js): `backend/src/services/oauth.js`
- [JWT access](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/jwt.js): `backend/src/services/jwt.js`
- [User profile](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/usuario.js): `backend/src/services/usuario.js`

### Agenda and Classroom

- [Classroom adapter](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/classroom/google.js): `backend/src/services/classroom/google.js`
- [Demo adapter](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/classroom/mock.js): `backend/src/services/classroom/mock.js`
- [Course sync](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/sync.js): `backend/src/services/sync.js`
- [Task management](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/tareas.js): `backend/src/services/tareas.js`

### Reminders and rewards

- [Deadline alerts](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/alertas.js): `backend/src/services/alertas.js`
- [Reminder scheduling](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/reminders.js): `backend/src/services/reminders.js`
- [Token rewards](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/tokens.js): `backend/src/services/tokens.js`
- [Notifications](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/notificaciones.js): `backend/src/services/notificaciones.js`
- [Email delivery](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/email.js): `backend/src/services/email.js`

### Administration

- [Admin operations](https://github.com/victormbojorquez/capu/blob/main/backend/src/services/admin.js): `backend/src/services/admin.js`
- [SQLite database](https://github.com/victormbojorquez/capu/blob/main/backend/src/db.js): `backend/src/db.js`
- [Relational schema](https://github.com/victormbojorquez/capu/blob/main/database/schema.sql): `database/schema.sql`

### Other components

- **Student**
- **Google Classroom**

## Connections

- Student → Web app: uses (evidence: `README.md`)
- Web app → HTTP API: calls API (evidence: `README.md`)
- Server runtime → HTTP API: creates (evidence: `backend/src/server.js`)
- HTTP API → SQLite database: opens (evidence: `backend/src/app.js`)
- HTTP API → Account auth: routes auth (evidence: `backend/src/app.js`)
- HTTP API → Google OAuth: routes OAuth (evidence: `backend/src/app.js`)
- HTTP API → JWT access: authenticates via (evidence: `backend/src/app.js`)
- Account auth → JWT access: issues tokens (evidence: `backend/src/services/auth.js`)
- Account auth → Email delivery: sends mail (evidence: `backend/src/services/auth.js`)
- Google OAuth → Google Classroom: requests OAuth (evidence: `backend/src/services/oauth.js`)
- HTTP API → Course sync: routes sync (evidence: `backend/src/app.js`)
- Server runtime → Course sync: schedules sync (evidence: `backend/src/server.js`)
- Server runtime → Google OAuth: gets credential (evidence: `backend/src/server.js`)
- Server runtime → Classroom adapter: selects adapter (evidence: `backend/src/server.js`)
- Server runtime → Demo adapter: selects fallback (evidence: `backend/src/server.js`)
- Classroom adapter → Google Classroom: fetches courses (evidence: `backend/src/services/classroom/google.js`)
- Course sync → SQLite database: stores sync (evidence: `backend/src/services/sync.js`)
- HTTP API → Task management: routes tasks (evidence: `backend/src/app.js`)
- HTTP API → Deadline alerts: routes alerts (evidence: `backend/src/app.js`)
- HTTP API → Reminder scheduling: routes reminders (evidence: `backend/src/app.js`)
- Server runtime → Reminder scheduling: schedules reminders (evidence: `backend/src/server.js`)
- HTTP API → Token rewards: routes rewards (evidence: `backend/src/app.js`)
- HTTP API → Notifications: routes notifications (evidence: `backend/src/app.js`)
- HTTP API → User profile: routes profile (evidence: `backend/src/app.js`)
- HTTP API → Admin operations: routes admin (evidence: `backend/src/app.js`)
- Account auth → SQLite database: reads/writes users
- Google OAuth → SQLite database: stores credentials (evidence: `backend/src/services/oauth.js`)
- Relational schema → SQLite database: defines tables (evidence: `backend/src/db.js`)
