Skip to main content
NeuraTrade is a multi-service crypto trading platform built with a Go backend and Bun TypeScript sidecar services for exchange and Telegram integrations. The architecture is designed for native-first deployment with robust autonomous trading capabilities.

Multi-Service Design

NeuraTrade follows a service-oriented architecture with three core services:

backend-api

Go API server with domain logic, persistence, and autonomous orchestration

ccxt-service

Bun + CCXT exchange bridge for unified exchange access

telegram-service

Bun + grammY bot for notifications and operator interaction

Design Philosophy

Go for Performance: Backend API leverages Go’s concurrency model for high-throughput market data processing and real-time arbitrage detection.
TypeScript for Ecosystem: Sidecar services use Bun + TypeScript to leverage mature exchange (CCXT) and bot (grammY) libraries.

Technology Stack

┌─────────────────────────────────────────────────────────────┐
│                    NeuraTrade Platform                      │
├─────────────────────────────────────────────────────────────┤
│  Backend API (Go 1.26+)                                     │
│  ├─ REST API (Gin framework)                                │
│  ├─ Domain Services (trading logic)                         │
│  ├─ AI Agents (Analyst, Trader, Risk Manager)               │
│  └─ Quest Engine (autonomous scheduling)                    │
├─────────────────────────────────────────────────────────────┤
│  Sidecar Services (Bun 1.3+ / TypeScript)                   │
│  ├─ ccxt-service (HTTP + gRPC)                              │
│  └─ telegram-service (HTTP + gRPC)                          │
├─────────────────────────────────────────────────────────────┤
│  Data Layer                                                 │
│  ├─ SQLite (default runtime database)                       │
│  └─ Redis (caches, queues, distributed locks)               │
└─────────────────────────────────────────────────────────────┘

Core Components

ComponentTechnologyPurpose
Backend APIGo 1.26+Trading logic, arbitrage engines, AI agents, API
CCXT ServiceBun + CCXTExchange communication and order execution
Telegram ServiceBun + grammYBot commands and notification delivery
DatabaseSQLitePersistent storage for trades, signals, positions
CacheRedisReal-time state, distributed locks, queues

Native-First Deployment

NeuraTrade is designed for native binary deployment without container dependencies:
# Build all services
make build

# Start all services natively
./bin/neuratrade gateway start

# Check health
curl http://localhost:8080/health

Process Management

The neuratrade CLI orchestrates all services:
  • Single Gateway: One command to start/stop all services
  • Process Monitoring: Health checks and automatic restarts
  • Native PIDs: Services run as native OS processes
  • Runtime State: Stored in NEURATRADE_HOME (default: ~/.neuratrade)
Native deployment provides faster startup times, easier debugging, and lower resource overhead compared to containerized deployments.

Data Flow Overview

See Data Flow for detailed pipeline documentation.

Service Communication

Services communicate via multiple protocols optimized for their use cases:

HTTP/REST

  • Backend API → CCXT Service (exchange operations)
  • Backend API → Telegram Service (notifications)
  • External clients → Backend API (public API)

gRPC

  • Backend API ↔ Telegram Service (delivery hooks)
  • Backend API ↔ CCXT Service (streaming data)

Redis PubSub

  • Quest triggers and events
  • Real-time position updates
  • Emergency kill switch

Service Architecture

Detailed service design and communication patterns

Quest Engine

Autonomous scheduling and quest orchestration

Key Architectural Decisions

Go provides:
  • Concurrency: Goroutines for parallel market data collection
  • Performance: Sub-millisecond arbitrage detection
  • Type Safety: Decimal types for money math (no float errors)
  • Deployment: Single binary with no runtime dependencies
Bun + TypeScript offers:
  • Ecosystem: Mature CCXT library for 100+ exchanges
  • Bot Framework: grammY for Telegram integration
  • Fast Startup: Bun’s performance for sidecar services
  • Type Safety: TypeScript for API contracts
SQLite is the default runtime database because:
  • Zero Config: No separate database server to manage
  • Single File: Easy backup and migration
  • Performance: Fast for read-heavy workloads
  • ACID: Full transactional support
PostgreSQL is supported for production deployments requiring multi-instance scaling.
Redis provides:
  • Distributed Locks: Quest coordination across instances
  • PubSub: Real-time event streaming
  • Caching: Market data and API response caching
  • Queues: Asynchronous job processing

Next Steps

Services

Deep dive into each service’s responsibilities

Data Flow

Complete data processing pipeline

Quest Engine

Autonomous scheduling and execution

AI Agents

Multi-agent decision system

Build docs developers (and LLMs) love