# iiateeneaaii/ngcourses architecture

> Architecture diagram of the GitHub repository iiateeneaaii/ngcourses, 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/iiateeneaaii/ngcourses
- Repository: https://github.com/iiateeneaaii/ngcourses

## Overview

NGcourses is a role-based online learning platform: learners discover courses, enroll or gain organizational access, consume lessons and quizzes, track progress, and earn certificates; admins, instructors, and supervisors manage courses and users. The graph follows the documented frontend-to-FastAPI-to-PostgreSQL architecture and the sampled backend route, CRUD, model, and integration references. Several frontend and backend route implementations were not sampled, so their internal calls are omitted; the payment connection is shown as unverified.

Main entry points: [`backend/app/api/main.py`](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/main.py) (API router), [`backend/app/crud.py`](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/crud.py) (Domain operations), [`backend/app/api/routes/cursos.py`](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/cursos.py) (Course catalog and authoring), [`backend/app/api/routes/certificados.py`](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/certificados.py) (Certificates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web["Role-based web app"]
  node_course_ui["Course learning UI"]
  node_frontend_api["API client<br/>[client.ts]"]
end

subgraph group_api["API and domains"]
  node_api_router["API router<br/>[main.py]"]
  node_auth["Authentication and roles<br/>[deps.py]"]
  node_course_routes["Course catalog and authoring<br/>[cursos.py]"]
  node_enrollment_routes["Enrollment and invitations<br/>[inscripciones.py]"]
  node_learning_routes["Progress, quizzes, ratings"]
  node_org_routes["Organizations and requests"]
  node_payment_routes["Payments<br/>[pagos.py]"]
  node_certificate_routes["Certificates<br/>[certificados.py]"]
  node_webhook_route["Video webhook<br/>[webhooks.py]"]
end

subgraph group_data["Persistence"]
  node_crud["Domain operations<br/>[crud.py]"]
  node_models["Learning and business models"]
  node_db["Database session<br/>[db.py]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_integrations["External services"]
  node_pdf["Certificate PDF generator<br/>[certificado_pdf.py]"]
  node_bunny_service["Bunny video service<br/>[bunny.py]"]
  node_paypal_service["PayPal service<br/>[paypal.py]"]
end

node_learners(("Learners and staff"))
node_bunny["Bunny.net Stream"]
node_paypal["PayPal"]

node_learners -->|"use"| node_web
node_web -.->|"request data"| node_frontend_api
node_frontend_api -.->|"call API"| node_api_router
node_api_router -->|"routes to"| node_course_routes
node_api_router -->|"routes to"| node_enrollment_routes
node_api_router -->|"routes to"| node_learning_routes
node_api_router -->|"routes to"| node_org_routes
node_api_router -->|"routes to"| node_payment_routes
node_api_router -->|"routes to"| node_certificate_routes
node_api_router -->|"routes to"| node_webhook_route
node_course_routes -->|"calls"| node_crud
node_enrollment_routes -->|"calls"| node_crud
node_certificate_routes -->|"calls"| node_crud
node_certificate_routes -->|"generates PDF"| node_pdf
node_crud -->|"generates certificate"| node_pdf
node_course_routes -->|"uses video service"| node_bunny_service
node_webhook_route -->|"updates video metadata"| node_bunny_service
node_bunny_service -.->|"manages video"| node_bunny
node_crud -->|"uses models"| node_models
node_db -->|"connects"| node_postgres
node_auth -->|"opens session"| node_db
node_auth -->|"loads user"| node_models
node_payment_routes -.->|"processes payments"| node_paypal_service
node_paypal_service -.->|"charges"| node_paypal

click node_web "https://github.com/iiateeneaaii/ngcourses/tree/main/frontend/src/app"
click node_course_ui "https://github.com/iiateeneaaii/ngcourses/tree/main/frontend/src/components/course"
click node_frontend_api "https://github.com/iiateeneaaii/ngcourses/blob/main/frontend/src/lib/api/client.ts"
click node_api_router "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/main.py"
click node_auth "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/deps.py"
click node_course_routes "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/cursos.py"
click node_enrollment_routes "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/inscripciones.py"
click node_learning_routes "https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/api/routes"
click node_org_routes "https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/api/routes"
click node_payment_routes "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/pagos.py"
click node_certificate_routes "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/certificados.py"
click node_webhook_route "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/webhooks.py"
click node_crud "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/crud.py"
click node_models "https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/models"
click node_db "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/core/db.py"
click node_pdf "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/certificado_pdf.py"
click node_bunny_service "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/bunny.py"
click node_paypal_service "https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/paypal.py"

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_course_ui,node_frontend_api toneBlue
class node_api_router,node_auth,node_course_routes,node_enrollment_routes,node_learning_routes,node_org_routes,node_payment_routes,node_certificate_routes,node_webhook_route toneAmber
class node_crud,node_models,node_db,node_postgres toneMint
class node_pdf,node_bunny_service,node_paypal_service toneRose
class node_learners,node_bunny,node_paypal toneIndigo
```

## Components

### Web experience

- [Role-based web app](https://github.com/iiateeneaaii/ngcourses/tree/main/frontend/src/app): `frontend/src/app`
- [Course learning UI](https://github.com/iiateeneaaii/ngcourses/tree/main/frontend/src/components/course): `frontend/src/components/course`
- [API client](https://github.com/iiateeneaaii/ngcourses/blob/main/frontend/src/lib/api/client.ts): `frontend/src/lib/api/client.ts`

### API and domains

- [API router](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/main.py): `backend/app/api/main.py`
- [Authentication and roles](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Course catalog and authoring](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/cursos.py): `backend/app/api/routes/cursos.py`
- [Enrollment and invitations](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/inscripciones.py): `backend/app/api/routes/inscripciones.py`
- [Progress, quizzes, ratings](https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Organizations and requests](https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Payments](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/pagos.py): `backend/app/api/routes/pagos.py`
- [Certificates](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/certificados.py): `backend/app/api/routes/certificados.py`
- [Video webhook](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/api/routes/webhooks.py): `backend/app/api/routes/webhooks.py`

### Persistence

- [Domain operations](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/crud.py): `backend/app/crud.py`
- [Learning and business models](https://github.com/iiateeneaaii/ngcourses/tree/main/backend/app/models): `backend/app/models`
- [Database session](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- **PostgreSQL**

### External services

- [Certificate PDF generator](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/certificado_pdf.py): `backend/app/services/certificado_pdf.py`
- [Bunny video service](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/bunny.py): `backend/app/services/bunny.py`
- [PayPal service](https://github.com/iiateeneaaii/ngcourses/blob/main/backend/app/services/paypal.py): `backend/app/services/paypal.py`

### Other components

- **Learners and staff**
- **Bunny.net Stream**
- **PayPal**

## Connections

- Learners and staff → Role-based web app: use (evidence: `README.md`)
- Role-based web app → API client: request data
- API client → API router: call API
- API router → Course catalog and authoring: routes to (evidence: `backend/app/api/main.py`)
- API router → Enrollment and invitations: routes to (evidence: `backend/app/api/main.py`)
- API router → Progress, quizzes, ratings: routes to (evidence: `backend/app/api/main.py`)
- API router → Organizations and requests: routes to (evidence: `backend/app/api/main.py`)
- API router → Payments: routes to (evidence: `backend/app/api/main.py`)
- API router → Certificates: routes to (evidence: `backend/app/api/main.py`)
- API router → Video webhook: routes to (evidence: `backend/app/api/main.py`)
- Course catalog and authoring → Domain operations: calls (evidence: `backend/app/api/routes/cursos.py`)
- Enrollment and invitations → Domain operations: calls (evidence: `backend/app/api/routes/inscripciones.py`)
- Certificates → Domain operations: calls (evidence: `backend/app/api/routes/certificados.py`)
- Certificates → Certificate PDF generator: generates PDF (evidence: `backend/app/api/routes/certificados.py`)
- Domain operations → Certificate PDF generator: generates certificate (evidence: `backend/app/crud.py`)
- Course catalog and authoring → Bunny video service: uses video service (evidence: `backend/app/api/routes/cursos.py`)
- Video webhook → Bunny video service: updates video metadata (evidence: `backend/app/api/routes/webhooks.py`)
- Bunny video service → Bunny.net Stream: manages video
- Domain operations → Learning and business models: uses models (evidence: `backend/app/crud.py`)
- Database session → PostgreSQL: connects (evidence: `backend/app/core/db.py`)
- Authentication and roles → Database session: opens session (evidence: `backend/app/api/deps.py`)
- Authentication and roles → Learning and business models: loads user (evidence: `backend/app/api/deps.py`)
- Payments → PayPal service: processes payments
- PayPal service → PayPal: charges
