# ponozka153/smash-or-pass architecture

> Architecture diagram of the GitHub repository ponozka153/smash-or-pass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ponozka153/smash-or-pass
- Repository: https://github.com/ponozka153/smash-or-pass

## Overview

Smash or Pass is a Tauri/React app for browsing randomly selected anime images, choosing Smash or Pass, and optionally uploading an image. On startup, the UI restores counters and requests an image; the Rust command chooses an endpoint and response-field mapping, then the UI fetches and displays the image. User reactions update counters persisted in browser storage. The upload modal sends an image and NSFW flag to the hosted upload service. The supplied source shows the PHP JSON and image proxies, but not the hosted service implementation or modal styling.

Main entry points: [`src/App.jsx`](https://github.com/ponozka153/smash-or-pass/blob/main/src/App.jsx) (Main app), [`src/main.jsx`](https://github.com/ponozka153/smash-or-pass/blob/main/src/main.jsx) (React entry), [`src/component/modal.jsx`](https://github.com/ponozka153/smash-or-pass/blob/main/src/component/modal.jsx) (Upload modal), [`src-tauri/src/main.rs`](https://github.com/ponozka153/smash-or-pass/blob/main/src-tauri/src/main.rs) (Tauri command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App interface"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["Main app<br/>[App.jsx]"]
  node_upload["Upload modal<br/>[modal.jsx]"]
end

subgraph group_selection["Image selection"]
  node_command["Tauri command<br/>[main.rs]"]
end

subgraph group_services["Remote services"]
  node_random_apis["Image APIs"]
  node_hosted_random["Hosted random images"]
  node_json_proxy["JSON CORS proxy<br/>[index.php]"]
  node_image_proxy["Image proxy<br/>[image.php]"]
  node_upload_service["Hosted upload service"]
end

subgraph group_state["User state"]
  node_browser_storage[("Browser localStorage")]
end

node_user(("User"))

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_user -->|"interacts"| node_app
node_app -->|"invokes selector"| node_command
node_command -->|"returns endpoint mapping"| node_app
node_app -->|"fetches image data"| node_random_apis
node_app -->|"fetches fallback image"| node_hosted_random
node_app -.->|"fetches via proxy"| node_json_proxy
node_app -.->|"loads proxied image"| node_image_proxy
node_app -->|"reads and writes counters"| node_browser_storage
node_app -->|"shows modal"| node_upload
node_upload -->|"posts image and flag"| node_upload_service

click node_entry "https://github.com/ponozka153/smash-or-pass/blob/main/src/main.jsx"
click node_app "https://github.com/ponozka153/smash-or-pass/blob/main/src/App.jsx"
click node_upload "https://github.com/ponozka153/smash-or-pass/blob/main/src/component/modal.jsx"
click node_command "https://github.com/ponozka153/smash-or-pass/blob/main/src-tauri/src/main.rs"
click node_json_proxy "https://github.com/ponozka153/smash-or-pass/blob/main/proxy/index.php"
click node_image_proxy "https://github.com/ponozka153/smash-or-pass/blob/main/proxy/image.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_entry,node_app,node_upload,node_user toneBlue
class node_command toneAmber
class node_random_apis,node_hosted_random,node_json_proxy,node_image_proxy,node_upload_service toneMint
class node_browser_storage toneRose
```

## Components

### App interface

- [React entry](https://github.com/ponozka153/smash-or-pass/blob/main/src/main.jsx): `src/main.jsx`
- [Main app](https://github.com/ponozka153/smash-or-pass/blob/main/src/App.jsx): `src/App.jsx`
- [Upload modal](https://github.com/ponozka153/smash-or-pass/blob/main/src/component/modal.jsx): `src/component/modal.jsx`

### Image selection

- [Tauri command](https://github.com/ponozka153/smash-or-pass/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Remote services

- **Image APIs**
- **Hosted random images**
- [JSON CORS proxy](https://github.com/ponozka153/smash-or-pass/blob/main/proxy/index.php): `proxy/index.php`
- [Image proxy](https://github.com/ponozka153/smash-or-pass/blob/main/proxy/image.php): `proxy/image.php`
- **Hosted upload service**

### User state

- **Browser localStorage**

### Other components

- **User**

## Connections

- User → React entry: opens app
- React entry → Main app: renders
- User → Main app: interacts
- Main app → Tauri command: invokes selector
- Tauri command → Main app: returns endpoint mapping
- Main app → Image APIs: fetches image data
- Main app → Hosted random images: fetches fallback image
- Main app → JSON CORS proxy: fetches via proxy
- Main app → Image proxy: loads proxied image
- Main app → Browser localStorage: reads and writes counters
- Main app → Upload modal: shows modal
- Upload modal → Hosted upload service: posts image and flag
