A personal trading journal, vibe-coded with Lovable.
I built this for myself to log my own ICT/SMC trades, tag my mistakes, and actually see my patterns instead of guessing. Sharing it here in case it's useful to other traders who want something similar, or want to fork it and make it their own.
- About
- Features
- Tech Stack
- Getting Started
- Connecting Supabase
- Adding Google Authentication
- Running Locally
- Keyboard Shortcuts
- Deployment
- Security
- License
Most journaling apps are either shallow spreadsheets or $30/mo SaaS. I wanted something built around how I actually trade sessions, killzones, models, grades, R multiples with the analytics I'd otherwise have to pay for. So I vibe-coded this with Lovable for personal use, and it's grown into a full trading journal with AI review, multi-account tracking, and deep analytics.
- Rich trade entries β pair, direction, session, killzone, model/strategy, grade (A+ β C), R:R planned & achieved, risk %, position size, P&L
- Trade thesis (rationale) β capture why you took the trade before recording the outcome
- Multi-image screenshots with per-image download, full-size preview, and TradingView links
- Mistake presets (overtrading, FOMO, revenge, moved SLβ¦) + custom tags
- "Random trade" tag for trades taken outside your plan
- Custom pair library β add any symbol on the fly, saved locally
- Document every model: entry rules, confirmation, invalidation, risk & management, timeframes
- Pre-trade checklist attached to each strategy
- Per-strategy performance breakdown
- Personal / Prop / Demo / Funded / Challenge accounts, each with its own starting balance & currency
- Global account switcher -every page (dashboard, journal, analytics, calendar) filters by active account
- Equity curve, drawdown curve, monthly returns bar chart
- 84-day activity heatmap (GitHub-style)
- Streak tiles: current, best win streak, worst loss streak, consistency %
- Insights: best/worst day, most-traded pair, best/worst pair, day-of-week P&L
- AI Weekly Review (Lovable AI Gateway β Gemini) β brutally honest coach summary with headline verdict, what went wrong, what went right, patterns, and focus for next week
- Risk analytics: expectancy, avg R, profit factor, payoff ratio, Sharpe, Sortino, R-multiple distribution, cumulative R, rolling 20-trade win rate
- Breakdowns by pair, session, day-of-week, model, and grade
- βK command palette β jump to any page, open calculators, log a trade
- Global keyboard shortcuts with help overlay
- Calculators: risk, position size, R:R
- Light / Dark / System theme
- CSV export of trades with filters applied
- PWA-ready (installable, offline shell)
- Row-Level Security on every table (
auth.uid()scoped) - Private storage bucket with per-user prefix isolation
- Email + Google OAuth
- No service-role secrets in the client
| Layer | Tool |
|---|---|
| Framework | TanStack Start v1 (React 19, SSR, Vite 7) |
| Styling | Tailwind v4 + custom OKLCH design tokens + glassmorphism |
| Backend | Supabase (Postgres + Auth + Storage) via Lovable Cloud |
| Data | TanStack Query |
| Charts | Recharts |
| AI | Lovable AI Gateway (Gemini) |
| Icons | Lucide |
git clone https://github.com/nimraweb3/Trading-Journal.git
cd Trading-Journal
bun install # or npm installcp .env.example .envFill in your Supabase keys (see Connecting Supabase below).
| Variable | Scope | Notes |
|---|---|---|
VITE_SUPABASE_URL |
client + server | Public project URL |
VITE_SUPABASE_PUBLISHABLE_KEY |
client + server | Public anon/publishable key |
VITE_SUPABASE_PROJECT_ID |
client + server | Project ref |
SUPABASE_SERVICE_ROLE_KEY |
server-only | Never expose to the client |
LOVABLE_API_KEY |
server-only | For AI weekly review (optional) |
β οΈ .envis git-ignored β never commit it.
TradeBook uses Supabase for Postgres, Auth, and Storage. To connect your own project:
-
Create a project Go to supabase.com/dashboard β New Project. Pick a name, a strong database password, and a region close to you.
-
Grab your API keys In your project, go to Project Settings β API. Copy:
- Project URL β
VITE_SUPABASE_URL - anon / publishable key β
VITE_SUPABASE_PUBLISHABLE_KEY - Project ID (in the URL or Settings β General) β
VITE_SUPABASE_PROJECT_ID - service_role key (Settings β API, "Reveal") β
SUPABASE_SERVICE_ROLE_KEYβ keep this server-side only, e.g. as a secret in your hosting provider, never in the client bundle.
- Project URL β
-
Run the database migrations Migrations live in
supabase/migrations/. If you have the Supabase CLI installed:npm install -g supabase supabase login supabase link --project-ref YOUR_PROJECT_ID supabase db push
This creates all tables with Row-Level Security enabled and
auth.uid()-scoped policies already applied β you don't need to write RLS policies yourself. -
Create the storage bucket If it isn't created automatically by the migrations, go to Storage in the Supabase dashboard and create a private bucket (check
supabase/migrations/for the expected bucket name β trade screenshots are stored with per-user prefix isolation, so keep it private, not public). -
Paste the keys into
.envand restart your dev server.
TradeBook ships with an Email + Google OAuth-ready auth flow. To activate Google sign-in:
- Go to the Google Cloud Console β create a new project (or select an existing one).
- Navigate to APIs & Services β OAuth consent screen.
- Choose External (unless you're restricting to a Google Workspace org).
- Fill in app name, support email, and developer contact email.
- Add the scopes:
email,profile,openid(these are usually pre-selected).
- Navigate to APIs & Services β Credentials β Create Credentials β OAuth client ID.
- Application type: Web application.
- Under Authorized redirect URIs, add your Supabase callback URL:
https://<YOUR_PROJECT_ID>.supabase.co/auth/v1/callback - Save, then copy the generated Client ID and Client Secret.
- In your Supabase dashboard, go to Authentication β Providers β Google.
- Toggle it on.
- Paste in the Client ID and Client Secret from Google Cloud.
- Save.
Still in Authentication β URL Configuration:
- Site URL: your production URL (e.g.
https://nim-trade-journal.lovable.app) - Redirect URLs: add both your local dev URL and production URL, e.g.:
http://localhost:8080/** https://nim-trade-journal.lovable.app/**
TradeBook's auth logic already calls Supabase's OAuth sign-in method for Google (look for supabase.auth.signInWithOAuth({ provider: 'google' }) in the auth-related files under src/). Once the provider is enabled in Supabase and the redirect URLs are set, the existing "Continue with Google" button will work β no extra frontend code should be needed.
Run the app locally (see below), click Continue with Google, and confirm you're redirected back to the app fully signed in. Check Authentication β Users in Supabase to confirm the new user was created.
-
Make sure you've completed Getting Started (cloned the repo, installed dependencies, filled
.env) and Connecting Supabase. -
Start the dev server:
bun run dev # or npm run dev -
Open your browser at:
http://localhost:8080 -
Sign up with email, or use Continue with Google if you've completed the OAuth setup above.
-
To build for production locally:
bun run build bun run preview
Troubleshooting tips:
- If the app loads but data won't save, double-check your Supabase keys in
.envand that migrations were pushed (supabase db push). - If Google sign-in redirects but doesn't log you in, re-check the redirect URI matches exactly (including
http://localhost:8080, no trailing slash mismatches) in both Google Cloud Console and Supabase. - If port 8080 is already in use, check
vite.config.tsto change the dev server port.
| Key | Action |
|---|---|
βK / Ctrl+K |
Command palette |
N |
New trade |
G then D |
Go to Dashboard |
G then J |
Go to Journal |
G then A |
Go to Analytics |
? |
Show all shortcuts |
- Self-host β see
DEPLOYMENT.md. Runs anywhere that runs a Node/edge SSR app (Cloudflare Workers, Vercel, Netlify, Fly, your own box).
See SECURITY.md for the disclosure process and threat model.
MIT β free to use, fork, self-host, and modify. Attribution appreciated but not required.
Built with β€οΈ for my own trading β sharing it in case it helps someone else too.~