CodeChemy is a full-stack coding analytics and interview-preparation platform built around LeetCode data. It helps users track their problem-solving progress, review recent submissions, compare rankings with friends, work through company-specific question sheets, and use AI assistance for hints, code review, and optimal-solution guidance.
- User authentication with JWT-based protected routes.
- LeetCode profile linking and syncing through LeetCode's public GraphQL data.
- Dashboard for solved counts, acceptance rates, topic breakdowns, badges, streaks, contest stats, and recent submissions.
- Activity heatmap and contest rating visualizations.
- Recent submission detail view with optional private code fetching through an encrypted LeetCode session cookie.
- AI code review, hint generation, AI coach, and optimal solution generation.
- Company-wise problem sheets for Amazon, Google, Microsoft, Salesforce, JPMorgan, Goldman Sachs, Atlassian, Flipkart, Expedia, DeShaw, Amex, and Wells Fargo.
- Per-user company sheet progress tracking.
- Friend management and LeetCode stat comparison.
- Light/dark theme support.
- Secure backend defaults with Helmet, CORS allowlists, request limits, password hashing, and encrypted session-cookie storage.
- React 19
- Vite
- React Router
- Axios
- Tailwind CSS
- Recharts
- Lucide React
- React Syntax Highlighter
@uiw/react-textarea-code-editor
- Node.js
- Express
- MongoDB with Mongoose
- JWT authentication
- bcryptjs password hashing
- Helmet and CORS
- express-rate-limit
- LeetCode GraphQL integration
- Groq SDK
- Google GenAI SDK
- NodeCache
- csv-parse
CodeChemy/
|-- client/ # React + Vite frontend
| |-- public/ # Static icons and favicon
| `-- src/
| |-- api/ # Axios API client
| |-- assets/ # Frontend images/assets
| |-- components/ # Layout and dashboard components
| |-- context/ # Auth, theme, and sync contexts
| `-- pages/ # App pages/routes
|-- server/ # Express backend API
| `-- src/
| |-- config/ # Database connection
| |-- middleware/ # Auth middleware
| |-- models/ # Mongoose models
| |-- routes/ # API routes
| |-- seeds/ # Company problem CSV import scripts/data
| `-- services/ # LeetCode, AI, and encryption services
|-- Company Sheet/ # Source company CSV sheets
|-- package.json # Root dependency placeholder
`-- README.md
- Node.js 18 or newer
- npm
- MongoDB Atlas database or a local MongoDB instance
- Groq API key for AI review/hint features
- Optional: Gemini API key if you use the Gemini service
git clone https://github.com/your-username/codechemy.git
cd codechemyInstall backend dependencies:
cd server
npm installInstall frontend dependencies:
cd ../client
npm installCreate server/.env:
PORT=5002
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_long_random_jwt_secret
ENCRYPTION_KEY=your_long_random_encryption_key
GROQ_API_KEY=your_groq_api_key
GEMINI_API_KEY=your_gemini_api_key_optional
CLIENT_URL=http://localhost:5173Create client/.env if you want to override the deployed API URL:
VITE_API_URL=http://localhost:5002/apiImportant local-development note: the frontend API client routes localhost traffic to http://localhost:5002/api, while the backend falls back to port 5000 if PORT is not set. Set PORT=5002 in server/.env for the smoothest local setup.
From the server directory:
npm run seedThis imports the CSV files from server/src/seeds/company-csv-data into MongoDB.
Start the backend:
cd server
npm run devStart the frontend in another terminal:
cd client
npm run devOpen the Vite URL shown in your terminal, usually:
http://localhost:5173
Run from server/:
npm run dev # Start API with Node watch mode
npm start # Start API normally
npm run seed # Import company problem CSV dataRun from client/:
npm run dev # Start Vite dev server
npm run build # Build production frontend
npm run preview # Preview production build
npm run lint # Run ESLint| Variable | Location | Required | Description |
|---|---|---|---|
PORT |
server/.env |
Recommended | Backend port. Use 5002 for local frontend compatibility. |
MONGODB_URI |
server/.env |
Yes | MongoDB connection string. |
JWT_SECRET |
server/.env |
Yes | Secret used to sign auth tokens. |
ENCRYPTION_KEY |
server/.env |
Yes | Secret used to encrypt LeetCode session cookies. |
GROQ_API_KEY |
server/.env |
Yes for AI features | API key used by Groq-powered review, hint, coach, and optimal-solution flows. |
GEMINI_API_KEY |
server/.env |
Optional | API key for Gemini service usage. |
CLIENT_URL |
server/.env |
Optional | Single allowed frontend origin for CORS. |
CLIENT_URLS |
server/.env |
Optional | Comma-separated allowed frontend origins for CORS. |
VITE_API_URL |
client/.env |
Optional | Frontend API base URL for non-localhost environments. |
Base URL:
http://localhost:5002/api
POST /auth/register- create a new account.POST /auth/login- log in and receive a JWT.GET /auth/me- fetch the authenticated user.
PUT /user/leetcode-link- link a LeetCode username.PATCH /user/leetcode-username- set username and trigger background sync.PUT /user/leetcode-session- store an encrypted LeetCode session cookie.POST /user/sync- sync profile stats and recent submissions.
GET /dashboard/overview- profile summary and dashboard metrics.GET /dashboard/heatmap- submission calendar and streak data.GET /dashboard/recent-submissions- latest stored accepted submissions.GET /dashboard/ai-coach- AI coaching for the latest accepted problem.
GET /submissions/:submissionId- fetch stored submission details and optionally submitted code.
GET /companies- list companies with problem counts.GET /companies/:companyName/problems- list company problems with pagination, difficulty filter, and search.GET /companies/:companyName/statuses- fetch solved statuses for a user.POST /companies/:companyName/problems/:problemSlug/toggle- toggle solved status.
POST /ai/review- generate an AI code review.POST /ai/hint- generate a hint, including follow-up context.POST /ai/optimal- generate an optimal solution for a problem.
GET /friends- list saved friends.POST /friends- add a friend by LeetCode username.DELETE /friends/:friendId- remove a friend.GET /friends/:friendId/compare- compare LeetCode stats.
Userstores account data, linked LeetCode username, encrypted LeetCode session cookie, and sync timestamps.ProfileSnapshotstores synced LeetCode profile, contest, topic, badge, and calendar data.SubmissionRecordstores recent accepted submissions and optionally fetched submission code.CompanyProblemstores company-tagged coding problems imported from CSV.UserProblemStatusstores per-user solved status for company sheets.Friendstores user-managed LeetCode friends and cached comparison stats.AIInteractionLogexists as a model, while current AI route history is kept in memory withNodeCacheto reduce database storage usage.
- Passwords are hashed before storage.
- API routes that require identity are protected with JWT middleware.
- LeetCode session cookies are encrypted before being stored.
- API requests are rate-limited globally, with stricter limits for AI routes.
- CORS is restricted to local development URLs, configured client URLs, and deployed project URLs.
- Do not commit
.envfiles or real API keys.
One common deployment setup is:
- Frontend: Netlify, Vercel, or any static hosting provider.
- Backend: Render, Railway, Fly.io, or another Node-compatible host.
- Database: MongoDB Atlas.
Deployment checklist:
- Set all required backend environment variables on your server host.
- Set
CLIENT_URLorCLIENT_URLSto your deployed frontend origin. - Set
VITE_API_URLin the frontend build environment to your deployed backend API URL, ending in/api. - Run
npm run buildinsideclient/. - Run
npm startinsideserver/. - Seed company data once in the production database with
npm run seed.
Contributions are welcome. A good workflow is:
- Fork the repository.
- Create a feature branch.
- Install dependencies in both
clientandserver. - Make your changes.
- Run lint/build checks.
- Open a pull request with a clear description of the change.
No license file is currently included. Add a license before publishing if you want to define how others may use, modify, or distribute this project.