# mattias-wiberg/albionflipper architecture

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

- Interactive diagram: https://gitdiagram.com/mattias-wiberg/albionflipper
- Repository: https://github.com/mattias-wiberg/albionflipper

## Overview

AlbionFlipper is a browser-based Albion Online Black Market trading tool. Players select item filters, cities, and freshness/profit limits; the app requests market data, compares city sell orders with Black Market buy orders, calculates profitable combinations, and presents trades to sort and collect in a cart. The README also documents item-data updates through Albion Data Client and newer private-database and upgrade-flip capabilities, whose implementation is not shown in the sampled source. Internal call paths beyond the excerpts are represented only where directly supported.

Main entry points: [`js/main.js`](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js) (Flip workflow), [`index.php`](https://github.com/mattias-wiberg/albionflipper/blob/master/index.php) (Flipper page), [`js/items.js`](https://github.com/mattias-wiberg/albionflipper/blob/master/js/items.js) (Item catalog), [`js/bootstrap/bootstrap-sortable.js`](https://github.com/mattias-wiberg/albionflipper/blob/master/js/bootstrap/bootstrap-sortable.js) (Table sorting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Trading interface"]
  node_page["Flipper page<br/>[index.php]"]
  node_results["Trade results<br/>[main.js]"]
  node_cart["Trade cart<br/>[index.php]"]
end

subgraph group_analysis["Market analysis"]
  node_workflow["Flip workflow<br/>[main.js]"]
  node_market_api{{"Market API"}}
  node_city_split["City grouping<br/>[main.js]"]
  node_trade_analysis["Profit analysis<br/>[main.js]"]
  node_quality_upgrade["Quality combinations<br/>[main.js]"]
  node_caerleon_check["Caerleon warning<br/>[main.js]"]
  node_private_db[("Private database")]
end

subgraph group_catalog["Item catalog"]
  node_catalog_data["Item catalog<br/>[items.js]"]
  node_item_names["Item mappings<br/>[items_formatter.js]"]
end

subgraph group_support["Table utilities"]
  node_sortable["Table sorting"]
  node_date_util["Date utilities<br/>[moment.js]"]
end

node_player(("Player"))
node_data_client(("Albion Data Client"))

node_player -->|"uses"| node_page
node_page -.->|"starts"| node_workflow
node_workflow -->|"parses catalog"| node_catalog_data
node_workflow -->|"fetches prices"| node_market_api
node_market_api -->|"returns data"| node_workflow
node_workflow -->|"groups cities"| node_city_split
node_workflow -->|"compares prices"| node_trade_analysis
node_trade_analysis -->|"checks combinations"| node_quality_upgrade
node_trade_analysis -->|"adds warning"| node_caerleon_check
node_workflow -->|"adds rows"| node_results
node_player -.->|"sorts trades"| node_results
node_results -.->|"sorts by column"| node_sortable
node_player -->|"selects trades"| node_cart
node_data_client -.->|"updates market data"| node_market_api
node_page -.->|"uses private storage"| node_private_db
node_item_names -.->|"maps item names"| node_catalog_data
node_date_util -.->|"supports date sorting"| node_sortable

click node_page "https://github.com/mattias-wiberg/albionflipper/blob/master/index.php"
click node_workflow "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_city_split "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_trade_analysis "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_quality_upgrade "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_caerleon_check "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_results "https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js"
click node_cart "https://github.com/mattias-wiberg/albionflipper/blob/master/index.php"
click node_catalog_data "https://github.com/mattias-wiberg/albionflipper/blob/master/js/items.js"
click node_item_names "https://github.com/mattias-wiberg/albionflipper/blob/master/js/items_formatter.js"
click node_sortable "https://github.com/mattias-wiberg/albionflipper/blob/master/js/bootstrap/bootstrap-sortable.js"
click node_date_util "https://github.com/mattias-wiberg/albionflipper/blob/master/js/moment.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_page,node_results,node_cart,node_data_client toneBlue
class node_workflow,node_market_api,node_city_split,node_trade_analysis,node_quality_upgrade,node_caerleon_check,node_private_db toneAmber
class node_catalog_data,node_item_names toneMint
class node_sortable,node_date_util toneRose
class node_player toneIndigo
```

## Components

### Trading interface

- [Flipper page](https://github.com/mattias-wiberg/albionflipper/blob/master/index.php): `index.php`
- [Trade results](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- [Trade cart](https://github.com/mattias-wiberg/albionflipper/blob/master/index.php): `index.php`

### Market analysis

- [Flip workflow](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- **Market API**
- [City grouping](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- [Profit analysis](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- [Quality combinations](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- [Caerleon warning](https://github.com/mattias-wiberg/albionflipper/blob/master/js/main.js): `js/main.js`
- **Private database**

### Item catalog

- [Item catalog](https://github.com/mattias-wiberg/albionflipper/blob/master/js/items.js): `js/items.js`
- [Item mappings](https://github.com/mattias-wiberg/albionflipper/blob/master/js/items_formatter.js): `js/items_formatter.js`

### Table utilities

- [Table sorting](https://github.com/mattias-wiberg/albionflipper/blob/master/js/bootstrap/bootstrap-sortable.js): `js/bootstrap/bootstrap-sortable.js`
- [Date utilities](https://github.com/mattias-wiberg/albionflipper/blob/master/js/moment.js): `js/moment.js`

### Other components

- **Player**
- **Albion Data Client**

## Connections

- Player → Flipper page: uses (evidence: `README.md`)
- Flipper page → Flip workflow: starts
- Flip workflow → Item catalog: parses catalog (evidence: `js/main.js`)
- Flip workflow → Market API: fetches prices (evidence: `js/main.js`)
- Market API → Flip workflow: returns data (evidence: `js/main.js`)
- Flip workflow → City grouping: groups cities (evidence: `js/main.js`)
- Flip workflow → Profit analysis: compares prices (evidence: `js/main.js`)
- Profit analysis → Quality combinations: checks combinations (evidence: `js/main.js`)
- Profit analysis → Caerleon warning: adds warning (evidence: `js/main.js`)
- Flip workflow → Trade results: adds rows (evidence: `js/main.js`)
- Player → Trade results: sorts trades (evidence: `README.md`)
- Trade results → Table sorting: sorts by column
- Player → Trade cart: selects trades (evidence: `README.md`)
- Albion Data Client → Market API: updates market data (evidence: `README.md`)
- Flipper page → Private database: uses private storage (evidence: `README.md`)
- Item mappings → Item catalog: maps item names
- Date utilities → Table sorting: supports date sorting
