An AI-powered cryptocurrency trading recommendation platform that analyzes market data and social sentiment to provide buy/sell/hold recommendations for cryptocurrencies.
Crypto Bro combines real-time market data from CoinGecko, social sentiment from Twitter/X, and OpenAI's language models to generate intelligent trading recommendations. The platform stores predictions in PostgreSQL and provides observability through Langfuse.
- User selects a cryptocurrency in the frontend
- Backend fetches data from multiple sources:
- Market data (price, volume, market cap) from CoinGecko
- Social sentiment from Twitter/X API
- Historical data and technical indicators
- AI generates recommendation using OpenAI with a structured prompt
- Prediction is stored in PostgreSQL with metadata (risk level, rationale, trace ID)
- Results are displayed in the frontend with detailed analysis
This is a monorepo containing three main components:
| Directory | Purpose |
|---|---|
| crypto-bro-frontend | React + Vite + TypeScript SPA with Tailwind CSS, TanStack Query, and shadcn-style UI components. Handles user interactions and displays AI predictions. |
| crypto-bro-backend | NestJS REST API with TypeORM and PostgreSQL. Integrates with CoinGecko, Twitter/X, OpenAI, and Langfuse. Serves prediction endpoints and manages data persistence. |
| crypto-bro-ml-model | Python workspace for data collection and machine learning experiments. Contains Kaggle datasets, data aggregation scripts (gather_data.py), and training scripts in previous_attempts/. |
graph LR
Frontend[React Frontend] -->|API Calls| Backend[NestJS Backend]
Backend -->|Market Data| CoinGecko[CoinGecko API]
Backend -->|Sentiment| Twitter[Twitter/X API]
Backend -->|AI Analysis| OpenAI[OpenAI API]
Backend -->|Store| PostgreSQL[(PostgreSQL)]
Backend -->|Observability| Langfuse[Langfuse]
- React 19 - UI framework
- Vite - Build tool and dev server
- TypeScript - Type safety
- Tailwind CSS - Styling
- TanStack Query - Data fetching and caching
- shadcn/ui - UI component library
- NestJS - Node.js framework
- TypeORM - ORM for PostgreSQL
- PostgreSQL - Database
- OpenAI AI SDK - AI model integration
- Langfuse - LLM observability
- CoinGecko API - Cryptocurrency market data
- Twitter/X API - Social sentiment data
- Tardis - Exchange and symbol data
- Python 3 - Data processing
- pandas - Data manipulation
- TensorFlow - Machine learning
- scikit-learn - ML utilities
- ta - Technical analysis indicators
- Node.js (v18 or higher) - For frontend and backend
- PostgreSQL (v12 or higher) - For backend database
- Python 3 (optional) - For ML/data scripts
-
Create the database:
CREATE DATABASE crypto_bro;
-
Navigate to backend directory:
cd crypto-bro-backend -
Install dependencies:
npm install
-
Configure environment variables:
Create a
.envfile incrypto-bro-backend/with the following variables:# Database Configuration DB_HOST=localhost DB_PORT=5432 DB_USERNAME=postgres DB_PASSWORD=postgres DB_NAME=crypto_bro # Server Configuration PORT=4000 NODE_ENV=development # OpenAI Configuration OPENAI_API_KEY=your_openai_api_key_here # Langfuse Configuration (for observability) LANGFUSE_SECRET_KEY=your_langfuse_secret_key LANGFUSE_PUBLIC_KEY=your_langfuse_public_key LANGFUSE_URL=https://cloud.langfuse.com # CoinGecko API Configuration COINGECKO_API_URL=https://api.coingecko.com/api/v3 COINGECKO_API_KEY=your_coingecko_api_key_here # Twitter/X API Configuration TWITTER_IO_API_URL=your_twitter_io_api_url TWITTER_IO_API_KEY=your_twitter_io_api_key
-
Start the backend server:
npm run start:dev
The API will be available at
http://localhost:4000
-
Navigate to frontend directory:
cd crypto-bro-frontend -
Install dependencies:
pnpm install
Or using npm:
npm install
-
Configure environment variables:
Create a
.envor.env.localfile incrypto-bro-frontend/:VITE_CRYPTO_BRO_BACKEND_URL=http://localhost:4000
-
Start the development server:
pnpm dev
Or using npm:
npm run dev
The frontend will be available at
http://localhost:5173(or the port shown in terminal)
-
Navigate to ML model directory:
cd crypto-bro-ml-model -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run data scripts as needed:
python gather_data.py
The backend provides the following main endpoints:
GET /ai-predictions- Get all predictions (with pagination)GET /ai-predictions/:id- Get a specific prediction by IDPOST /ai-predictions/:assetId- Generate a new AI prediction for the specified cryptocurrency
For detailed API documentation, see crypto-bro-backend/README.md.
The ai_predictions table stores all generated predictions with the following structure:
| Column | Type | Description |
|---|---|---|
| id | uuid | Primary key |
| crypto_symbol | varchar(10) | Cryptocurrency symbol (e.g., BTC, ETH) |
| langfuse_trace_id | uuid | Trace ID for Langfuse monitoring |
| generated_at | timestamp | When the prediction was generated |
| recommendation | enum | Buy, Sell, or Hold |
| summary | text | Detailed analysis and rationale |
| risk_level | enum | Low, Medium, or High |
- Backend README - Detailed backend setup, database configuration, and API documentation
- Frontend README - Frontend development guidelines and ESLint configuration
Backend:
cd crypto-bro-backend
npm run test # Unit tests
npm run test:e2e # End-to-end tests
npm run test:cov # Coverage reportFrontend:
cd crypto-bro-frontend
npm run lint # Lint codeBackend:
cd crypto-bro-backend
npm run build
npm run start:prodFrontend:
cd crypto-bro-frontend
npm run build
npm run preview # Preview production buildThis project is private and unlicensed.