# bhavyakachhadiya/btc-news architecture

> Architecture diagram of the GitHub repository bhavyakachhadiya/btc-news, 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/bhavyakachhadiya/btc-news
- Repository: https://github.com/bhavyakachhadiya/btc-news

## Overview

BTC Signal Engine is a Bitcoin market-intelligence and quantitative research platform: it gathers market and contextual telemetry, computes technical signals, persists decisions, and simulates paper-trading outcomes. The main user workflow runs through the dashboard and analysis API; a cron route can also trigger analysis. The README documents backtesting and strategy research as additional capabilities. Some feature implementations and dashboard wiring are not sampled, so those connections are shown only where the tree or documentation supports them.

Main entry points: [`src/features/analysis/services/orchestrator.service.ts`](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/analysis/services/orchestrator.service.ts) (Analysis orchestrator), [`app/api/analysis/route.ts`](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/analysis/route.ts) (Analysis API), [`src/features/history/services/history.service.ts`](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/history/services/history.service.ts) (Signal history), [`src/features/alerts/services/alert-engine.service.ts`](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/alerts/services/alert-engine.service.ts) (Alert engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and API"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_analysis_api["Analysis API<br/>[route.ts]"]
  node_cron_api["Cron API<br/>[route.ts]"]
  node_signals_api["Signals API<br/>[route.ts]"]
  node_strategy_api["Strategy API<br/>[route.ts]"]
  node_alerts_api["Alerts API<br/>[route.ts]"]
end

subgraph group_inputs["Market Intelligence"]
  node_market["Market data"]
  node_network["Network telemetry<br/>[mempool.service.ts]"]
  node_news["News feed<br/>[news.service.ts]"]
  node_context["Extended context"]
end

subgraph group_decision["Signal Pipeline"]
  node_technical["Technical indicators"]
  node_jev["Jev interpretation<br/>[jev.service.ts]"]
  node_signal["Signal engine<br/>[signal.service.ts]"]
  node_orchestrator["Analysis orchestrator"]
end

subgraph group_research["Research and Simulation"]
  node_paper["Paper trading"]
  node_backtest["Backtesting"]
  node_strategy_storage["Strategy storage"]
end

subgraph group_state["Persistence and Alerts"]
  node_history["Signal history<br/>[history.service.ts]"]
  node_alert_engine["Alert engine"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
end

node_user(("Dashboard user"))
node_mongodb[("MongoDB")]
node_coingecko["CoinGecko"]
node_mempool_service["mempool.space"]
node_rss["RSS news sources"]
node_jev_service["TypeSafe AI"]

node_user -->|"opens"| node_dashboard
node_dashboard -->|"requests analysis"| node_analysis_api
node_cron_api -->|"runs pipeline"| node_orchestrator
node_analysis_api -->|"runs pipeline"| node_orchestrator
node_signals_api -->|"reads history"| node_history
node_signals_api -->|"runs if empty"| node_orchestrator
node_market -->|"fetches data"| node_coingecko
node_network -->|"fetches telemetry"| node_mempool_service
node_news -->|"aggregates feeds"| node_rss
node_orchestrator -->|"fetches market"| node_market
node_orchestrator -->|"fetches network"| node_network
node_orchestrator -->|"fetches news"| node_news
node_orchestrator -->|"fetches context"| node_context
node_orchestrator -->|"calculates indicators"| node_technical
node_orchestrator -->|"sends context"| node_jev
node_jev -.->|"requests interpretation"| node_jev_service
node_orchestrator -->|"builds signal"| node_signal
node_orchestrator -->|"saves decision"| node_history
node_orchestrator -->|"processes signal"| node_paper
node_analysis_api -->|"evaluates alerts"| node_alert_engine
node_alerts_api -->|"manages alerts"| node_alert_engine
node_alert_engine -.->|"dispatches webhook"| node_user
node_history -->|"persists decisions"| node_prisma
node_strategy_api -->|"manages strategies"| node_strategy_storage
node_strategy_storage -->|"reads and writes"| node_prisma
node_prisma -->|"stores records"| node_mongodb

click node_dashboard "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/dashboard/page.tsx"
click node_analysis_api "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/analysis/route.ts"
click node_cron_api "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/cron/route.ts"
click node_signals_api "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/signals/route.ts"
click node_market "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/market/services/coingecko.service.ts"
click node_network "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/network/services/mempool.service.ts"
click node_news "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/news/services/news.service.ts"
click node_context "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/analysis/services/orchestrator.service.ts"
click node_technical "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/technical-analysis/services/technical-analysis.service.ts"
click node_jev "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/jev/services/jev.service.ts"
click node_signal "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/signal/services/signal.service.ts"
click node_orchestrator "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/analysis/services/orchestrator.service.ts"
click node_history "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/history/services/history.service.ts"
click node_paper "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/paper-trading/services/paper-trading.service.ts"
click node_backtest "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/backtesting/services/backtest.service.ts"
click node_strategy_api "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/strategies/route.ts"
click node_strategy_storage "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/strategy-lab/services/strategy-storage.service.ts"
click node_alerts_api "https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/alerts/route.ts"
click node_alert_engine "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/alerts/services/alert-engine.service.ts"
click node_prisma "https://github.com/bhavyakachhadiya/btc-news/blob/main/src/shared/database/prisma.ts"

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_dashboard,node_analysis_api,node_cron_api,node_signals_api,node_strategy_api,node_alerts_api,node_user toneBlue
class node_market,node_network,node_news,node_context,node_mongodb toneAmber
class node_technical,node_jev,node_signal,node_orchestrator toneMint
class node_paper,node_backtest,node_strategy_storage toneRose
class node_history,node_alert_engine,node_prisma,node_coingecko,node_mempool_service,node_rss,node_jev_service toneIndigo
```

## Components

### App and API

- [Dashboard](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Analysis API](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/analysis/route.ts): `app/api/analysis/route.ts`
- [Cron API](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/cron/route.ts): `app/api/cron/route.ts`
- [Signals API](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/signals/route.ts): `app/api/signals/route.ts`
- [Strategy API](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/strategies/route.ts): `app/api/strategies/route.ts`
- [Alerts API](https://github.com/bhavyakachhadiya/btc-news/blob/main/app/api/alerts/route.ts): `app/api/alerts/route.ts`

### Market Intelligence

- [Market data](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/market/services/coingecko.service.ts): `src/features/market/services/coingecko.service.ts`
- [Network telemetry](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/network/services/mempool.service.ts): `src/features/network/services/mempool.service.ts`
- [News feed](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/news/services/news.service.ts): `src/features/news/services/news.service.ts`
- [Extended context](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/analysis/services/orchestrator.service.ts): `src/features/analysis/services/orchestrator.service.ts`

### Signal Pipeline

- [Technical indicators](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/technical-analysis/services/technical-analysis.service.ts): `src/features/technical-analysis/services/technical-analysis.service.ts`
- [Jev interpretation](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/jev/services/jev.service.ts): `src/features/jev/services/jev.service.ts`
- [Signal engine](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/signal/services/signal.service.ts): `src/features/signal/services/signal.service.ts`
- [Analysis orchestrator](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/analysis/services/orchestrator.service.ts): `src/features/analysis/services/orchestrator.service.ts`

### Research and Simulation

- [Paper trading](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/paper-trading/services/paper-trading.service.ts): `src/features/paper-trading/services/paper-trading.service.ts`
- [Backtesting](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/backtesting/services/backtest.service.ts): `src/features/backtesting/services/backtest.service.ts`
- [Strategy storage](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/strategy-lab/services/strategy-storage.service.ts): `src/features/strategy-lab/services/strategy-storage.service.ts`

### Persistence and Alerts

- [Signal history](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/history/services/history.service.ts): `src/features/history/services/history.service.ts`
- [Alert engine](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/features/alerts/services/alert-engine.service.ts): `src/features/alerts/services/alert-engine.service.ts`
- [Prisma client](https://github.com/bhavyakachhadiya/btc-news/blob/main/src/shared/database/prisma.ts): `src/shared/database/prisma.ts`

### Other components

- **Dashboard user**
- **MongoDB**
- **CoinGecko**
- **mempool.space**
- **RSS news sources**
- **TypeSafe AI**

## Connections

- Dashboard user → Dashboard: opens
- Dashboard → Analysis API: requests analysis
- Cron API → Analysis orchestrator: runs pipeline
- Analysis API → Analysis orchestrator: runs pipeline
- Signals API → Signal history: reads history
- Signals API → Analysis orchestrator: runs if empty
- Market data → CoinGecko: fetches data
- Network telemetry → mempool.space: fetches telemetry
- News feed → RSS news sources: aggregates feeds
- Analysis orchestrator → Market data: fetches market
- Analysis orchestrator → Network telemetry: fetches network
- Analysis orchestrator → News feed: fetches news
- Analysis orchestrator → Extended context: fetches context
- Analysis orchestrator → Technical indicators: calculates indicators
- Analysis orchestrator → Jev interpretation: sends context
- Jev interpretation → TypeSafe AI: requests interpretation
- Analysis orchestrator → Signal engine: builds signal
- Analysis orchestrator → Signal history: saves decision
- Analysis orchestrator → Paper trading: processes signal
- Analysis API → Alert engine: evaluates alerts
- Alerts API → Alert engine: manages alerts
- Alert engine → Dashboard user: dispatches webhook
- Signal history → Prisma client: persists decisions
- Strategy API → Strategy storage: manages strategies
- Strategy storage → Prisma client: reads and writes
- Prisma client → MongoDB: stores records
