Trade Tracker is a trading journal for stocks and crypto built around the full decision cycle, not just fills. It lets you capture campaign-level thesis, define trade plans, import or enter executions, review open positions, organize trades into portfolios, and keep notes tied to the work.
The app is built with Next.js on the frontend, Convex for the backend and real-time data layer, and Clerk for authentication.
- Journal manual trades across stocks and crypto
- Import broker/exchange CSVs from Interactive Brokers and Kraken into a review inbox
- Link trades to trade plans and trade plans to campaigns
- Track campaign status from planning to active to closed, including retrospectives
- Maintain freeform notes and a per-user strategy document
- Group trades into portfolios and derive open positions from executions
- Keep all data scoped to the signed-in Clerk user
Campaigns: the higher-level thesis or idea you are working onTrade Plans: the tactical setup for a symbol, optionally linked to a campaignTrades: the actual executions, entered manually or accepted from importsImport Inbox: pending imported trades that can be validated, edited, linked, and acceptedPortfolios: optional buckets for grouping tradesNotesandStrategy: supporting written context for trades, plans, campaigns, and your overall process
- Next.js 16 App Router
- React 19
- Convex for database, queries, mutations, and realtime sync
- Clerk for auth
- TypeScript
- Tailwind CSS 4
- TanStack React Form + Zod for form handling and validation
- Vitest for test execution
- Playwright for end-to-end browser testing
- Node.js
24.14.0(see.nvmrc) pnpm10.x- A Convex account/project
- A Clerk application
pnpm installStart the Convex dev workflow in a separate terminal:
pnpm convex devIf this is your first time running it, the CLI will prompt you to create or select a deployment and will provide your Convex URL.
Create a Clerk app, then make sure you have:
- a publishable key
- a secret key
- the Clerk frontend API URL
- a JWT template named
convex
That JWT template is required because server components request a Clerk token with template: "convex" before preloading Convex queries.
Start from the checked-in example:
cp .env.example .env.localThen fill in the values:
CLERK_SECRET_KEY=sk_test_...
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
NEXT_PUBLIC_CLERK_FRONTEND_API_URL=https://your-clerk-frontend-api-url
NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
VERCEL_GATEWAY_API_KEY=your_vercel_gateway_api_key
PLAYWRIGHT_USERNAME=your-playwright-test-user@example.com
PLAYWRIGHT_PASSWORD=your-playwright-test-password
PLAYWRIGHT_OWNER_ID=your-clerk-token-identifier-for-the-playwright-user
VERCEL_AUTOMATION_BYPASS_SECRET=your-vercel-automation-bypass-secretNotes:
NEXT_PUBLIC_CONVEX_URLis used by the React client insrc/app/providers.tsx.VERCEL_GATEWAY_API_KEYis required for the AI-powered import flow insrc/app/actions/ai-import.ts. Create or copy a Vercel AI Gateway key and add it before starting the app so server env validation passes.PLAYWRIGHT_USERNAMEandPLAYWRIGHT_PASSWORDare for local Playwright/Codex UI automation and are documented inAGENTS.md.- Playwright auth setup now uses Clerk's
@clerk/testinghelpers, so preview CI also needsCLERK_SECRET_KEY,NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, andNEXT_PUBLIC_CLERK_FRONTEND_API_URLavailable to the test job. PLAYWRIGHT_OWNER_IDis the Convex/Clerk owner identifier used to seed the dedicated Playwright account on fresh preview deployments.VERCEL_AUTOMATION_BYPASS_SECRETis only needed when running Playwright against Vercel previews protected by Deployment Protection..env.exampleis intended as the source of truth for local setup.
In another terminal, run:
pnpm devOpen http://localhost:3000.
The root route / is a public entry page. Signed-in users are redirected to /dashboard.
pnpm dev # start Next.js locally
pnpm build # production build
pnpm start # run the production server
pnpm lint # ESLint
pnpm typecheck # TypeScript checks
pnpm test # Vitest run
pnpm test:watch # Vitest watch mode
pnpm test:e2e # Playwright end-to-end tests
pnpm test:e2e:setup # Playwright auth setup only
pnpm test:e2e:smoke # Preview-oriented Chromium smoke suite
pnpm test:e2e:ui # Playwright UI runner
pnpm vercel-build # Convex-backed Vercel build command with preview seeding.
├── convex/ # Convex schema and backend functions
├── shared/imports/ # shared import types, constants, matching, validation
├── src/app/ # Next.js routes and page clients
├── src/components/ # app and UI components
├── src/lib/ # formatting, auth helpers, import parsers, utilities
└── src/styles/ # global styles
- There are no Next.js API routes in this app. Server-side data access lives in
convex/. - Most authenticated pages preload Convex data in a server component, then hand it to a client page via
preloadQuery. - The Convex schema currently includes
campaigns,tradePlans,trades,inboxTrades,portfolios,notes,strategyDoc, andaccountMappings. - Imported trades land in
inboxTradesfirst so they can be reviewed before becoming permanenttrades. - Open positions are derived from trades rather than stored as a separate source of truth.
- Unit-style tests run through Vitest via
pnpm test. - Browser tests run through Playwright via
pnpm test:e2e. - The durable Playwright selector contract lives in
docs/product/technical-architecture-overview.md, with agent workflow details inAGENTS.md. - The preview smoke suite is
pnpm test:e2e:smoke; it expectsPLAYWRIGHT_BASE_URLand optionallyVERCEL_AUTOMATION_BYPASS_SECRETwhen targeting protected Vercel previews. pnpm test:e2e:setupnow authenticates through Clerk's Playwright testing helpers rather than filling the sign-in UI manually.- Local Playwright setup resets and reseeds the dedicated Playwright user before authenticated specs run against a local target.
- Vercel preview deployments should use
pnpm vercel-buildso Convex preview deployments get seeded through--preview-run 'e2eSeed:setupPreviewData'. - This repo intentionally keeps both
@playwright/testandplaywrightinstalled. Playwright generally recommends using only one top-level package, but the current Codexplaywright-interactiveworkflow expects a directplaywrightimport while this repo's end-to-end tests run through@playwright/test. - For app-focused Playwright work, start both
pnpm devandpnpm convex devfirst. - Playwright reuses
output/playwright/auth.jsonwhen present; refresh it withpnpm test:e2e:setupif it goes stale.
/public entry/dashboarddashboard/tradestrade journal and filters/trades/newmanual trade entry/trade-planstrade plan management/campaignscampaign tracking/importsCSV import and inbox review/positionsderived open positions/portfolioportfolio management/notesnote management/strategylong-form strategy document/accountsbrokerage account ID mapping