# 7mxd/xbloom-recolor architecture

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

- Interactive diagram: https://gitdiagram.com/7mxd/xbloom-recolor
- Repository: https://github.com/7mxd/xbloom-recolor

## Overview

xBloom Recolor is a small web app for recolouring shared xBloom recipe cards. A user submits a share link to view recipe details, chooses a colour, and saves; the server re-fetches the recipe, checks for an existing matching copy, and returns a share link for a reused or newly created copy. The main internal layer is the xBloom API client, which handles public recipe reads and authenticated service-account operations. The UI source was not sampled, so its API interactions are based on the README workflow; the precise UI-to-endpoint wiring is not shown.

Main entry points: [`lib/xbloom.js`](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js) (Recolour and dedupe), [`lib/handlers.js`](https://github.com/7mxd/xbloom-recolor/blob/main/lib/handlers.js) (Request handlers), [`public/index.html`](https://github.com/7mxd/xbloom-recolor/blob/main/public/index.html) (Recipe UI), [`api/recipe.js`](https://github.com/7mxd/xbloom-recolor/blob/main/api/recipe.js) (Recipe endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webui["Recipe UI<br/>[index.html]"]
end

subgraph group_requests["Request handling"]
  node_recipe_route["Recipe endpoint<br/>[recipe.js]"]
  node_save_route["Save endpoint<br/>[save.js]"]
  node_handlers["Request handlers<br/>[handlers.js]"]
end

subgraph group_integration["xBloom integration"]
  node_recipe_read["Shared recipe read<br/>[xbloom.js]"]
  node_save_flow["Recolour and dedupe<br/>[xbloom.js]"]
  node_auth["Service account auth<br/>[xbloom.js]"]
  node_recipe_lookup["Account recipe lookup<br/>[xbloom.js]"]
  node_recipe_create["Recipe copy creation<br/>[xbloom.js]"]
end

node_user(("Recipe user"))
node_xbloom["xBloom cloud API"]

node_user -->|"submits recipe"| node_webui
node_webui -->|"requests details"| node_recipe_route
node_webui -->|"requests save"| node_save_route
node_recipe_route -->|"delegates to"| node_handlers
node_save_route -->|"delegates to"| node_handlers
node_handlers -->|"fetches recipe"| node_recipe_read
node_handlers -->|"recolours recipe"| node_save_flow
node_save_flow -->|"checks existing copy"| node_recipe_lookup
node_save_flow -->|"creates copy"| node_recipe_create
node_recipe_read -->|"reads shared recipe"| node_xbloom
node_auth -->|"logs in"| node_xbloom
node_recipe_lookup -->|"lists account recipes"| node_xbloom
node_recipe_create -->|"saves recipe"| node_xbloom
node_save_flow -->|"authenticates via"| node_auth

click node_webui "https://github.com/7mxd/xbloom-recolor/blob/main/public/index.html"
click node_recipe_route "https://github.com/7mxd/xbloom-recolor/blob/main/api/recipe.js"
click node_save_route "https://github.com/7mxd/xbloom-recolor/blob/main/api/save.js"
click node_handlers "https://github.com/7mxd/xbloom-recolor/blob/main/lib/handlers.js"
click node_recipe_read "https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js"
click node_save_flow "https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js"
click node_auth "https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js"
click node_recipe_lookup "https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js"
click node_recipe_create "https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js"

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_webui,node_user toneBlue
class node_recipe_route,node_save_route,node_handlers toneAmber
class node_recipe_read,node_save_flow,node_auth,node_recipe_lookup,node_recipe_create,node_xbloom toneMint
```

## Components

### User interface

- [Recipe UI](https://github.com/7mxd/xbloom-recolor/blob/main/public/index.html): `public/index.html`

### Request handling

- [Recipe endpoint](https://github.com/7mxd/xbloom-recolor/blob/main/api/recipe.js): `api/recipe.js`
- [Save endpoint](https://github.com/7mxd/xbloom-recolor/blob/main/api/save.js): `api/save.js`
- [Request handlers](https://github.com/7mxd/xbloom-recolor/blob/main/lib/handlers.js): `lib/handlers.js`

### xBloom integration

- [Shared recipe read](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js): `lib/xbloom.js`
- [Recolour and dedupe](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js): `lib/xbloom.js`
- [Service account auth](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js): `lib/xbloom.js`
- [Account recipe lookup](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js): `lib/xbloom.js`
- [Recipe copy creation](https://github.com/7mxd/xbloom-recolor/blob/main/lib/xbloom.js): `lib/xbloom.js`

### Other components

- **Recipe user**
- **xBloom cloud API**

## Connections

- Recipe user → Recipe UI: submits recipe (evidence: `README.md`)
- Recipe UI → Recipe endpoint: requests details (evidence: `README.md`)
- Recipe UI → Save endpoint: requests save (evidence: `README.md`)
- Recipe endpoint → Request handlers: delegates to (evidence: `api/recipe.js`)
- Save endpoint → Request handlers: delegates to (evidence: `api/save.js`)
- Request handlers → Shared recipe read: fetches recipe (evidence: `lib/handlers.js`)
- Request handlers → Recolour and dedupe: recolours recipe (evidence: `lib/handlers.js`)
- Recolour and dedupe → Account recipe lookup: checks existing copy (evidence: `lib/xbloom.js`)
- Recolour and dedupe → Recipe copy creation: creates copy (evidence: `lib/xbloom.js`)
- Shared recipe read → xBloom cloud API: reads shared recipe (evidence: `README.md`)
- Service account auth → xBloom cloud API: logs in (evidence: `README.md`)
- Account recipe lookup → xBloom cloud API: lists account recipes (evidence: `README.md`)
- Recipe copy creation → xBloom cloud API: saves recipe (evidence: `README.md`)
- Recolour and dedupe → Service account auth: authenticates via (evidence: `lib/xbloom.js`)
