# kruthikkoundinyas/typeconverter architecture

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

- Interactive diagram: https://gitdiagram.com/kruthikkoundinyas/typeconverter
- Repository: https://github.com/kruthikkoundinyas/typeconverter

## Overview

##### Project type and purpose
- This is a full-stack, server-side rendered web application (“TypeConverter”) built on Node.js and Express.js.
- Purpose: allow users to upload media files (images & videos), convert them to different formats using Sharp and FFmpeg, then download the converted output.

##### File structure
- Top-level:
- server.js – Express app entry point
- api/index.ts – (optional) TypeScript API module for conversion logic
- public/ – static assets (styles.css, uploaded & converted files)
- views/ – EJS templates (pages & partials) for rendering UI
- package.json & package-lock.json – dependencies & scripts
- vercel.json – deployment configuration
- Key patterns:
- MVC-style separation: views/ (V), server.js & api/ (C), file system as model/storage.
- Multipart file handling (Multer) + CLI/process wrappers (FFmpeg & Sharp) for conversion.

##### README insights
- Tech stack: Node.js, Express.js, Multer, Sharp, FFmpeg, EJS
- No database—uses local filesystem + temporary storage/cleanup
- Security/privacy: no cookies, no tracking, files auto-deleted on return to home

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Tier"
        client["Client Browser"]:::frontend
        subgraph "EJS Views"
            index["views/pages/index.ejs"]:::frontend
            result["views/pages/result.ejs"]:::frontend
            header["views/partials/header.ejs"]:::frontend
            navbar["views/partials/navbar.ejs"]:::frontend
            footer["views/partials/footer.ejs"]:::frontend
        end
        static["public/styles.css"]:::frontend
    end

    subgraph "Vercel Deployment"
        subgraph "Backend Tier"
            server["Express HTTP Server"]:::backend
            multer["Multer Middleware"]:::backend
            routing["Routing & Controller Logic"]:::backend
            subgraph "Conversion Engines"
                sharp["Image Processor (Sharp)"]:::processing
                ffmpeg["Video Processor (FFmpeg)"]:::processing
            end
            storage["File Storage (public/uploads)"]:::storage
            vercel["Vercel Config"]:::backend
        end
    end

    client -->|"GET /"| server
    server -->|"Invokes Controller"| routing
    routing -->|"Renders Home Page"| index
    routing -->|"Renders Result Page"| result
    client -->|"Requests CSS"| static
    client -->|"POST /convert"| server
    server -->|"Handles Upload"| multer
    multer -->|"Saves Uploaded File"| storage
    server -->|"Calls Controller"| routing
    routing -->|"if image → Sharp"| sharp
    routing -->|"if video → FFmpeg"| ffmpeg
    sharp -->|"Saves Converted File"| storage
    ffmpeg -->|"Saves Converted File"| storage
    routing -->|"Renders Result"| result
    client -->|"GET converted file"| storage
    server -->|"On GET / Cleanup"| storage
    vercel -->|"Deploys"| server

    click server "https://github.com/kruthikkoundinyas/typeconverter/blob/master/server.js"
    click routing "https://github.com/kruthikkoundinyas/typeconverter/blob/master/api/index.ts"
    click multer "https://github.com/kruthikkoundinyas/typeconverter/blob/master/server.js"
    click sharp "https://github.com/kruthikkoundinyas/typeconverter/blob/master/api/index.ts"
    click ffmpeg "https://github.com/kruthikkoundinyas/typeconverter/blob/master/api/index.ts"
    click storage "https://github.com/kruthikkoundinyas/typeconverter/tree/master/public/"
    click index "https://github.com/kruthikkoundinyas/typeconverter/blob/master/views/pages/index.ejs"
    click result "https://github.com/kruthikkoundinyas/typeconverter/blob/master/views/pages/result.ejs"
    click header "https://github.com/kruthikkoundinyas/typeconverter/blob/master/views/partials/header.ejs"
    click navbar "https://github.com/kruthikkoundinyas/typeconverter/blob/master/views/partials/navbar.ejs"
    click footer "https://github.com/kruthikkoundinyas/typeconverter/blob/master/views/partials/footer.ejs"
    click static "https://github.com/kruthikkoundinyas/typeconverter/blob/master/public/styles.css"
    click vercel "https://github.com/kruthikkoundinyas/typeconverter/blob/master/vercel.json"

    classDef frontend fill:#D6E9FF,stroke:#339,stroke-width:1px
    classDef backend fill:#E0F7E9,stroke:#2A7,stroke-width:1px
    classDef processing fill:#FFE6B3,stroke:#EA9,stroke-width:1px
    classDef storage fill:#CCCCCC,stroke:#888888,stroke-width:1px
```
