# craftoid/svg2embr architecture

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

- Interactive diagram: https://gitdiagram.com/craftoid/svg2embr
- Repository: https://github.com/craftoid/svg2embr

## Overview

svg2embroidery is a server-side PHP application for converting SVG vector drawings to embroidery files and embroidery files back to SVG. The principal workflow starts with a file upload, presents conversion options, then returns a downloadable result. Its main conversion implementation is supported by excerpts; tutorial, gallery, and inspiration capabilities are also represented from the sampled files. Evidence is limited to the README and excerpts, so unsampled conversion details and integrations are not inferred.

Main entry points: [`index.php`](https://github.com/craftoid/svg2embr/blob/master/index.php) (Page Router), [`step2.php`](https://github.com/craftoid/svg2embr/blob/master/step2.php) (Upload Handler), [`home.php`](https://github.com/craftoid/svg2embr/blob/master/home.php) (Upload Form), [`tut.php`](https://github.com/craftoid/svg2embr/blob/master/tut.php) (Tutorial Content)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["File Conversion"]
  node_svg_to_stitches["SVG Stitching<br/>[convert2stitch.php]"]
  node_export_embroidery["Embroidery Export<br/>[save_pcs_exp.php]"]
  node_import_embroidery["Embroidery Import<br/>[save_svg.php]"]
end

subgraph group_web["Web Workflow"]
  node_home["Upload Form<br/>[home.php]"]
  node_router["Page Router<br/>[index.php]"]
  node_options["Upload Handler<br/>[step2.php]"]
end

subgraph group_guidance["Tutorials"]
  node_tutorial_page["Tutorial Content<br/>[tut.php]"]
  node_tutorial_index["Tutorial Index"]
  node_tutorial_assets["Tutorial Images"]
end

subgraph group_showcase["Examples"]
  node_examples["Embroidery Examples<br/>[myembroideries.php]"]
  node_inspiration["Inspiration Gallery<br/>[insp.php]"]
  node_inspiration_assets["Inspiration Images"]
  node_footer_links["Resource Links<br/>[links.php]"]
end

node_user(("User"))

node_user -->|"uploads file"| node_home
node_home -->|"submits upload"| node_options
node_router -->|"includes page"| node_home
node_router -->|"routes page"| node_options
node_router -->|"routes page"| node_tutorial_page
node_options -->|"posts SVG"| node_export_embroidery
node_options -->|"posts embroidery"| node_import_embroidery
node_export_embroidery -->|"calls conversion"| node_svg_to_stitches
node_router -->|"includes index"| node_tutorial_index
node_tutorial_index -->|"links tutorials"| node_tutorial_page
node_tutorial_page -.->|"uses images"| node_tutorial_assets
node_router -->|"includes gallery"| node_examples
node_router -->|"includes gallery"| node_inspiration
node_inspiration -->|"uses images"| node_inspiration_assets
node_router -->|"includes links"| node_footer_links

click node_home "https://github.com/craftoid/svg2embr/blob/master/home.php"
click node_router "https://github.com/craftoid/svg2embr/blob/master/index.php"
click node_options "https://github.com/craftoid/svg2embr/blob/master/step2.php"
click node_svg_to_stitches "https://github.com/craftoid/svg2embr/blob/master/convert2stitch.php"
click node_export_embroidery "https://github.com/craftoid/svg2embr/blob/master/save_pcs_exp.php"
click node_import_embroidery "https://github.com/craftoid/svg2embr/blob/master/save_svg.php"
click node_tutorial_page "https://github.com/craftoid/svg2embr/blob/master/tut.php"
click node_tutorial_index "https://github.com/craftoid/svg2embr/blob/master/inkscapeEmbrTut.php"
click node_tutorial_assets "https://github.com/craftoid/svg2embr/tree/master/tut"
click node_examples "https://github.com/craftoid/svg2embr/blob/master/myembroideries.php"
click node_inspiration "https://github.com/craftoid/svg2embr/blob/master/insp.php"
click node_inspiration_assets "https://github.com/craftoid/svg2embr/tree/master/insp"
click node_footer_links "https://github.com/craftoid/svg2embr/blob/master/links.php"

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_svg_to_stitches,node_export_embroidery,node_import_embroidery,node_user toneBlue
class node_home,node_router,node_options toneAmber
class node_tutorial_page,node_tutorial_index,node_tutorial_assets toneMint
class node_examples,node_inspiration,node_inspiration_assets,node_footer_links toneRose
```

## Components

### File Conversion

- [SVG Stitching](https://github.com/craftoid/svg2embr/blob/master/convert2stitch.php): `convert2stitch.php`
- [Embroidery Export](https://github.com/craftoid/svg2embr/blob/master/save_pcs_exp.php): `save_pcs_exp.php`
- [Embroidery Import](https://github.com/craftoid/svg2embr/blob/master/save_svg.php): `save_svg.php`

### Web Workflow

- [Upload Form](https://github.com/craftoid/svg2embr/blob/master/home.php): `home.php`
- [Page Router](https://github.com/craftoid/svg2embr/blob/master/index.php): `index.php`
- [Upload Handler](https://github.com/craftoid/svg2embr/blob/master/step2.php): `step2.php`

### Tutorials

- [Tutorial Content](https://github.com/craftoid/svg2embr/blob/master/tut.php): `tut.php`
- [Tutorial Index](https://github.com/craftoid/svg2embr/blob/master/inkscapeEmbrTut.php): `inkscapeEmbrTut.php`
- [Tutorial Images](https://github.com/craftoid/svg2embr/tree/master/tut): `tut`

### Examples

- [Embroidery Examples](https://github.com/craftoid/svg2embr/blob/master/myembroideries.php): `myembroideries.php`
- [Inspiration Gallery](https://github.com/craftoid/svg2embr/blob/master/insp.php): `insp.php`
- [Inspiration Images](https://github.com/craftoid/svg2embr/tree/master/insp): `insp`
- [Resource Links](https://github.com/craftoid/svg2embr/blob/master/links.php): `links.php`

### Other components

- **User**

## Connections

- User → Upload Form: uploads file (evidence: `home.php`)
- Upload Form → Upload Handler: submits upload (evidence: `home.php`)
- Page Router → Upload Form: includes page (evidence: `index.php`)
- Page Router → Upload Handler: routes page (evidence: `index.php`)
- Page Router → Tutorial Content: routes page (evidence: `index.php`)
- Upload Handler → Embroidery Export: posts SVG (evidence: `step2.php`)
- Upload Handler → Embroidery Import: posts embroidery (evidence: `step2.php`)
- Embroidery Export → SVG Stitching: calls conversion (evidence: `save_pcs_exp.php`)
- Page Router → Tutorial Index: includes index (evidence: `index.php`)
- Tutorial Index → Tutorial Content: links tutorials (evidence: `inkscapeEmbrTut.php`)
- Tutorial Content → Tutorial Images: uses images
- Page Router → Embroidery Examples: includes gallery (evidence: `index.php`)
- Page Router → Inspiration Gallery: includes gallery (evidence: `index.php`)
- Inspiration Gallery → Inspiration Images: uses images (evidence: `insp.php`)
- Page Router → Resource Links: includes links (evidence: `index.php`)
