# mashiox/analytics-engine architecture

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

- Interactive diagram: https://gitdiagram.com/mashiox/analytics-engine
- Repository: https://github.com/mashiox/analytics-engine

## Overview

Analytics Engine combines market-data collection, persistence, and dashboard analytics. The documented workflow is n8n polling live market data and persisting it to PostgreSQL, with Metabase providing analytics and visualizations. The repository also includes a BTC polling workflow and SQL initialization files, but their runtime wiring is not shown in the available evidence. Relationships below reflect the README; no source excerpts were available.

Main entry points: [`n8n`](https://github.com/mashiox/analytics-engine/tree/main/n8n) (n8n polling), [`metabase`](https://github.com/mashiox/analytics-engine/tree/main/metabase) (Metabase dashboards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_n8n["n8n polling"]
  node_btc_workflow["BTC poll workflow<br/>[BTC_Poll.json]"]
end

subgraph group_storage["Data storage"]
  node_postgres[("PostgreSQL")]
  node_db_init["Database initialization<br/>[00-databases.sql]"]
  node_finance_init["Finance schema<br/>[10-finance.sql]"]
end

subgraph group_analytics["Analytics"]
  node_metabase["Metabase dashboards"]
end

node_market_source(("Market data"))

node_n8n -->|"polls"| node_market_source
node_n8n -->|"persists data"| node_postgres
node_postgres -.->|"supplies analytics"| node_metabase

click node_n8n "https://github.com/mashiox/analytics-engine/tree/main/n8n"
click node_btc_workflow "https://github.com/mashiox/analytics-engine/blob/main/n8n/BTC_Poll.json"
click node_db_init "https://github.com/mashiox/analytics-engine/blob/main/sql/initdb.d/00-databases.sql"
click node_finance_init "https://github.com/mashiox/analytics-engine/blob/main/sql/initdb.d/10-finance.sql"
click node_metabase "https://github.com/mashiox/analytics-engine/tree/main/metabase"

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_n8n,node_btc_workflow toneBlue
class node_postgres,node_db_init,node_finance_init toneAmber
class node_metabase toneMint
class node_market_source toneIndigo
```

## Components

### Data collection

- [n8n polling](https://github.com/mashiox/analytics-engine/tree/main/n8n): `n8n`
- [BTC poll workflow](https://github.com/mashiox/analytics-engine/blob/main/n8n/BTC_Poll.json): `n8n/BTC_Poll.json`

### Data storage

- **PostgreSQL**
- [Database initialization](https://github.com/mashiox/analytics-engine/blob/main/sql/initdb.d/00-databases.sql): `sql/initdb.d/00-databases.sql`
- [Finance schema](https://github.com/mashiox/analytics-engine/blob/main/sql/initdb.d/10-finance.sql): `sql/initdb.d/10-finance.sql`

### Analytics

- [Metabase dashboards](https://github.com/mashiox/analytics-engine/tree/main/metabase): `metabase`

### Other components

- **Market data**

## Connections

- n8n polling → Market data: polls (evidence: `README.md`)
- n8n polling → PostgreSQL: persists data (evidence: `README.md`)
- PostgreSQL → Metabase dashboards: supplies analytics
