Skip to content

AdityaRaj019/codelitics

Repository files navigation

Next.js React TypeScript MongoDB Tailwind CSS

πŸš€ CodeLitics

A modern, full-stack DSA problem tracking and analytics platform

Track your coding journey, sync LeetCode stats, and visualize your progress with beautiful analytics.

Features β€’ Tech Stack β€’ Getting Started β€’ API Reference β€’ Project Structure β€’ Deployment


✨ Features

🎯 Problem Tracking

  • Add & Organize Problems - Track DSA problems with difficulty levels, topics, and custom notes
  • Progress Monitoring - Mark problems as solved and track your completion rate
  • Category Filtering - Filter problems by difficulty (Easy, Medium, Hard) and topics

πŸ“Š LeetCode Integration

  • Profile Sync - Connect your LeetCode profile and auto-sync statistics
  • Real-time Stats - View solved problems, acceptance rate, ranking, and streaks
  • Difficulty Breakdown - Visualize your progress across Easy, Medium, and Hard problems
  • Submission History - Track your recent submissions and activity

πŸ” Authentication & Security

  • Secure Auth System - Email/password authentication with bcrypt hashing
  • Role-based Access - User and Admin roles with protected routes
  • Session Management - Persistent sessions with secure localStorage handling

🎨 Modern UI/UX

  • Dark/Light Mode - Beautiful theme toggle with system preference detection
  • Responsive Design - Fully responsive across all device sizes
  • Smooth Animations - Polished micro-interactions and transitions
  • Accessible Components - Built with accessibility best practices

πŸ“ˆ Analytics Dashboard

  • User Dashboard - Personal statistics, recent activity, and progress charts
  • Admin Dashboard - User management and platform-wide analytics
  • Visual Charts - Progress bars, stats cards, and achievement tracking

πŸ›  Tech Stack

Frontend

Technology Version Purpose
Next.js 15.5 React framework with App Router
React 19.1 UI library
TypeScript 5.x Type-safe development
Tailwind CSS 4.x Utility-first styling
Zustand 5.x State management
Lucide React Latest Icon library
next-themes 0.4 Theme management

Backend

Technology Version Purpose
Next.js API Routes 15.5 RESTful API endpoints
MongoDB Atlas 7.x Cloud database
Mongoose 9.x MongoDB ODM
bcryptjs 3.x Password hashing

DevOps & Tools

Technology Purpose
Vercel Deployment & Hosting
ESLint Code linting
Turbopack Fast bundling
Git Version control

πŸš€ Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm 9.x or higher (or yarn/pnpm)
  • MongoDB Atlas account (Create free account)

Installation

  1. Clone the repository

    git clone https://github.com/AdityaRaj019/codelitics.git
    cd codelitics
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env.local

    Update .env.local with your credentials:

    # MongoDB Atlas Connection
    MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/codelitics
    
    # NextAuth Configuration
    NEXTAUTH_URL=http://localhost:3000
    NEXTAUTH_SECRET=your-secret-key-here
    
    # LeetCode API
    LEETCODE_API_BASE=https://alfa-leetcode-api.onrender.com
  4. Run the development server

    npm run dev
  5. Open your browser

    http://localhost:3000
    

Build for Production

npm run build
npm start

πŸ“‘ API Reference

Authentication

Endpoint Method Description
/api/auth/register POST Register a new user
/api/auth/login POST Login with credentials
/api/auth/me GET Get current user data

Problems

Endpoint Method Description
/api/problems GET Get all problems for user
/api/problems POST Add a new problem
/api/problems/[id] GET Get problem by ID
/api/problems/[id] PATCH Update problem
/api/problems/[id] DELETE Delete problem

Platform Integration

Endpoint Method Description
/api/platforms/leetcode/connect POST Connect LeetCode profile
/api/platforms/leetcode/sync POST Sync LeetCode statistics
/api/platforms/leetcode/stats GET Get LeetCode stats

Health Check

Endpoint Method Description
/api/health GET Database connection status
/api/test-db GET Database collection stats

πŸ“ Project Structure

codelitics/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/               # API Routes
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ problems/      # Problem CRUD endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ platforms/     # Platform integrations
β”‚   β”‚   β”‚   └── health/        # Health check endpoint
β”‚   β”‚   β”œβ”€β”€ dashboard/         # Dashboard pages
β”‚   β”‚   β”œβ”€β”€ login/            # Login page
β”‚   β”‚   β”œβ”€β”€ register/         # Registration page
β”‚   β”‚   β”œβ”€β”€ problems/         # Problems page
β”‚   β”‚   β”œβ”€β”€ profile/          # Profile page
β”‚   β”‚   └── page.tsx          # Home page
β”‚   β”‚
β”‚   β”œβ”€β”€ components/            # React Components
β”‚   β”‚   β”œβ”€β”€ ui/               # Base UI components
β”‚   β”‚   β”œβ”€β”€ Header.tsx        # Navigation header
β”‚   β”‚   β”œβ”€β”€ Footer.tsx        # Page footer
β”‚   β”‚   β”œβ”€β”€ LeetCodeStats.tsx # LeetCode statistics display
β”‚   β”‚   β”œβ”€β”€ ProblemList.tsx   # Problem list component
β”‚   β”‚   β”œβ”€β”€ ConnectLeetCode.tsx
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ stores/               # Zustand State Management
β”‚   β”‚   β”œβ”€β”€ authStore.ts      # Authentication state
β”‚   β”‚   β”œβ”€β”€ problemStore.ts   # Problems state
β”‚   β”‚   β”œβ”€β”€ profileStore.ts   # User profile state
β”‚   β”‚   └── index.ts          # Store exports
β”‚   β”‚
β”‚   └── lib/                  # Utilities & Database
β”‚       └── db/
β”‚           β”œβ”€β”€ connect.ts    # MongoDB connection
β”‚           β”œβ”€β”€ models/       # Mongoose schemas
β”‚           β”‚   β”œβ”€β”€ User.ts
β”‚           β”‚   β”œβ”€β”€ Problem.ts
β”‚           β”‚   β”œβ”€β”€ PlatformStats.ts
β”‚           β”‚   └── UserProblemProgress.ts
β”‚           └── index.ts
β”‚
β”œβ”€β”€ public/                   # Static assets
β”œβ”€β”€ .env.example             # Environment template
β”œβ”€β”€ .env.local               # Local environment (git-ignored)
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.ts
β”œβ”€β”€ tsconfig.json
└── next.config.ts

🌐 Deployment

Deploy to Vercel (Recommended)

  1. Push to GitHub

    git push origin main
  2. Import to Vercel

  3. Configure Environment Variables

    Add these in Vercel's Settings β†’ Environment Variables:

    Variable Value
    MONGODB_URI Your MongoDB Atlas connection string
    NEXTAUTH_URL Your Vercel deployment URL
    NEXTAUTH_SECRET Generated secret key
    LEETCODE_API_BASE https://alfa-leetcode-api.onrender.com
  4. Deploy

    • Vercel will automatically build and deploy your app

MongoDB Atlas Setup

  1. Create a free cluster at MongoDB Atlas
  2. Create a database user with read/write permissions
  3. Whitelist 0.0.0.0/0 in Network Access (for Vercel)
  4. Get your connection string from Database β†’ Connect β†’ Drivers

πŸ§ͺ Scripts

Command Description
npm run dev Start development server with Turbopack
npm run build Build for production
npm start Start production server
npm run lint Run ESLint

πŸ”’ Security Features

  • Password Hashing - All passwords hashed with bcrypt (12 rounds)
  • Input Validation - Server-side validation on all endpoints
  • Environment Variables - Sensitive data stored in environment variables
  • Unique Constraints - Database-level uniqueness for emails
  • Error Handling - Proper error responses without leaking sensitive info

πŸ—Ί Roadmap

  • OAuth Integration - Google & GitHub login
  • Password Reset - Email-based password recovery
  • Middleware Protection - Route-level authentication
  • More Platforms - Codeforces, HackerRank integration
  • Progress Charts - Visual analytics with charts
  • Achievements System - Gamification features
  • Export Data - Download your progress data

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Aditya Raj


⭐ Star this repository if you found it helpful!

Made with ❀️ using Next.js and TypeScript

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages