# suitenumerique/drive architecture

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

- Interactive diagram: https://gitdiagram.com/suitenumerique/drive
- Repository: https://github.com/suitenumerique/drive

## Overview

##### Project type and purpose
- This is a full-stack, self-hosted collaborative file-sharing web application.
- Frontend: Next.js/React (src/frontend)
- Backend: Django REST API + Celery tasks (src/backend)
- Infrastructure: Docker + Docker Compose + Kubernetes Helm charts

##### File structure
- Top-level “src” splits into “backend” and “frontend.”
- Backend follows Django + Django REST Framework patterns: apps under core, settings, wsgi, celery_app.
- Celery: async tasks for deletion, media cleanup, etc.
- Frontend: Next.js app with pages, features, layouts, UI components.
- Docker & compose.yaml orchestrate containers: app-dev, nginx, db, broker, celery, mail, PostHog.
- Helm charts (src/helm) define Kubernetes resources for backend, frontend, services, ingress.
- Mail templates in “src/mail” generate transactional emails.

##### Extract insights from the README
- Confirms Next.js + Django REST Framework, Docker-Compose development.
- Emphasizes self-host, scalable, secure file storage.
- Mentions Django admin, translation, Crowdin for i18n.

##### Detailed capture of essential elements
- Environment config layer (env.d) as annotation to show configuration-driven deployment.
- How Docker Compose mirrors Helm charts: mapping each container to a Kubernetes Deployment + Service.
- Celery tasks (item deletion, document generation) to show where background processing lives.
- Crowdin sync steps feeding into i18n pipelines (optional).

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Layer
    subgraph "User & Client"
        direction TB
        Client["Web Browser"]:::frontend
        SDK["SDK (Monorepo)"]:::frontend
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        NextJS["Next.js App"]:::frontend
        Pages["Pages & Routing"]:::frontend
        Features["Features (API, Auth, Explorer, UI, Layouts)"]:::frontend
        Public["Public Assets"]:::frontend
        Config["Build Config & Scripts"]:::frontend
    end

    %% API Gateway
    Nginx["Nginx Reverse Proxy"]:::compute

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        Django["Gunicorn + Django REST API"]:::compute
        Celery["Celery Workers"]:::compute
    end

    %% Data & Services
    subgraph "Data & Services"
        direction TB
        Postgres["PostgreSQL"]:::datastore
        Storage["File Storage (PV/S3)"]:::datastore
        Broker["Broker (Redis/RabbitMQ)"]:::datastore
        AuthSvc["Keycloak Auth"]:::external
        MailSvc["Mail Service (MJML + Node.js)"]:::compute
        Analytics["PostHog Analytics"]:::external
    end

    %% Infra Config
    subgraph "Infrastructure Config"
        direction TB
        Env["Environment Config (env.d)"]:::external
        Compose["Docker Compose"]:::external
        Helm["Kubernetes Helm Charts"]:::external
    end

    %% Connections
    Client -->|"HTTPS"| Nginx
    SDK -->|"HTTPS / API Calls"| Nginx
    Nginx -->|"Static / SSR"| NextJS
    Nginx -->|"HTTPS / API"| Django
    NextJS -->|"Fetch/API"| Django
    Django -->|"SQL"| Postgres
    Django -->|"Store/Retrieve"| Storage
    Django -->|"AMQP"| Broker
    Celery -->|"AMQP"| Broker
    Celery -->|"ORM/API"| Django
    Django -->|"Token Validation"| AuthSvc
    Django -->|"SMTP/HTTP"| MailSvc
    Celery -->|"SMTP/HTTP"| MailSvc
    Django -->|"Event Tracking"| Analytics
    Compose --> NextJS
    Compose --> Django
    Compose --> Celery
    Compose --> Postgres
    Compose --> Broker
    Compose --> MailSvc
    Compose --> Analytics
    Helm --> Compose
    Env --> Compose
    Env --> Helm

    %% Click Events
    click SDK "https://github.com/suitenumerique/drive/tree/main/src/frontend/packages/sdk"
    click NextJS "https://github.com/suitenumerique/drive/tree/main/src/frontend/apps/drive"
    click Pages "https://github.com/suitenumerique/drive/tree/main/src/frontend/apps/drive/src/pages"
    click Features "https://github.com/suitenumerique/drive/tree/main/src/frontend/apps/drive/src/features"
    click Public "https://github.com/suitenumerique/drive/tree/main/src/frontend/apps/drive/public"
    click Config "https://github.com/suitenumerique/drive/blob/main/src/frontend/apps/drive/next.config.ts"
    click Config "https://github.com/suitenumerique/drive/blob/main/src/frontend/apps/drive/package.json"
    click Config "https://github.com/suitenumerique/drive/blob/main/src/frontend/apps/drive/eslint.config.mjs"
    click Django "https://github.com/suitenumerique/drive/blob/main/src/backend/drive/wsgi.py"
    click Django "https://github.com/suitenumerique/drive/blob/main/src/backend/drive/settings.py"
    click Django "https://github.com/suitenumerique/drive/blob/main/src/backend/drive/celery_app.py"
    click Django "https://github.com/suitenumerique/drive/blob/main/src/backend/manage.py"
    click Celery "https://github.com/suitenumerique/drive/tree/main/src/backend/core/tasks/"
    click Postgres "https://github.com/suitenumerique/drive/blob/main/src/backend/core/models.py"
    click AuthSvc "https://github.com/suitenumerique/drive/blob/main/docker/auth/realm.json"
    click MailSvc "https://github.com/suitenumerique/drive/tree/main/src/mail/mjml/"
    click MailSvc "https://github.com/suitenumerique/drive/tree/main/src/mail/bin/"
    click MailSvc "https://github.com/suitenumerique/drive/blob/main/src/mail/package.json"
    click MailSvc "https://github.com/suitenumerique/drive/blob/main/src/mail/html-to-text.config.json"
    click Compose "https://github.com/suitenumerique/drive/blob/main/compose.yaml"
    click Compose "https://github.com/suitenumerique/drive/tree/main/bin/compose"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/Chart.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/values.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/backend_deployment.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/backend_svc.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/backend_celery.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/backend_job.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/frontend_deployment.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/frontend_svc.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/ingress.yaml"
    click Helm "https://github.com/suitenumerique/drive/blob/main/src/helm/drive/templates/posthog_svc.yaml"
    click Env "https://github.com/suitenumerique/drive/blob/main/env.d/development/*.dist"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#00529b,color:#00529b
    classDef compute fill:#d4edda,stroke:#155724,color:#155724
    classDef datastore fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
