# baggie11/virtual-photobooth architecture

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

- Interactive diagram: https://gitdiagram.com/baggie11/virtual-photobooth
- Repository: https://github.com/baggie11/virtual-photobooth

## Overview

Virtual Photo Booth is a Vue photo-capture/upload client backed by a FastAPI neural-style-transfer service. The principal flow is browser capture or upload, API validation and image preprocessing, selectable ONNX/PyTorch inference, then a saved stylized image returned to the client. The graph also preserves the health endpoint, model architecture, configuration, and structured logging. Frontend-to-API behavior is based on README documentation; source excerpts do not show the Vue request implementation or all route details.

Main entry points: [`backend/app/inference/factory.py`](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/factory.py) (Engine Factory), [`backend/app/services/style_transfer_service.py`](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/services/style_transfer_service.py) (Transfer Service), [`backend/app/api/routes/style_transfer.py`](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/routes/style_transfer.py) (Transfer Endpoint), [`backend/app/main.py`](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/main.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Photo Booth UI"]
  node_photo["Capture &amp; Upload<br/>[PhotoPage.vue]"]
  node_landing["Landing Page<br/>[LandingPage.vue]"]
  node_ui_routes["Client Routes<br/>[index.js]"]
  node_ui_mount["Vue App Mount<br/>[main.js]"]
end

subgraph group_api["API Service"]
  node_fastapi["FastAPI App<br/>[main.py]"]
  node_api_router["API Router<br/>[router.py]"]
  node_transfer_route["Transfer Endpoint<br/>[style_transfer.py]"]
  node_health_route["Health Endpoint<br/>[health.py]"]
  node_schemas["API Schemas<br/>[requests.py]"]
  node_responses["Response Schemas<br/>[responses.py]"]
  node_service["Transfer Service"]
  node_validation["Upload Validation<br/>[file_validation.py]"]
  node_image_processing["Image Processing"]
  node_artifacts["Upload &amp; Result Files"]
end

subgraph group_inference["Inference Runtime"]
  node_factory["Engine Factory<br/>[factory.py]"]
  node_onnx["ONNX Engine<br/>[onnx_engine.py]"]
  node_pytorch["PyTorch Engine<br/>[pytorch_engine.py]"]
end

subgraph group_model["Neural Model"]
  node_transformer["Transformer Network<br/>[transformer_net.py]"]
  node_conv["Convolution Block<br/>[conv_block.py]"]
  node_residual["Residual Block<br/>[residual_block.py]"]
  node_checkpoint["Checkpoint Loader<br/>[checkpoint.py]"]
end

subgraph group_ops["Configuration &amp; Observability"]
  node_settings["Runtime Settings<br/>[config.py]"]
  node_logging["JSON Logging<br/>[logging.py]"]
end

node_browser(("User Browser"))

node_browser -->|"captures or uploads"| node_photo
node_photo -->|"submits image"| node_transfer_route
node_ui_mount -->|"mounts routes"| node_ui_routes
node_ui_routes -->|"routes to"| node_landing
node_ui_routes -->|"routes to"| node_photo
node_fastapi -->|"registers"| node_api_router
node_api_router -->|"includes"| node_health_route
node_api_router -->|"includes"| node_transfer_route
node_transfer_route -->|"calls"| node_service
node_transfer_route -->|"uses request"| node_schemas
node_transfer_route -->|"uses response"| node_responses
node_health_route -->|"uses response"| node_responses
node_service -->|"validates upload"| node_validation
node_service -->|"preprocesses image"| node_image_processing
node_service -->|"writes images"| node_artifacts
node_service -.->|"runs configured engine"| node_factory
node_fastapi -->|"builds engine"| node_factory
node_factory -->|"selects backend"| node_onnx
node_factory -->|"selects backend"| node_pytorch
node_pytorch -->|"runs model"| node_transformer
node_pytorch -->|"loads weights"| node_checkpoint
node_transformer -->|"uses blocks"| node_conv
node_transformer -->|"uses blocks"| node_residual
node_fastapi -->|"loads settings"| node_settings
node_factory -->|"selects engine paths"| node_settings
node_fastapi -->|"configures logging"| node_logging
node_factory -->|"logs engine setup"| node_logging

click node_photo "https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/components/PhotoPage.vue"
click node_landing "https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/components/LandingPage.vue"
click node_ui_routes "https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/router/index.js"
click node_ui_mount "https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/main.js"
click node_fastapi "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/main.py"
click node_api_router "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/router.py"
click node_transfer_route "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/routes/style_transfer.py"
click node_health_route "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/routes/health.py"
click node_schemas "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/schemas/requests.py"
click node_responses "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/schemas/responses.py"
click node_service "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/services/style_transfer_service.py"
click node_validation "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/utils/file_validation.py"
click node_image_processing "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/utils/image_processing.py"
click node_artifacts "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/services/style_transfer_service.py"
click node_factory "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/factory.py"
click node_onnx "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/onnx_engine.py"
click node_pytorch "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/pytorch_engine.py"
click node_transformer "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/transformer_net.py"
click node_conv "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/conv_block.py"
click node_residual "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/residual_block.py"
click node_checkpoint "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/checkpoint.py"
click node_settings "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/core/config.py"
click node_logging "https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/core/logging.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_photo,node_landing,node_ui_routes,node_ui_mount,node_browser toneBlue
class node_fastapi,node_api_router,node_transfer_route,node_health_route,node_schemas,node_responses,node_service,node_validation,node_image_processing,node_artifacts toneAmber
class node_factory,node_onnx,node_pytorch toneMint
class node_transformer,node_conv,node_residual,node_checkpoint toneRose
class node_settings,node_logging toneIndigo
```

## Components

### Photo Booth UI

- [Capture & Upload](https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/components/PhotoPage.vue): `frontend/src/components/PhotoPage.vue`
- [Landing Page](https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/components/LandingPage.vue): `frontend/src/components/LandingPage.vue`
- [Client Routes](https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/router/index.js): `frontend/src/router/index.js`
- [Vue App Mount](https://github.com/baggie11/virtual-photobooth/blob/main/frontend/src/main.js): `frontend/src/main.js`

### API Service

- [FastAPI App](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/main.py): `backend/app/main.py`
- [API Router](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Transfer Endpoint](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/routes/style_transfer.py): `backend/app/api/routes/style_transfer.py`
- [Health Endpoint](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/api/routes/health.py): `backend/app/api/routes/health.py`
- [API Schemas](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/schemas/requests.py): `backend/app/schemas/requests.py`
- [Response Schemas](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/schemas/responses.py): `backend/app/schemas/responses.py`
- [Transfer Service](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/services/style_transfer_service.py): `backend/app/services/style_transfer_service.py`
- [Upload Validation](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/utils/file_validation.py): `backend/app/utils/file_validation.py`
- [Image Processing](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/utils/image_processing.py): `backend/app/utils/image_processing.py`
- [Upload & Result Files](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/services/style_transfer_service.py): `backend/app/services/style_transfer_service.py`

### Inference Runtime

- [Engine Factory](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/factory.py): `backend/app/inference/factory.py`
- [ONNX Engine](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/onnx_engine.py): `backend/app/inference/onnx_engine.py`
- [PyTorch Engine](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/inference/pytorch_engine.py): `backend/app/inference/pytorch_engine.py`

### Neural Model

- [Transformer Network](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/transformer_net.py): `backend/app/models/transformer_net.py`
- [Convolution Block](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/conv_block.py): `backend/app/models/conv_block.py`
- [Residual Block](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/residual_block.py): `backend/app/models/residual_block.py`
- [Checkpoint Loader](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/models/checkpoint.py): `backend/app/models/checkpoint.py`

### Configuration & Observability

- [Runtime Settings](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [JSON Logging](https://github.com/baggie11/virtual-photobooth/blob/main/backend/app/core/logging.py): `backend/app/core/logging.py`

### Other components

- **User Browser**

## Connections

- User Browser → Capture & Upload: captures or uploads (evidence: `README.md`)
- Capture & Upload → Transfer Endpoint: submits image (evidence: `README.md`)
- Vue App Mount → Client Routes: mounts routes (evidence: `frontend/src/main.js`)
- Client Routes → Landing Page: routes to (evidence: `frontend/src/router/index.js`)
- Client Routes → Capture & Upload: routes to (evidence: `frontend/src/router/index.js`)
- FastAPI App → API Router: registers (evidence: `backend/app/main.py`)
- API Router → Health Endpoint: includes (evidence: `backend/app/api/router.py`)
- API Router → Transfer Endpoint: includes (evidence: `backend/app/api/router.py`)
- Transfer Endpoint → Transfer Service: calls (evidence: `backend/app/api/routes/style_transfer.py`)
- Transfer Endpoint → API Schemas: uses request (evidence: `backend/app/api/routes/style_transfer.py`)
- Transfer Endpoint → Response Schemas: uses response (evidence: `backend/app/api/routes/style_transfer.py`)
- Health Endpoint → Response Schemas: uses response (evidence: `backend/app/api/routes/health.py`)
- Transfer Service → Upload Validation: validates upload (evidence: `backend/app/services/style_transfer_service.py`)
- Transfer Service → Image Processing: preprocesses image (evidence: `backend/app/services/style_transfer_service.py`)
- Transfer Service → Upload & Result Files: writes images (evidence: `README.md`)
- Transfer Service → Engine Factory: runs configured engine
- FastAPI App → Engine Factory: builds engine (evidence: `backend/app/main.py`)
- Engine Factory → ONNX Engine: selects backend (evidence: `backend/app/inference/factory.py`)
- Engine Factory → PyTorch Engine: selects backend (evidence: `backend/app/inference/factory.py`)
- PyTorch Engine → Transformer Network: runs model (evidence: `backend/app/inference/pytorch_engine.py`)
- PyTorch Engine → Checkpoint Loader: loads weights (evidence: `backend/app/inference/pytorch_engine.py`)
- Transformer Network → Convolution Block: uses blocks (evidence: `backend/app/models/transformer_net.py`)
- Transformer Network → Residual Block: uses blocks (evidence: `backend/app/models/transformer_net.py`)
- FastAPI App → Runtime Settings: loads settings (evidence: `backend/app/main.py`)
- Engine Factory → Runtime Settings: selects engine paths (evidence: `backend/app/inference/factory.py`)
- FastAPI App → JSON Logging: configures logging (evidence: `backend/app/main.py`)
- Engine Factory → JSON Logging: logs engine setup (evidence: `backend/app/inference/factory.py`)
