A Next.js app for tracking credit card transactions by uploading video recordings. Automatically extracts merchant name, date, amount, and bitcoin rewards using OpenAI Vision.
- 🔐 Authentication: Secure user auth with Clerk
- 📹 Video Upload: Upload videos of your credit card transactions
- 🤖 AI Extraction: OpenAI Vision automatically extracts transaction details
- 🗂️ Deduplication: Smart hashing prevents duplicate entries
- 📊 Dashboard: Visualize spending by category, date, and month
- ✏️ Manual Override: Edit transaction categories
- 🔒 Privacy: Users can only access their own data
- Framework: Next.js 14 (App Router)
- Auth: Clerk
- Database: Neon PostgreSQL
- AI: OpenAI GPT-4o Vision
- Charts: Recharts
- UI: shadcn/ui components
- Deployment: Vercel
cd transaction-tracker/my-app
npm installCopy .env.local.example to .env.local and fill in:
cp .env.local.example .env.localRequired variables:
| Variable | Description |
|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
From Clerk Dashboard |
CLERK_SECRET_KEY |
From Clerk Dashboard |
DATABASE_URL |
Neon PostgreSQL connection string |
OPENAI_API_KEY |
From OpenAI Dashboard |
- Create a new database in Neon
- Copy the connection string to
DATABASE_URL - Run the schema:
# Connect to your Neon database and run:
psql $DATABASE_URL < db/schema.sql- Go to Clerk Dashboard
- Create a new application
- Copy the Publishable Key and Secret Key
- Add them to your
.env.local - Configure redirect URLs:
- Sign-in URL:
/sign-in - Sign-up URL:
/sign-up - After sign-in:
/ - After sign-up:
/
- Sign-in URL:
- Go to OpenAI Platform
- Create an API key
- Add it to
OPENAI_API_KEY
npm run devnpm i -g vercel
vercelAdd environment variables in Vercel Dashboard:
- Go to Project Settings → Environment Variables
- Add all variables from
.env.local - Redeploy
- Sign Up/In: Create an account or sign in
- Upload Video: Record or select a video of your credit card transactions
- AI Processing: The app extracts merchant, date, amount, and BTC rewards
- Review: Transactions appear in your dashboard
- Categorize: Edit categories for better tracking
- Analyze: View spending breakdowns and trends
transactions:
- id (hash of user_id + merchant + date + amount + rewards)
- user_id (clerk user id)
- merchant_name
- transaction_date
- amount_spent
- bitcoin_rewards
- category (nullable, user-editable)
- created_at, updated_atEach transaction gets a unique ID generated from:
userId:merchantName:date:amount:rewards
This ensures:
- Same user can't have duplicates
- Different users CAN have identical transactions
- Re-uploading the same video won't create duplicates
| Route | Method | Description |
|---|---|---|
/api/transactions/extract |
POST | Process video, extract & insert transactions |
/api/transactions |
GET | Get all user's transactions |
/api/transactions/[id] |
PUT | Update transaction category |
/api/transactions/[id] |
DELETE | Delete transaction |
MIT