# satviksh13/image_to_pdf_converter architecture

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

- Interactive diagram: https://gitdiagram.com/satviksh13/image_to_pdf_converter
- Repository: https://github.com/satviksh13/image_to_pdf_converter

## Overview

JPG to PDF Converter provides a browser upload-and-download workflow and two separately implemented conversion paths: a Node.js web server and a Flask API. The Node server renders the interface, accepts uploaded images, processes them, and streams a PDF; the Flask endpoint independently accepts images and returns a PDF. The README documents previews and drag-and-drop, but the sampled template was not inspected, so those UI details are represented only as documented capabilities. No sampled evidence shows Node forwarding requests to Flask.

Main entry points: [`index.js`](https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js) (Web routes), [`backend/app.py`](https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py) (Conversion API), [`views/index.ejs`](https://github.com/satviksh13/image_to_pdf_converter/blob/main/views/index.ejs) (Upload and preview UI), [`public/styles.css`](https://github.com/satviksh13/image_to_pdf_converter/blob/main/public/styles.css) (Static styling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_interface["Upload and preview UI<br/>[index.ejs]"]
  node_web_assets["Static styling<br/>[styles.css]"]
end

subgraph group_node["Node conversion"]
  node_web_server["Web routes<br/>[index.js]"]
  node_upload_handling["Upload handling<br/>[index.js]"]
  node_node_image_processing["Image processing<br/>[index.js]"]
  node_node_pdf["PDF generation<br/>[index.js]"]
end

subgraph group_flask["Flask conversion"]
  node_flask_api["Conversion API<br/>[app.py]"]
  node_image_validation["Image validation<br/>[app.py]"]
  node_flask_image_processing["Page image layout<br/>[app.py]"]
  node_flask_pdf["PDF response<br/>[app.py]"]
end

node_visitor(("Browser user"))
node_flask_client(("API client"))

node_visitor -->|"uses"| node_interface
node_web_server -->|"renders"| node_interface
node_interface -.->|"uses styles"| node_web_assets
node_visitor -->|"uploads images"| node_web_server
node_web_server -->|"runs upload middleware"| node_upload_handling
node_upload_handling -->|"provides files"| node_node_image_processing
node_node_image_processing -->|"provides image data"| node_node_pdf
node_web_server -->|"streams PDF"| node_node_pdf
node_flask_client -->|"posts images"| node_flask_api
node_flask_api -->|"filters uploads"| node_image_validation
node_flask_api -->|"processes images"| node_flask_image_processing
node_flask_image_processing -->|"draws pages"| node_flask_pdf
node_flask_api -->|"returns PDF"| node_flask_pdf

click node_interface "https://github.com/satviksh13/image_to_pdf_converter/blob/main/views/index.ejs"
click node_web_assets "https://github.com/satviksh13/image_to_pdf_converter/blob/main/public/styles.css"
click node_web_server "https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js"
click node_upload_handling "https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js"
click node_node_image_processing "https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js"
click node_node_pdf "https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js"
click node_flask_api "https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py"
click node_image_validation "https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py"
click node_flask_image_processing "https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py"
click node_flask_pdf "https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.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_interface,node_web_assets,node_visitor,node_flask_client toneBlue
class node_web_server,node_upload_handling,node_node_image_processing,node_node_pdf toneAmber
class node_flask_api,node_image_validation,node_flask_image_processing,node_flask_pdf toneMint
```

## Components

### Web interface

- [Upload and preview UI](https://github.com/satviksh13/image_to_pdf_converter/blob/main/views/index.ejs): `views/index.ejs`
- [Static styling](https://github.com/satviksh13/image_to_pdf_converter/blob/main/public/styles.css): `public/styles.css`

### Node conversion

- [Web routes](https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js): `index.js`
- [Upload handling](https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js): `index.js`
- [Image processing](https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js): `index.js`
- [PDF generation](https://github.com/satviksh13/image_to_pdf_converter/blob/main/index.js): `index.js`

### Flask conversion

- [Conversion API](https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py): `backend/app.py`
- [Image validation](https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py): `backend/app.py`
- [Page image layout](https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py): `backend/app.py`
- [PDF response](https://github.com/satviksh13/image_to_pdf_converter/blob/main/backend/app.py): `backend/app.py`

### Other components

- **Browser user**
- **API client**

## Connections

- Browser user → Upload and preview UI: uses (evidence: `README.md`)
- Web routes → Upload and preview UI: renders (evidence: `index.js`)
- Upload and preview UI → Static styling: uses styles
- Browser user → Web routes: uploads images (evidence: `README.md`)
- Web routes → Upload handling: runs upload middleware (evidence: `index.js`)
- Upload handling → Image processing: provides files (evidence: `index.js`)
- Image processing → PDF generation: provides image data (evidence: `index.js`)
- Web routes → PDF generation: streams PDF (evidence: `index.js`)
- API client → Conversion API: posts images (evidence: `backend/app.py`)
- Conversion API → Image validation: filters uploads (evidence: `backend/app.py`)
- Conversion API → Page image layout: processes images (evidence: `backend/app.py`)
- Page image layout → PDF response: draws pages (evidence: `backend/app.py`)
- Conversion API → PDF response: returns PDF (evidence: `backend/app.py`)
