# creatly/creatly-backend architecture

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

- Interactive diagram: https://gitdiagram.com/creatly/creatly-backend
- Repository: https://github.com/creatly/creatly-backend

## Overview

Creatly is a multi-tenant learning-management backend. Its principal workflow serves learner and administrator API requests, applies service-layer operations, and persists or retrieves school, course, learning, and commerce data. The tree and sampled wiring support the HTTP-to-service-to-repository structure, as well as configured payment, email, file-storage, and DNS integrations. Individual route and service implementations were not sampled, so finer-grained call relationships are intentionally omitted.

Main entry points: [`internal/service/service.go`](https://github.com/creatly/creatly-backend/blob/main/internal/service/service.go) (Service registry), [`internal/app/app.go`](https://github.com/creatly/creatly-backend/blob/main/internal/app/app.go) (Application wiring), [`internal/delivery/http/v1/handler.go`](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/handler.go) (API routing), [`internal/server/server.go`](https://github.com/creatly/creatly-backend/blob/main/internal/server/server.go) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_http["HTTP server<br/>[server.go]"]
  node_routes["API routing<br/>[handler.go]"]
  node_admin_routes["Admin endpoints<br/>[admins.go]"]
  node_student_routes["Student endpoints<br/>[students.go]"]
  node_course_routes["Course endpoints<br/>[courses.go]"]
  node_payment_routes["Payment callbacks<br/>[payment.go]"]
  node_app["Application wiring<br/>[app.go]"]
end

subgraph group_learning["Learning Platform"]
  node_services["Service registry<br/>[service.go]"]
  node_identity["Users and students<br/>[students.go]"]
  node_schools["Schools and settings<br/>[schools.go]"]
  node_courses["Courses and lessons<br/>[courses.go]"]
  node_modules["Modules and packages<br/>[modules.go]"]
  node_surveys["Surveys and progress<br/>[surveys.go]"]
  node_files["File uploads<br/>[files.go]"]
end

subgraph group_commerce["Commerce"]
  node_offers["Offers and codes<br/>[offers.go]"]
  node_orders["Orders and payments<br/>[orders.go]"]
end

subgraph group_infra["Persistence and Integrations"]
  node_repos["Domain repositories"]
  node_mongo[("MongoDB<br/>[mongodb.go]")]
  node_fondy["Fondy gateway<br/>[fondy.go]"]
  node_storage["Object storage<br/>[storage.go]"]
  node_smtp["SMTP email<br/>[smtp.go]"]
  node_dns["Cloudflare DNS<br/>[dns.go]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_http
node_app -->|"starts server"| node_http
node_http -->|"dispatches"| node_routes
node_routes -->|"routes requests"| node_admin_routes
node_routes -->|"routes requests"| node_student_routes
node_routes -->|"routes requests"| node_course_routes
node_routes -->|"routes callbacks"| node_payment_routes
node_app -->|"constructs"| node_services
node_routes -->|"handles through"| node_services
node_services -->|"wires services"| node_identity
node_services -->|"wires services"| node_schools
node_services -->|"wires services"| node_courses
node_services -->|"wires services"| node_modules
node_services -->|"wires services"| node_surveys
node_services -->|"wires services"| node_files
node_services -->|"wires services"| node_offers
node_services -->|"wires services"| node_orders
node_app -->|"constructs"| node_repos
node_services -->|"uses repositories"| node_repos
node_app -->|"connects"| node_mongo
node_repos -->|"persists data"| node_mongo
node_app -->|"configures"| node_storage
node_files -->|"uploads files"| node_storage
node_app -->|"configures"| node_smtp
node_app -->|"configures"| node_dns
node_app -.->|"configures provider"| node_fondy
node_orders -.->|"uses gateway"| node_fondy

click node_http "https://github.com/creatly/creatly-backend/blob/main/internal/server/server.go"
click node_routes "https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/handler.go"
click node_admin_routes "https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/admins.go"
click node_student_routes "https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/students.go"
click node_course_routes "https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/courses.go"
click node_payment_routes "https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/payment.go"
click node_app "https://github.com/creatly/creatly-backend/blob/main/internal/app/app.go"
click node_services "https://github.com/creatly/creatly-backend/blob/main/internal/service/service.go"
click node_identity "https://github.com/creatly/creatly-backend/blob/main/internal/service/students.go"
click node_schools "https://github.com/creatly/creatly-backend/blob/main/internal/service/schools.go"
click node_courses "https://github.com/creatly/creatly-backend/blob/main/internal/service/courses.go"
click node_modules "https://github.com/creatly/creatly-backend/blob/main/internal/service/modules.go"
click node_surveys "https://github.com/creatly/creatly-backend/blob/main/internal/service/surveys.go"
click node_files "https://github.com/creatly/creatly-backend/blob/main/internal/service/files.go"
click node_offers "https://github.com/creatly/creatly-backend/blob/main/internal/service/offers.go"
click node_orders "https://github.com/creatly/creatly-backend/blob/main/internal/service/orders.go"
click node_repos "https://github.com/creatly/creatly-backend/tree/main/internal/repository"
click node_mongo "https://github.com/creatly/creatly-backend/blob/main/pkg/database/mongodb/mongodb.go"
click node_fondy "https://github.com/creatly/creatly-backend/blob/main/pkg/payment/fondy/fondy.go"
click node_storage "https://github.com/creatly/creatly-backend/blob/main/pkg/storage/storage.go"
click node_smtp "https://github.com/creatly/creatly-backend/blob/main/pkg/email/smtp/smtp.go"
click node_dns "https://github.com/creatly/creatly-backend/blob/main/pkg/dns/dns.go"

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_http,node_routes,node_admin_routes,node_student_routes,node_course_routes,node_payment_routes,node_app,node_client toneBlue
class node_services,node_identity,node_schools,node_courses,node_modules,node_surveys,node_files toneAmber
class node_offers,node_orders toneMint
class node_repos,node_mongo,node_fondy,node_storage,node_smtp,node_dns toneRose
```

## Components

### HTTP API

- [HTTP server](https://github.com/creatly/creatly-backend/blob/main/internal/server/server.go): `internal/server/server.go`
- [API routing](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/handler.go): `internal/delivery/http/v1/handler.go`
- [Admin endpoints](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/admins.go): `internal/delivery/http/v1/admins.go`
- [Student endpoints](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/students.go): `internal/delivery/http/v1/students.go`
- [Course endpoints](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/courses.go): `internal/delivery/http/v1/courses.go`
- [Payment callbacks](https://github.com/creatly/creatly-backend/blob/main/internal/delivery/http/v1/payment.go): `internal/delivery/http/v1/payment.go`
- [Application wiring](https://github.com/creatly/creatly-backend/blob/main/internal/app/app.go): `internal/app/app.go`

### Learning Platform

- [Service registry](https://github.com/creatly/creatly-backend/blob/main/internal/service/service.go): `internal/service/service.go`
- [Users and students](https://github.com/creatly/creatly-backend/blob/main/internal/service/students.go): `internal/service/students.go`
- [Schools and settings](https://github.com/creatly/creatly-backend/blob/main/internal/service/schools.go): `internal/service/schools.go`
- [Courses and lessons](https://github.com/creatly/creatly-backend/blob/main/internal/service/courses.go): `internal/service/courses.go`
- [Modules and packages](https://github.com/creatly/creatly-backend/blob/main/internal/service/modules.go): `internal/service/modules.go`
- [Surveys and progress](https://github.com/creatly/creatly-backend/blob/main/internal/service/surveys.go): `internal/service/surveys.go`
- [File uploads](https://github.com/creatly/creatly-backend/blob/main/internal/service/files.go): `internal/service/files.go`

### Commerce

- [Offers and codes](https://github.com/creatly/creatly-backend/blob/main/internal/service/offers.go): `internal/service/offers.go`
- [Orders and payments](https://github.com/creatly/creatly-backend/blob/main/internal/service/orders.go): `internal/service/orders.go`

### Persistence and Integrations

- [Domain repositories](https://github.com/creatly/creatly-backend/tree/main/internal/repository): `internal/repository`
- [MongoDB](https://github.com/creatly/creatly-backend/blob/main/pkg/database/mongodb/mongodb.go): `pkg/database/mongodb/mongodb.go`
- [Fondy gateway](https://github.com/creatly/creatly-backend/blob/main/pkg/payment/fondy/fondy.go): `pkg/payment/fondy/fondy.go`
- [Object storage](https://github.com/creatly/creatly-backend/blob/main/pkg/storage/storage.go): `pkg/storage/storage.go`
- [SMTP email](https://github.com/creatly/creatly-backend/blob/main/pkg/email/smtp/smtp.go): `pkg/email/smtp/smtp.go`
- [Cloudflare DNS](https://github.com/creatly/creatly-backend/blob/main/pkg/dns/dns.go): `pkg/dns/dns.go`

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests
- Application wiring → HTTP server: starts server
- HTTP server → API routing: dispatches
- API routing → Admin endpoints: routes requests
- API routing → Student endpoints: routes requests
- API routing → Course endpoints: routes requests
- API routing → Payment callbacks: routes callbacks
- Application wiring → Service registry: constructs
- API routing → Service registry: handles through
- Service registry → Users and students: wires services
- Service registry → Schools and settings: wires services
- Service registry → Courses and lessons: wires services
- Service registry → Modules and packages: wires services
- Service registry → Surveys and progress: wires services
- Service registry → File uploads: wires services
- Service registry → Offers and codes: wires services
- Service registry → Orders and payments: wires services
- Application wiring → Domain repositories: constructs
- Service registry → Domain repositories: uses repositories
- Application wiring → MongoDB: connects
- Domain repositories → MongoDB: persists data
- Application wiring → Object storage: configures
- File uploads → Object storage: uploads files
- Application wiring → SMTP email: configures
- Application wiring → Cloudflare DNS: configures
- Application wiring → Fondy gateway: configures provider
- Orders and payments → Fondy gateway: uses gateway
