# masrafisiam/filebridge architecture

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

- Interactive diagram: https://gitdiagram.com/masrafisiam/filebridge
- Repository: https://github.com/masrafisiam/filebridge

## Overview

FileBridge is a Django web app that converts DOCX and PPTX uploads into downloadable PDFs. A user selects a file in the browser; the frontend submits it to the home endpoint, which validates the upload and delegates conversion. The service stages the file temporarily, runs LibreOffice in a restricted Docker container, and returns the resulting PDF through the endpoint for browser download. The main path is visible in the sampled frontend, URL, view, and service code. The Docker image definition exists in the tree, but its contents were not sampled.

Main entry points: [`converter/views.py`](https://github.com/masrafisiam/filebridge/blob/main/converter/views.py) (Home and upload endpoint), [`converter/services.py`](https://github.com/masrafisiam/filebridge/blob/main/converter/services.py) (Format validation and conversion), [`converter/templates/converter/index.html`](https://github.com/masrafisiam/filebridge/blob/main/converter/templates/converter/index.html) (Upload interface), [`converter/static/converter/js/app.js`](https://github.com/masrafisiam/filebridge/blob/main/converter/static/converter/js/app.js) (File selection and download)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Browser interface"]
  node_upload_ui["Upload interface<br/>[index.html]"]
  node_frontend["File selection and download<br/>[app.js]"]
end

subgraph group_web["Django request handling"]
  node_project_routes["Project URL routing<br/>[urls.py]"]
  node_app_routes["Converter URL routing<br/>[urls.py]"]
  node_home_view["Home and upload endpoint<br/>[views.py]"]
end

subgraph group_conversion["Document conversion"]
  node_conversion_service["Format validation and conversion<br/>[services.py]"]
  node_temp_workspace[("Temporary file workspace<br/>[services.py]")]
  node_docker_engine["Docker engine"]
  node_conversion_image["Conversion image"]
  node_libreoffice["LibreOffice"]
end

node_user(("User"))
node_browser(("Browser"))

node_user -->|"uses"| node_browser
node_browser -->|"loads page"| node_upload_ui
node_upload_ui -->|"loads script"| node_frontend
node_user -->|"selects file"| node_frontend
node_frontend -->|"submits upload"| node_browser
node_project_routes -->|"includes routes"| node_app_routes
node_app_routes -->|"routes request"| node_home_view
node_home_view -->|"renders page"| node_upload_ui
node_browser -->|"POSTs upload"| node_home_view
node_home_view -->|"calls conversion"| node_conversion_service
node_conversion_service -->|"stages files"| node_temp_workspace
node_conversion_service -->|"runs container"| node_docker_engine
node_docker_engine -.->|"uses image"| node_conversion_image
node_conversion_service -->|"invokes in container"| node_libreoffice
node_conversion_service -->|"returns PDF bytes"| node_home_view
node_home_view -->|"returns PDF response"| node_browser
node_browser -->|"downloads PDF"| node_user

click node_upload_ui "https://github.com/masrafisiam/filebridge/blob/main/converter/templates/converter/index.html"
click node_frontend "https://github.com/masrafisiam/filebridge/blob/main/converter/static/converter/js/app.js"
click node_project_routes "https://github.com/masrafisiam/filebridge/blob/main/FileBridge/urls.py"
click node_app_routes "https://github.com/masrafisiam/filebridge/blob/main/converter/urls.py"
click node_home_view "https://github.com/masrafisiam/filebridge/blob/main/converter/views.py"
click node_conversion_service "https://github.com/masrafisiam/filebridge/blob/main/converter/services.py"
click node_temp_workspace "https://github.com/masrafisiam/filebridge/blob/main/converter/services.py"
click node_conversion_image "https://github.com/masrafisiam/filebridge/blob/main/docker/Dockerfile"

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_upload_ui,node_frontend,node_user,node_browser toneBlue
class node_project_routes,node_app_routes,node_home_view toneAmber
class node_conversion_service,node_temp_workspace,node_docker_engine,node_conversion_image,node_libreoffice toneMint
```

## Components

### Browser interface

- [Upload interface](https://github.com/masrafisiam/filebridge/blob/main/converter/templates/converter/index.html): `converter/templates/converter/index.html`
- [File selection and download](https://github.com/masrafisiam/filebridge/blob/main/converter/static/converter/js/app.js): `converter/static/converter/js/app.js`

### Django request handling

- [Project URL routing](https://github.com/masrafisiam/filebridge/blob/main/FileBridge/urls.py): `FileBridge/urls.py`
- [Converter URL routing](https://github.com/masrafisiam/filebridge/blob/main/converter/urls.py): `converter/urls.py`
- [Home and upload endpoint](https://github.com/masrafisiam/filebridge/blob/main/converter/views.py): `converter/views.py`

### Document conversion

- [Format validation and conversion](https://github.com/masrafisiam/filebridge/blob/main/converter/services.py): `converter/services.py`
- [Temporary file workspace](https://github.com/masrafisiam/filebridge/blob/main/converter/services.py): `converter/services.py`
- **Docker engine**
- [Conversion image](https://github.com/masrafisiam/filebridge/blob/main/docker/Dockerfile): `docker/Dockerfile`
- **LibreOffice**

### Other components

- **User**
- **Browser**

## Connections

- User → Browser: uses
- Browser → Upload interface: loads page
- Upload interface → File selection and download: loads script
- User → File selection and download: selects file (evidence: `converter/static/converter/js/app.js`)
- File selection and download → Browser: submits upload (evidence: `converter/static/converter/js/app.js`)
- Project URL routing → Converter URL routing: includes routes (evidence: `FileBridge/urls.py`)
- Converter URL routing → Home and upload endpoint: routes request (evidence: `converter/urls.py`)
- Home and upload endpoint → Upload interface: renders page (evidence: `converter/views.py`)
- Browser → Home and upload endpoint: POSTs upload
- Home and upload endpoint → Format validation and conversion: calls conversion (evidence: `converter/views.py`)
- Format validation and conversion → Temporary file workspace: stages files (evidence: `converter/services.py`)
- Format validation and conversion → Docker engine: runs container (evidence: `converter/services.py`)
- Docker engine → Conversion image: uses image
- Format validation and conversion → LibreOffice: invokes in container (evidence: `converter/services.py`)
- Format validation and conversion → Home and upload endpoint: returns PDF bytes (evidence: `converter/views.py`)
- Home and upload endpoint → Browser: returns PDF response (evidence: `converter/views.py`)
- Browser → User: downloads PDF
