Skip to content

TechBedouin/OpenTTracker

Repository files navigation

OpenTracker (OTT)

Open Trader Tracker — an open-source trader's journal, performance analytics, and AI coaching platform. Built by traders, for traders. MIT licensed. Own your data.

Status: Beta. Weeks 1-3 complete. 280+ files, ~50,000 LOC. Build passing.

Why OpenTracker?

Every trading journal wants your $29/month forever. They lock your data. They decide what features you get. They don't have a tilt detector that actually stops you from revenge trading.

OpenTracker is different:

  • Open source. Your data is yours. Self-host or use our hosted version. Fork it, modify it, own it.
  • Tilt Detector. The only journal that will lock you out of trading with a 60-second breathing exercise when you're tilted.
  • Behavior Tax. Shows you the exact dollar amount your bad habits cost you this month.
  • Devil's Advocate AI. Before you take a trade, the AI argues AGAINST it using your own past losses as evidence.
  • Prop Firm Compliance. Pre-loaded rules for FTMO, The5ers, Topstep, FundedNext. Real-time violation alerts.
  • Process over P&L. Adherence Score tracks whether you followed your rules — not whether you made money. A losing trade that followed rules is celebrated more than a winning trade that broke them.
  • Pluggable AI. Use OpenAI, Anthropic, OpenRouter, Gemini, local Ollama, or your own key. No vendor lock-in.

Tech Stack

  • Framework: Next.js 14 (App Router) + TypeScript strict
  • UI: React 18 + Shadcn/ui + TailwindCSS + Framer Motion
  • DB: Prisma + Supabase Postgres (with pgvector for semantic search)
  • Auth: NextAuth.js v5 (email/password + OAuth + 2FA TOTP)
  • AI: Pluggable provider (OpenAI / Anthropic / OpenRouter / Gemini / Ollama / Mock)
  • Charts: Recharts + D3.js
  • Storage: Cloudflare R2 (S3-compatible)
  • Email: Resend
  • Deploy: Vercel

Quick Start

1. Clone and install

git clone https://github.com/YOUR_USERNAME/opentracker.git
cd opentracker/app
npm install

2. Set up Supabase (free)

  1. Create a project at supabase.com
  2. Go to SQL Editor and run:
    CREATE EXTENSION IF NOT EXISTS pgcrypto;
    CREATE EXTENSION IF NOT EXISTS pg_trgm;
    CREATE EXTENSION IF NOT EXISTS vector;
  3. Go to Settings → Database, copy the Connection pooler URL and Direct connection URL

3. Configure environment

cp .env.local.example .env.local

Fill in:

  • DATABASE_URL — Supabase pooler URL
  • DIRECT_URL — Supabase direct URL
  • NEXTAUTH_SECRET — generate with openssl rand -base64 32
  • Optionally: an AI provider key (OpenAI, Anthropic, etc.)

4. Push schema and start

npm run db:push    # Creates 81 tables
npm run dev        # http://localhost:3000

Features

Completed (Weeks 1-3)

Section Features
Auth Sign up/in, email verification, password reset, 2FA TOTP, Google/Apple OAuth
Trades Full CRUD, screenshots, filters, stats, edit audit log, pre-flight checklist
Accounts Multi-account, 3-step wizard, CSV import, combined equity, health score
Risk Engine Position size calculator, Day Capital meter, DD tracker, Kelly Criterion, Monte Carlo
Mind State Non-dismissible pre-trade modal, tilt detector, DQS, voice journaling, mood timeline
Analytics Equity curve, 12 KPIs, behavior tax, regime detection, what-if simulator, asymmetry score
Chart Vault Screenshot manager, Konva annotation, AI pattern detection, semantic search, quiz
Playbook Setup library, 7-step wizard, adherence score, drift detector, retirement
AI Coach Streaming chat, trade grading, devil's advocate, weekly reviews, pattern detection

Planned (Weeks 4-12)

  • Goals & Habits (Process Score, milestones, streaks)
  • Reports (Daily/weekly/yearly, Year Wrapped cinematic)
  • Settings (Profile, themes, preferences)
  • Prop Firm Compliance Engine (FTMO, The5ers, Topstep)
  • Broker OAuth (cTrader, Tradovate, TradeLocker)
  • Public profiles
  • PWA + mobile
  • Marketing site

Project Structure

app/
├── prisma/
│   ├── schema.prisma      # 81 models, 61 enums
│   └── seed.ts            # Dev seed data
├── src/
│   ├── app/               # Next.js App Router
│   │   ├── (auth)/        # Auth pages
│   │   ├── (app)/         # Protected app pages
│   │   └── api/           # 75+ API routes
│   ├── components/        # 100+ React components
│   │   ├── ui/            # Shadcn primitives
│   │   ├── motion/        # AnimatedNumber, FadeIn, SlideUp
│   │   ├── auth/          # Auth forms
│   │   ├── app/           # Sidebar, top bar, nav
│   │   ├── trades/        # Trade log components
│   │   ├── accounts/      # Account sync components
│   │   ├── risk/          # Risk engine components
│   │   ├── mind/          # Mind state components
│   │   ├── analytics/     # Performance lab components
│   │   ├── charts/        # Chart vault components
│   │   ├── playbook/      # Playbook components
│   │   └── coach/         # AI coach components
│   ├── lib/               # Business logic
│   │   ├── ai/            # 6-provider AI abstraction
│   │   ├── analytics/     # KPIs, behavior tax, regime, decay
│   │   ├── risk/          # Position size, Kelly, Monte Carlo
│   │   ├── mind/          # DQS, tilt detector, mood
│   │   ├── playbook/      # Adherence, drift, retirement
│   │   ├── coach/         # System prompts, tools, grader
│   │   ├── queries/       # Server-side data fetching
│   │   └── validators/    # Zod schemas
│   └── styles/            # Design tokens
├── prds/                  # 12 section PRDs + master
├── LICENSE                # MIT
├── CONTRIBUTING.md        # How to contribute
└── SETUP.md               # Detailed setup guide

AI Provider

Set AI_PROVIDER in .env.local:

Provider Required Env Default Model
openai OPENAI_API_KEY gpt-4o
anthropic ANTHROPIC_API_KEY claude-3-5-sonnet
openrouter OPENROUTER_API_KEY anthropic/claude-3.5-sonnet
gemini GEMINI_API_KEY gemini-1.5-pro
ollama (local, free) llama3.1
mock (none) echo (for dev)

Scripts

npm run dev          # Start dev server
npm run build        # Production build
npm run start        # Start production server
npm run lint         # ESLint
npm run typecheck    # TypeScript check
npm run db:push      # Push schema to DB
npm run db:studio    # Prisma Studio GUI
npm run db:seed      # Seed sample data
npm run format       # Prettier

Contributing

See CONTRIBUTING.md. PRs welcome. Read the PRDs first.

License

MIT — see LICENSE. Do whatever you want. Just don't blame us for your trading losses.

Disclaimer

OpenTracker is a journaling and analytics tool. It is NOT financial advice. The AI Coach coaches your process, not your trades. You are responsible for your own trading decisions. Trading forex carries substantial risk of loss. Never trade with money you can't afford to lose.

About

OpenTTracker — Premium Trader's Journal & AI Coach

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages