CodeHabit (formerly CodeHabit) is a unified, serverless Next.js platform designed to be the ultimate productivity command center for developers. It helps you track your daily habits, monitor your LeetCode consistency, complete study diaries, and test your knowledge through core CS quizzes.
code-habit.vercel.app
(Vercel URL renaming coming soon)
| Module | Description |
|---|---|
| Dashboard | Unified view with correlation charts, AI insights, LeetCode donut chart, and yearly heatmap |
| Habit Tracker | Add / edit / delete habits, daily check-offs, streak tracking, 90-day calendar view |
| LeetCode Analytics | Profile stats (Easy/Med/Hard), yearly 365-day submission heatmap, current streak |
| Quiz Assessment | 10-question MCQs in Full Stack Dev, DBMS, and OS with timer and score tracking |
| Analytics | 30-day habit vs. coding correlation with Pearson coefficient and AI-generated insights |
| Diary | Daily journal entries, task management, and study timer |
- Frontend: Next.js 16 (React 19), Tailwind CSS v4, shadcn/ui, Recharts
- Backend: Next.js API Routes (serverless)
- Database: Vercel Postgres (PostgreSQL) via Prisma ORM
- Auth: JWT (bcryptjs + jsonwebtoken)
- Deployment: Vercel (single project)
├── prisma/
│ ├── schema.prisma # Database schema
│ └── seed.ts # Quiz question seeder (30 MCQs)
├── src/
│ ├── app/
│ │ ├── api/ # Backend API routes (serverless)
│ │ │ ├── auth/ # register, login, me
│ │ │ ├── habits/ # CRUD + daily logging
│ │ │ ├── leetcode/ # sync, stats, profile/[username]
│ │ │ ├── quiz/ # questions, submit, results
│ │ │ ├── analytics/ # dashboard correlation
│ │ │ └── diary/ # entries, tasks, timer
│ │ ├── auth/ # Login / Register page
│ │ ├── habits/ # Habit tracker page
│ │ ├── leetcode/ # LeetCode analytics page
│ │ ├── quiz/ # Quiz + results pages
│ │ ├── analytics/ # Analytics page
│ │ ├── diary/ # Diary page
│ │ └── page.tsx # Dashboard
│ ├── components/
│ │ ├── Heatmap.tsx # GitHub-style SVG heatmap
│ │ ├── Sidebar.tsx # Navigation sidebar
│ │ └── ui/ # shadcn/ui components
│ └── lib/
│ ├── api.ts # Axios client
│ ├── auth.ts # JWT utilities
│ ├── prisma.ts # Prisma singleton
│ ├── leetcode.ts # LeetCode GraphQL fetcher
│ └── math.ts # Correlation calculation
- Node.js 18+
- Vercel account with Postgres storage
npm install
# Create .env.local with:
# POSTGRES_PRISMA_URL=your_postgres_url
# POSTGRES_URL_NON_POOLING=your_direct_url
# JWT_SECRET=your_secret
npx prisma db push # Create tables
npx prisma db seed # Seed 30 quiz questions
npm run dev # Start at localhost:3000- Push to GitHub
- Import project in Vercel
- Add Vercel Postgres from Storage tab
- Add
JWT_SECRETenvironment variable - Deploy — Prisma generates automatically via
postinstall
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
✗ | Register user |
| POST | /api/auth/login |
✗ | Login |
| GET | /api/auth/me |
✓ | Current user |
| GET | /api/habits |
✓ | List habits with streaks |
| POST | /api/habits |
✓ | Create habit |
| PUT | /api/habits/:id |
✓ | Update habit |
| DELETE | /api/habits/:id |
✓ | Delete habit |
| POST | /api/habits/:id/log |
✓ | Log daily completion |
| GET | /api/leetcode/stats |
✓ | Synced submission stats |
| POST | /api/leetcode/sync |
✓ | Sync from LeetCode |
| GET | /api/leetcode/profile/:user |
✓ | Profile + yearly heatmap |
| GET | /api/quiz/questions/:subject |
✓ | Get 10 MCQs |
| POST | /api/quiz/submit |
✓ | Submit and score quiz |
| GET | /api/quiz/results |
✓ | Past results and stats |
| GET | /api/analytics/dashboard |
✓ | 30-day correlation data |
MIT
