# itsnavinsingh/img.transform architecture

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

- Interactive diagram: https://gitdiagram.com/itsnavinsingh/img.transform
- Repository: https://github.com/itsnavinsingh/img.transform

## Overview

##### Project type and purpose
- This is a full-stack web application called “img.transform” that allows users to upload images and apply affine transformations (rotation, scaling, translation) in real time.
- Frontend: React + TypeScript + TailwindCSS
- Backend: FastAPI + OpenCV + NumPy
- Communication: REST API with multipart/form-data

##### File structure
Top-level
- main.py – FastAPI entry point
- requirements.txt – Python dependencies
- client/ – React (Vite) application
client/
- package.json, yarn.lock – Node dependencies
- vite.config.ts – build config
- public/ – static assets
- src/
– App.tsx, main.tsx – root React components
– components/ (About.tsx, Home.tsx, imgdrop.tsx, navbar.tsx, footer.tsx)
– constants/routepath.tsx – client routing
– assets/, index.css
- tsconfig*.json – TypeScript configs
No database or external microservices—backend and frontend are packaged together.

##### README for additional insights
- Confirms layers and tech stack.
- Data flow: image & parameters → POST /transform → FastAPI decodes → OpenCV operations → returns image → UI displays result.
- After building, frontend is served statically from client/dist by FastAPI.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        direction TB
        Browser["User's Browser"]:::frontend
        ReactApp["React SPA"]:::frontend
        Browser -->|"Renders SPA"| ReactApp

        subgraph "React Application Structure"
            direction TB
            Entry["main.tsx"]:::frontend
            AppComp["App.tsx"]:::frontend
            Components["components/"]:::frontend
            Routes["routepath.tsx"]:::frontend
            Styles["index.css"]:::frontend
            ConfigBuild["vite.config.ts"]:::frontend
            HTMLTemplate["index.html"]:::frontend
        end

        ReactApp --> Entry
        ReactApp --> AppComp
        ReactApp --> Components
        ReactApp --> Routes
        ReactApp --> Styles
        ReactApp --> ConfigBuild
        ReactApp --> HTMLTemplate

        ReactApp -->|"POST /transform<br/>(multipart/form-data)"| APILayer
        ReactApp -->|"GET / (static files)"| StaticServing
    end

    %% Backend Layer
    subgraph "Backend (FastAPI)" 
        direction TB
        FastAPI["FastAPI Server"]:::backend
        StaticServing["Static File Serving<br/>client/dist"]:::backend
        APILayer["API Endpoint<br/>POST /transform"]:::backend
        Config["Configuration Module"]:::backend
        PythonDeps["requirements.txt"]:::backend

        StaticServing --> FastAPI
        APILayer --> FastAPI
        Config --> FastAPI
        PythonDeps --> FastAPI

        FastAPI -->|"Invoke processing"| ProcessingService
    end

    %% Processing Service
    subgraph "Image-Processing Service" 
        direction TB
        OpenCV["OpenCV Module"]:::processing
        NumPy["NumPy Module"]:::processing
    end
    ProcessingService[/"Processing Service"/]:::processing
    ProcessingService --> OpenCV
    ProcessingService --> NumPy
    OpenCV --> ProcessingService
    NumPy --> ProcessingService
    ProcessingService -->|"Return image"| APILayer

    %% Data Flow Back to Frontend
    APILayer -->|"Response: transformed image"| ReactApp

    %% Click Events
    click ReactApp "https://github.com/itsnavinsingh/img.transform/tree/master/client/src/"
    click Entry "https://github.com/itsnavinsingh/img.transform/blob/master/client/src/main.tsx"
    click AppComp "https://github.com/itsnavinsingh/img.transform/blob/master/client/src/App.tsx"
    click Components "https://github.com/itsnavinsingh/img.transform/tree/master/client/src/components/"
    click Routes "https://github.com/itsnavinsingh/img.transform/blob/master/client/src/constants/routepath.tsx"
    click Styles "https://github.com/itsnavinsingh/img.transform/blob/master/client/src/index.css"
    click ConfigBuild "https://github.com/itsnavinsingh/img.transform/blob/master/client/vite.config.ts"
    click HTMLTemplate "https://github.com/itsnavinsingh/img.transform/blob/master/client/index.html"
    click FastAPI "https://github.com/itsnavinsingh/img.transform/blob/master/main.py"
    click ProcessingService "https://github.com/itsnavinsingh/img.transform/blob/master/main.py"
    click PythonDeps "https://github.com/itsnavinsingh/img.transform/blob/master/requirements.txt"
    click StaticServing "https://github.com/itsnavinsingh/img.transform/tree/master/client/dist"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,color:#000
    classDef backend fill:#E8F5E9,stroke:#2E7D32,color:#000
    classDef processing fill:#FFF3E0,stroke:#EF6C00,color:#000
```
