# shiv0xparanoid/sketchify architecture

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

- Interactive diagram: https://gitdiagram.com/shiv0xparanoid/sketchify
- Repository: https://github.com/shiv0xparanoid/sketchify

## Overview

This repository combines a React sketch-making interface, a Python server with sketch-processing utilities, and U-2-Net model and training code. The visible user flow routes visitors to a landing page or sketch page; the sampled evidence does not establish how the browser submits sketches to the server, nor how the server uses the U-2-Net code. The graph preserves those subsystems without asserting unverified links. Server entry points and several model files are included from the tree, but their runtime wiring was not sampled.

Main entry points: [`src/App.jsx`](https://github.com/shiv0xparanoid/sketchify/blob/main/src/App.jsx) (Route dispatcher), [`server/utils/sketch.py`](https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/sketch.py) (Sketch utilities), [`server/utils/file_handler.py`](https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/file_handler.py) (Output path helper), [`server/routes/transform.py`](https://github.com/shiv0xparanoid/sketchify/blob/main/server/routes/transform.py) (Transform route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_react_app["Route dispatcher<br/>[App.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_sketch_page["Sketch page<br/>[Sketch.js]"]
  node_hero["Hero content<br/>[Hero.jsx]"]
  node_browser_script["Browser script<br/>[script.js]"]
end

subgraph group_backend["Sketch backend"]
  node_server_entry["Server entry<br/>[index.js]"]
  node_python_app["Python app<br/>[app.py]"]
  node_transform_route["Transform route<br/>[transform.py]"]
  node_sketch_model["Sketch processor<br/>[sketch.py]"]
  node_sketch_utils["Sketch utilities<br/>[sketch.py]"]
  node_file_handler["Output path helper<br/>[file_handler.py]"]
end

subgraph group_ml["U-2-Net model"]
  node_model_api["Model interface<br/>[u2net.py]"]
  node_model_demo["Model demo<br/>[demo.py]"]
  node_model_data["Model data loader<br/>[data_loader.py]"]
  node_u2net_core["U-2-Net architecture<br/>[u2net_refactor.py]"]
  node_u2net_demo["Gradio demo<br/>[demo.py]"]
  node_portrait_demo["Portrait demo"]
  node_composite["Portrait compositing"]
end

subgraph group_training["Model training"]
  node_training_entry["Training entry<br/>[u2net_train.py]"]
  node_training_data["Training data loader<br/>[data_loader.py]"]
  node_weights_setup["Weights setup"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_react_app
node_react_app -->|"routes to"| node_landing
node_react_app -->|"routes to"| node_sketch_page
node_transform_route -->|"calls"| node_sketch_utils
node_sketch_model -->|"uses"| node_file_handler
node_sketch_utils -->|"uses"| node_file_handler
node_training_entry -->|"loads"| node_training_data

click node_react_app "https://github.com/shiv0xparanoid/sketchify/blob/main/src/App.jsx"
click node_landing "https://github.com/shiv0xparanoid/sketchify/blob/main/src/pages/LandingPage.jsx"
click node_sketch_page "https://github.com/shiv0xparanoid/sketchify/blob/main/src/pages/Sketch.js"
click node_hero "https://github.com/shiv0xparanoid/sketchify/blob/main/src/components/Hero.jsx"
click node_browser_script "https://github.com/shiv0xparanoid/sketchify/blob/main/client/script.js"
click node_server_entry "https://github.com/shiv0xparanoid/sketchify/blob/main/server/index.js"
click node_python_app "https://github.com/shiv0xparanoid/sketchify/blob/main/server/app.py"
click node_transform_route "https://github.com/shiv0xparanoid/sketchify/blob/main/server/routes/transform.py"
click node_sketch_model "https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/sketch.py"
click node_sketch_utils "https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/sketch.py"
click node_file_handler "https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/file_handler.py"
click node_model_api "https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/u2net.py"
click node_model_demo "https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/demo.py"
click node_model_data "https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/data_loader.py"
click node_u2net_core "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/model/u2net_refactor.py"
click node_u2net_demo "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/gradio/demo.py"
click node_portrait_demo "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_portrait_demo.py"
click node_composite "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_portrait_composite.py"
click node_training_entry "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_train.py"
click node_training_data "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/data_loader.py"
click node_weights_setup "https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/setup_model_weights.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_react_app,node_landing,node_sketch_page,node_hero,node_browser_script toneBlue
class node_server_entry,node_python_app,node_transform_route,node_sketch_model,node_sketch_utils,node_file_handler toneAmber
class node_model_api,node_model_demo,node_model_data,node_u2net_core,node_u2net_demo,node_portrait_demo,node_composite toneMint
class node_training_entry,node_training_data,node_weights_setup toneRose
class node_visitor toneIndigo
```

## Components

### Web interface

- [Route dispatcher](https://github.com/shiv0xparanoid/sketchify/blob/main/src/App.jsx): `src/App.jsx`
- [Landing page](https://github.com/shiv0xparanoid/sketchify/blob/main/src/pages/LandingPage.jsx): `src/pages/LandingPage.jsx`
- [Sketch page](https://github.com/shiv0xparanoid/sketchify/blob/main/src/pages/Sketch.js): `src/pages/Sketch.js`
- [Hero content](https://github.com/shiv0xparanoid/sketchify/blob/main/src/components/Hero.jsx): `src/components/Hero.jsx`
- [Browser script](https://github.com/shiv0xparanoid/sketchify/blob/main/client/script.js): `client/script.js`

### Sketch backend

- [Server entry](https://github.com/shiv0xparanoid/sketchify/blob/main/server/index.js): `server/index.js`
- [Python app](https://github.com/shiv0xparanoid/sketchify/blob/main/server/app.py): `server/app.py`
- [Transform route](https://github.com/shiv0xparanoid/sketchify/blob/main/server/routes/transform.py): `server/routes/transform.py`
- [Sketch processor](https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/sketch.py): `server/models/sketch.py`
- [Sketch utilities](https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/sketch.py): `server/utils/sketch.py`
- [Output path helper](https://github.com/shiv0xparanoid/sketchify/blob/main/server/utils/file_handler.py): `server/utils/file_handler.py`

### U-2-Net model

- [Model interface](https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/u2net.py): `server/models/u2net.py`
- [Model demo](https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/demo.py): `server/models/demo.py`
- [Model data loader](https://github.com/shiv0xparanoid/sketchify/blob/main/server/models/data_loader.py): `server/models/data_loader.py`
- [U-2-Net architecture](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/model/u2net_refactor.py): `U-2-Net/model/u2net_refactor.py`
- [Gradio demo](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/gradio/demo.py): `U-2-Net/gradio/demo.py`
- [Portrait demo](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_portrait_demo.py): `U-2-Net/u2net_portrait_demo.py`
- [Portrait compositing](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_portrait_composite.py): `U-2-Net/u2net_portrait_composite.py`

### Model training

- [Training entry](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/u2net_train.py): `U-2-Net/u2net_train.py`
- [Training data loader](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/data_loader.py): `U-2-Net/data_loader.py`
- [Weights setup](https://github.com/shiv0xparanoid/sketchify/blob/main/U-2-Net/setup_model_weights.py): `U-2-Net/setup_model_weights.py`

### Other components

- **Visitor**

## Connections

- Visitor → Route dispatcher: opens (evidence: `src/App.jsx`)
- Route dispatcher → Landing page: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Sketch page: routes to (evidence: `src/App.jsx`)
- Transform route → Sketch utilities: calls (evidence: `server/routes/transform.py`)
- Sketch processor → Output path helper: uses (evidence: `server/models/sketch.py`)
- Sketch utilities → Output path helper: uses (evidence: `server/utils/sketch.py`)
- Training entry → Training data loader: loads (evidence: `U-2-Net/u2net_train.py`)
