Skip to content

adam-s/volatio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

614 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Volatio

Financial market prediction platform using Fed-style modeling and news sentiment analysis.

Tech Stack

Layer Tech
Runtime Bun
API Hono
Dashboard Next.js 16 + shadcn/ui
ML Python (FastAPI)
Database PostgreSQL + TimescaleDB (2 databases)
Queue BullMQ + Redis
Deployment SST (AWS)

Quick Start

Prerequisites

Before running the project, ensure you have:

Requirement Version Check Command
Node.js 20+ node --version
pnpm 10+ pnpm --version
Docker Latest docker --version
Bun 1.1+ bun --version

Fresh Clone Setup (One Command)

# Clone and setup everything
git clone <repo-url> && cd volatio
make setup

This single command:

  1. Installs all dependencies (pnpm install)
  2. Starts Docker services (TimescaleDB × 2 + Redis)
  3. Waits for services to be healthy
  4. Runs database migrations for both databases
  5. Sets up TimescaleDB hypertables for time-series data
  6. Seeds the superuser account
  7. Seeds sample demonstration data

Alternative using pnpm:

pnpm setup

Environment Configuration

Copy the example environment file:

cp .env.example .env

The .env.example includes all required and optional variables with documentation. For local development, the defaults work out of the box with Docker.

Required for auth:

# Generate a secure auth secret
openssl rand -base64 32
# Add to .env as AUTH_SECRET=<generated-value>

Start Development

pnpm dev

Opens:

Login

Use the seeded test account:

  • Email: admin@volatio.io
  • Password: Trading2024!

Verify Prerequisites

pnpm check

This runs scripts/check-prereqs.sh to verify Docker, Postgres, and Redis are running.

Database Architecture

Volatio uses two TimescaleDB databases:

Database Port Package Purpose
Main DB 5432 @volatio/db Users, economic calendars, news, job schedules
Market DB 5433 @volatio/market-db OHLCV bars, FRED data, SEC filings, Fed documents

Both databases use TimescaleDB hypertables for efficient time-series queries.

Database Commands

Command Description
pnpm db:setup Setup main database (migrate + hypertables + seed)
pnpm market-db:setup Setup market database (migrate + hypertables + seed)
pnpm db:setup:all Setup both databases
pnpm db:migrate Run main DB migrations only
pnpm market-db:migrate Run market DB migrations only
pnpm db:seed Seed superuser account
pnpm db:seed:sample Seed sample demonstration data
pnpm market-db:seed Seed sample market data
pnpm db:reset Drop and recreate main database
pnpm market-db:reset Drop and recreate market database

Makefile Shortcuts

Command Description
make setup Full setup from fresh clone (all dependencies + both databases)
make db-setup Setup both databases (when Docker is already running)
make db-reset Reset and reseed all databases (WARNING: destroys data)
make kill-servers Kill zombie processes on dev ports
make test-all Run all tests (TypeScript + Python)
make py-setup Setup Python ML environment

Development Commands

Essential Commands

Command Description
pnpm dev Start all dev servers (Dashboard + API)
pnpm dev:dashboard Start only Dashboard
pnpm dev:api Start only API
pnpm test Run unit tests (Vitest)
pnpm test:e2e Run E2E tests (Playwright)
pnpm lint Check code style
pnpm typecheck Type check all packages

Docker Commands

Command Description
pnpm docker:up Start all containers (Postgres × 2 + Redis)
pnpm docker:down Stop containers
pnpm docker:logs Tail container logs

Port Allocation

Dev and E2E tests use separate ports to avoid conflicts:

Service Dev Port E2E Port Notes
Dashboard 3000 3100 Next.js
API 3001 3101 Hono (Bun)
Main PostgreSQL 5432 5432 Docker (TimescaleDB)
Market PostgreSQL 5433 5433 Docker (TimescaleDB)
Redis 6379 6379 Docker
ML Service 8000 8000 FastAPI

Port Conflicts

If ports are stuck from zombie processes:

# Kill all dev server processes
make kill-servers

# Or use pnpm
pnpm clean:ports

# Check what's running on ports
lsof -i :3000,:3001,:3100,:3101

Environment Variables

Copy the example and fill in values:

cp .env.example .env

The .env.example file is organized into REQUIRED and OPTIONAL sections.

Required Variables

Variable Description Default
DATABASE_URL Main PostgreSQL connection postgres://volatio:vibes123@localhost:5432/volatio
MARKET_DATABASE_URL Market data PostgreSQL connection postgres://volatio:vibes123@localhost:5433/volatio_market
AUTH_SECRET NextAuth secret Generate with openssl rand -base64 32
REDIS_URL Redis connection string redis://localhost:6379

Optional Variables

Variable Description Default
NEXT_PUBLIC_API_URL API URL for dashboard http://localhost:3001
ML_SERVICE_URL Python ML service URL http://localhost:8000
SUPERUSER_EMAIL Seed user email admin@volatio.io
SUPERUSER_PASSWORD Seed user password Trading2024!
POLYGON_API_KEY Polygon.io API key For market data
FRED_API_KEY Federal Reserve API key For economic data
BRIGHTDATA_PROXY_URL Proxy for web scraping For scrapers

E2E Test Variables

These are set automatically by Playwright config:

Variable Description
PLAYWRIGHT Set to 1 to enable test auth bypass
AUTH_URL Points to E2E dashboard port

Testing

Unit Tests

# Run all unit tests
pnpm test

# Watch mode
pnpm test:watch

# With coverage
pnpm test:coverage

E2E Tests

E2E tests require the database to be seeded (for test user login):

# Ensure database is ready
pnpm db:setup

# Run E2E tests (starts servers automatically)
pnpm test:e2e

# With UI for debugging
pnpm test:e2e:ui

# Headed mode (see browser)
pnpm test:e2e:headed

All Tests

# TypeScript + Python
make test-all

Troubleshooting

"Connection refused" errors

# Check if Docker is running
docker ps

# Start Docker services
pnpm docker:up

# Check prerequisites
pnpm check

Tests hanging indefinitely

# Kill zombie processes
make kill-servers

# Run tests with explicit timeout
pnpm test:e2e --timeout=30000

"relation does not exist" database errors

# Re-run migrations for both databases
pnpm db:migrate
pnpm market-db:migrate

# Or reset and re-seed everything
make db-reset

Port already in use

# Find what's using the port
lsof -i :3000

# Kill all dev ports
make kill-servers

E2E login failing

Ensure the test user exists:

# Re-seed the database
pnpm db:seed

Project Structure

volatio/
├── apps/
│   ├── api/          # Hono API server (Bun)
│   ├── dashboard/    # Next.js dashboard
│   └── agents/       # Mastra AI agents
├── packages/
│   ├── db/           # Main database (Drizzle ORM + migrations)
│   ├── market-db/    # Market data database (OHLCV, FRED, SEC, Fed)
│   ├── jobs/         # BullMQ job queues + scrapers
│   ├── shared/       # Shared types + utilities
│   ├── browser/      # Playwright browser automation
│   ├── scraper/      # Web scraping utilities
│   └── agents/       # Agent definitions
├── services/
│   └── ml/           # Python FastAPI ML service
├── e2e/              # Playwright E2E tests
├── scripts/          # Dev scripts
└── docs/             # Documentation

Documentation

License

Private

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors