TradingBoard Backend - Express.js API service with PostgreSQL for persistent data storage, CRUD oper
1.9K
A modern, real-time trading dashboard built with React, TypeScript, and Tailwind CSS. Features live market data, technical indicators, customizable watchlists, and AI-powered news summarization.
Real-Time Market Data
Charts & Technical Indicators
Quick Start with Deployment Script:
# Clone repository
git clone https://github.com/cgeorges/tradingboard.git
cd tradingboard
# For Linux/macOS
chmod +x deploy.sh
./deploy.sh dev
# For Windows PowerShell
.\deploy.ps1 dev
Manual Docker Setup:
# Create environment file
cp .env.sample .env
# Edit .env with your database credentials and API keys
# Start all services (app + PostgreSQL)
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Install dependencies
npm install
# Set up PostgreSQL database
# - Install PostgreSQL locally or use cloud provider
# - Create database and run init.sql script
# - Configure .env with your database credentials
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
If running locally without Docker:
# Create database
createdb tradingboard
# Run initialization script
psql -d tradingboard -f init.sql
# Or connect and run manually
psql -d tradingboard
\i init.sql
The application is containerized with PostgreSQL for easy production deployment:
.env.example to .env and configure your database credentials:cp .env.example .env
# Edit .env with your preferred database credentials
npm install
# Build and run with Docker Compose (includes PostgreSQL)
docker-compose up -d
# Or build and run manually (requires external PostgreSQL)
docker build -t tradingboard .
docker run -p 8080:80 \
-e DB_HOST=your_postgres_host \
-e DB_USER=your_db_user \
-e DB_PASSWORD=your_db_password \
tradingboard
The application will be available at http://localhost:8080
Development (build locally):
# Stop services
docker-compose down
# Stop and remove volumes (ā ļø deletes database data)
docker-compose down -v
# View logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f frontend
docker-compose logs -f backend
docker-compose logs -f postgres
# Rebuild and restart
docker-compose up --build -d
# Check health status
docker-compose ps
# Access PostgreSQL directly
docker-compose exec postgres psql -U ${DB_USER} -d ${DB_NAME}
Production (use published images):
# Deploy with published images
docker-compose -f docker-compose.prod.yml up -d
# Update to latest images
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -d
# View production logs
docker-compose -f docker-compose.prod.yml logs -f
# Scale services (if needed)
docker-compose -f docker-compose.prod.yml up -d --scale backend=2
# Backup database
docker-compose exec postgres pg_dump -U tradingboard_user tradingboard > backup.sql
# Restore database
docker-compose exec -T postgres psql -U tradingboard_user tradingboard < backup.sql
# Reset database (ā ļø deletes all data)
docker-compose down -v
docker-compose up -d
docker login
# Replace 'yourusername' with your Docker Hub username
docker build -t yourusername/tradingboard:latest .
docker build -t yourusername/tradingboard:v1.0.0 .
docker push yourusername/tradingboard:latest
docker push yourusername/tradingboard:v1.0.0
docker run -p 8080:80 yourusername/tradingboard:latest
Create a Personal Access Token:
write:packages scopeLogin to GHCR:
echo $GITHUB_TOKEN | docker login ghcr.io -u yourusername --password-stdin
# Replace 'yourusername' with your GitHub username
docker build -t ghcr.io/yourusername/tradingboard:latest .
docker build -t ghcr.io/yourusername/tradingboard:v1.0.0 .
docker push ghcr.io/yourusername/tradingboard:latest
docker push ghcr.io/yourusername/tradingboard:v1.0.0
Automated builds are already configured! Every merge to the main branch automatically builds and pushes both frontend and backend images to Docker Hub.
Published Images:
cgeorges/tradingboard-frontend:latestcgeorges/tradingboard-backend:latestSetup Requirements:
Create Docker Hub Access Token:
Add GitHub Secrets:
DOCKERHUB_USERNAME: cgeorgesDOCKERHUB_TOKEN: (your Docker Hub access token)Trigger Build:
What happens automatically:
Production Deployment:
Use the production compose file with published images:
# Quick production deployment with script
./deploy.sh prod # Linux/macOS
.\deploy.ps1 prod # Windows PowerShell
# Manual production deployment
cp .env.example .env.prod
# Edit .env.prod with your production configuration
docker-compose -f docker-compose.prod.yml --env-file .env.prod up -d
# Or pull latest images manually
docker pull cgeorges/tradingboard-frontend:latest
docker pull cgeorges/tradingboard-backend:latest
Deployment Script Features:
Manual Publishing (if needed):
TradingBoard now uses PostgreSQL for persistent data storage, replacing the previous IndexedDB implementation.
If you're upgrading from a previous version that used IndexedDB:
Create a .env file in the root directory:
# Database Configuration (Required)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=tradingboard
DB_USER=tradingboard_user
DB_PASSWORD=tradingboard_password
# Polygon.io API Key for real-time stock data and news
# Get your free API key at: https://polygon.io/
VITE_POLYGON_API_KEY=your_polygon_api_key_here
# OpenAI API Key for agent-forge AI summarization (optional)
# Get your API key at: https://platform.openai.com/api-keys
VITE_OPENAI_API_KEY=your_openai_api_key_here
# WebSocket URL for real-time data (optional - for premium providers)
# Examples: wss://socket.polygon.io/stocks, wss://ws.finnhub.io
VITE_WS_URL=wss://your-websocket-url.com
# Generic API key for other data providers (optional)
VITE_API_KEY=your_other_api_key_here
The application now uses real market data APIs:
Real data is now enabled by default! Set your VITE_ALPHA_VANTAGE_API_KEY to get live market data.
.env file with your API keyWatchlist Management
Chart Analysis
News Monitoring
The dashboard now includes agent-forge framework integration for enhanced news analysis:
// News analysis is automatically triggered
const analysis = await newsAnalysisService.analyzeNews(newsItem);
// Returns: {
// summary: "AI-generated trading-focused summary",
// sentiment: "positive" | "negative" | "neutral",
// keyPoints: ["Key insight 1", "Key insight 2"],
// marketImpact: "high" | "medium" | "low",
// tradingSignals: ["Bullish earnings beat", "Analyst upgrade"]
// }
The newsAnalysisService can be easily replaced with full agent-forge AI agents:
// TODO: Replace with agent-forge implementation
// const newsAgent = new TradingNewsAgent();
// await newsAgent.summarizeNews(newsItem);
src/
āāā components/ # React components
ā āāā Header.tsx # Status and title bar
ā āāā Watchlist.tsx # Stock list and management
ā āāā ChartPanel.tsx # Charts and indicators
ā āāā NewsPanel.tsx # News feed and filtering
āāā services/ # Business logic
ā āāā marketDataService.ts # WebSocket and API calls
āāā store/ # State management
ā āāā marketStore.ts # Zustand store
āāā types/ # TypeScript definitions
ā āāā market.ts # Data interfaces
āāā index.css # Global styles and theme
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSEā file for details.
TradingBoard - Your command center for professional trading decisions.
Content type
Image
Digest
sha256:c68d8e53dā¦
Size
139.1 MB
Last updated
about 1 year ago
docker pull cgeorges/tradingboard-backend