System Design

System Architecture

A modern, cloud-native 3-tier architecture designed for real-time signal delivery, scalability, and reliability.

High-Level Overview

Crypto AI Bot

Python-based trading bot running locally or on cloud VM

  • • Bar Reaction 5M strategy
  • • Multi-agent AI system
  • • Kraken exchange integration
  • • Risk management engine

Redis Cloud

Message broker and real-time data store

  • • TLS-encrypted streams
  • • Pub/sub messaging
  • • Sub-millisecond latency
  • • 99.5% uptime SLA

Signals API

FastAPI backend hosted on Fly.io

  • • RESTful endpoints
  • • Server-Sent Events (SSE)
  • • Prometheus metrics
  • • Global edge deployment

Web Frontend

Next.js 14 app deployed on Vercel

  • • React 18 + TypeScript
  • • Recharts visualization
  • • SWR data fetching
  • • Edge runtime

Data Flow

1

Signal Generation

The crypto AI bot monitors Kraken exchange price feeds for active trading pairs. When the Bar Reaction 5M strategy detects a high-confidence trade setup, it generates a signal with entry price, stop loss, and take profit levels.

2

Stream Publishing

The bot publishes signals to Redis Cloud using TLS-encrypted streams (signals:paper or signals:live). PnL updates are published to the pnl:equity stream. Redis acts as the real-time message broker between the bot and API.

3

API Consumption

The signals-api FastAPI backend consumes signals from Redis streams and serves them via RESTful endpoints (/v1/signals) and Server-Sent Events (/v1/signals/stream). It also aggregates PnL data and calculates performance metrics.

4

Frontend Rendering

The Next.js frontend fetches signals and PnL data from the API using SWR for caching and EventSource for real-time streams. Users see live signal cards, equity charts, and performance metrics updated in real-time.

Backend Stack

  • Bot: Python 3.11, pandas, ccxt, asyncio
  • API: FastAPI, Uvicorn, Pydantic v2
  • Database: Redis Cloud (TLS)
  • Monitoring: Prometheus, Loguru
  • Deployment: Fly.io (global edge)

Frontend Stack

  • Framework: Next.js 14, React 18
  • Language: TypeScript
  • Styling: Tailwind CSS, Framer Motion
  • Data Fetching: SWR, EventSource
  • Charts: Recharts
  • Deployment: Vercel (serverless)

Security & Reliability

Security Measures

  • • End-to-end TLS encryption (Redis, API, Frontend)
  • • Environment variable secrets management
  • • CORS protection on API endpoints
  • • Rate limiting (60 req/min per IP)
  • • No sensitive keys in frontend code

Reliability Features

  • • Exponential backoff retry logic
  • • Dead letter queue for failed messages
  • • Health check endpoints at all layers
  • • Prometheus metrics collection
  • • 99.5% uptime SLA (monitored)

For technical implementation details, see our GitHub repository or read the API Reference.