CodeTracker Pro is a Next.js 14 competitive programming question manager with:
- App Router + TypeScript
- Tailwind CSS
- custom shadcn-style UI primitives
- Zustand for client UI state
- Prisma + PostgreSQL for persistence
- Auth.js Google sign-in with Prisma-backed users and sessions
- OpenRouter-powered AI analysis with free models
- predefined topic library for consistent tagging
- platform account linking with Codeforces sync
- Recharts for stats
- SheetJS for Excel export
- Create the app shell if you want to reproduce manually:
npx create-next-app@latest codetracker-pro --typescript --tailwind --app
cd codetracker-pro- Install dependencies:
npm install next react react-dom zustand xlsx recharts lucide-react clsx tailwind-merge @prisma/client
npm install -D prisma- Add environment variables in
.env.local:
DATABASE_URL="your_neon_postgres_url_here"
OPENROUTER_API_KEY="your_openrouter_api_key_here"
OPENROUTER_MODEL="openrouter/free"
GOOGLE_CLIENT_ID="your_google_client_id_here"
GOOGLE_CLIENT_SECRET="your_google_client_secret_here"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your_random_secret_here"
AUTH_SECRET="your_random_auth_secret_here"- Generate the Prisma client and push the schema:
npx prisma generate
npx prisma db push- Run the app:
npm run devThe project uses Prisma with PostgreSQL. The schema lives in prisma/schema.prisma.
Google sign-in is powered by Auth.js and Prisma models for:
UserAccountSessionVerificationTokenQuestionRecordPlatformAccount
Question data is persisted in the QuestionRecord table and each question belongs to a signed-in user. CRUD is exposed through:
GET /api/questionsPOST /api/questionsPATCH /api/questions/[id]DELETE /api/questions/[id]
Platform account linking and sync is exposed through:
GET /api/platform-accountsPOST /api/platform-accountsPATCH /api/platform-accounts/[id]DELETE /api/platform-accounts/[id]POST /api/platform-accounts/[id]/sync
The analyze route is app/api/analyze/route.ts. It sends the problem URL or description to OpenRouter using free models, defaulting to openrouter/free and falling back across a few free options when needed.
The dashboard now includes a platform account section where users can save handles for LeetCode, Codeforces, CodeChef, AtCoder, HackerRank, and GeeksforGeeks.
- Codeforces sync is live using the official public API
- solved Codeforces submissions are imported into the main tracker and mapped into the predefined topic library
- other platforms currently support handle storage and UI scaffolding so additional sync adapters can be added cleanly
The shared Prisma client now lives in lib/prismaclient.ts. The legacy lib/prisma.ts file simply re-exports it for compatibility.
codetracker-pro/
├── app/
│ ├── api/
│ │ ├── analyze/route.ts
│ │ └── questions/
│ │ ├── route.ts
│ │ └── [id]/route.ts
│ ├── dashboard/page.tsx
│ ├── stats/page.tsx
│ ├── tracker/page.tsx
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx
├── components/
│ ├── ui/
│ ├── AddQuestionModal.tsx
│ ├── AppProviders.tsx
│ ├── ConfidenceStars.tsx
│ ├── ExportButton.tsx
│ ├── FilterBar.tsx
│ ├── HintDrawer.tsx
│ ├── Navbar.tsx
│ ├── QuestionCard.tsx
│ ├── QuestionTable.tsx
│ └── StatsPanel.tsx
├── constants/platforms.ts
├── lib/
│ ├── analyzeQuestion.ts
│ ├── exportToExcel.ts
│ ├── prisma.ts
│ ├── questionDb.ts
│ └── utils.ts
├── prisma/schema.prisma
├── store/useTrackerStore.ts
└── types/index.ts