Personal trading journal for IBKR stock trades — always accessible from laptop and phone.
Stack: Next.js (Vercel) · Supabase (PostgreSQL) · GitHub Actions (IBKR ingestion)
IBKR Activity Flex CSV
│
▼
Gmail Inbox
│
▼
GitHub Actions (daily cron)
│
▼
scripts/ingest.py
│
▼
Supabase DB
(trades, cash_transactions, trade_journal)
│
▼
Next.js (Vercel)
/api/v1/* route handlers → domain logic → JSON
│
▼
React UI (browser / phone PWA)
The Next.js app handles everything: API routes run server-side TypeScript that queries Supabase directly, groups FIFO trades, computes KPIs, and serves JSON to the React frontend. There is no separate backend.
- Node.js 18+
- Python 3.11+
git clone https://github.com/omerElezra/TradeOpsJournal.git
cd TradeOpsJournal/frontend
npm installcp frontend/.env.example frontend/.env.local
# Fill in SUPABASE_URL and SUPABASE_SERVICE_KEYSee the Supabase setup section below.
cd frontend
npm run dev
# → http://localhost:3000pip install -r requirements.txt
python scripts/ingest.py- Push to GitHub.
- Go to vercel.com → New Project → import repo.
- Set Root Directory to
frontend. - Add environment variables:
SUPABASE_URLSUPABASE_SERVICE_KEY
- Deploy → you get a permanent URL like
https://tradeopsjournal.vercel.app.
Phone: open the URL in Safari → Share → Add to Home Screen to install as a PWA.
The workflow at .github/workflows/daily_ingest.yml runs Mon–Fri at 08:00 UTC.
Add these secrets to your GitHub repo (Settings → Secrets → Actions):
| Secret | Source |
|---|---|
GMAIL_CLIENT_ID |
Google Cloud Console |
GMAIL_CLIENT_SECRET |
Google Cloud Console |
GMAIL_REFRESH_TOKEN |
python scripts/get_gmail_token.py |
SUPABASE_URL |
Supabase → Settings → API |
SUPABASE_SERVICE_KEY |
Supabase → Settings → API (service_role) |
Trigger manually at any time via Actions → Daily IBKR Trade Ingestion → Run workflow.
Run these migrations in the Supabase SQL editor:
# Apply via script (uses SUPABASE_URL + SUPABASE_ACCESS_TOKEN env vars)
# Run migrations in order — see scripts/migrations/ for the full list.
for f in scripts/migrations/*.sql; do
python scripts/run_migration.py "$f"
doneOr paste the SQL files directly in the Supabase dashboard. See docs/DATA_MODEL.md for the full schema.
- Go to Google Cloud Console → create project → enable Gmail API.
- Create OAuth 2.0 Client ID (type: Desktop) → download as
scripts/credentials.json. - Run the helper:
python scripts/get_gmail_token.py
- Copy the printed
GMAIL_CLIENT_ID,GMAIL_CLIENT_SECRET,GMAIL_REFRESH_TOKENinto your.env.
| Document | Purpose |
|---|---|
docs/ARCHITECTURE.md |
System architecture, data flow, component responsibilities |
docs/PROJECT_STATUS.md |
What is implemented, what is not, known gaps |
docs/DATA_MODEL.md |
Supabase schema — all tables and columns |
docs/REQUIREMENTS.md |
Product requirements |
docs/AI_COACHING_VISION.md |
Future AI coach concept |
archive/ |
Superseded code: Streamlit app, FastAPI backend, Docker files |