|
1 | | -# JWT AUTH SETUP |
2 | | -### 1. Backend Setup |
3 | | - |
4 | | -Navigate to the `server` directory. |
5 | | - |
6 | | -1. **Install Dependencies:** |
7 | | - ```bash |
8 | | - cd server |
9 | | - npm install |
10 | | - ``` |
11 | | - |
12 | | -2. **Environment Configuration:** |
13 | | - Create a `.env` file in the `server` root and add your credentials: |
14 | | - ```env |
15 | | - PORT=4000 |
16 | | - MONGODB_URL="your_mongodb_connection_string" |
17 | | - JWT_SECRET="your_super_secret_key" |
18 | | - NODE_ENV="development" |
19 | | -
|
20 | | - # Email Service (e.g., Brevo/SMTP) |
21 | | - SMTP_USER="your_smtp_user" |
22 | | - SMTP_PASSWORD="your_smtp_password" |
23 | | - SENDER_EMAIL="your_sender_email@example.com" |
24 | | - ``` |
25 | | - |
26 | | -3. **Start Server:** |
27 | | - ```bash |
28 | | - npm run server |
29 | | - # Server runs on http://localhost:4000 |
30 | | - ``` |
31 | | - |
32 | | -### 2. Frontend Setup |
33 | | - |
34 | | -Navigate to the `client` directory. |
35 | | - |
36 | | -1. **Install Dependencies:** |
37 | | - ```bash |
38 | | - cd client |
39 | | - npm install |
40 | | - ``` |
41 | | - |
42 | | -2. **Environment Configuration:** |
43 | | - Create a `.env` file in the `client` root: |
44 | | - ```env |
45 | | - VITE_BACKEND_URL=http://localhost:4000 |
46 | | - ``` |
47 | | - |
48 | | -3. **Start Application:** |
49 | | - ```bash |
50 | | - npm run dev |
51 | | - # App runs on http://localhost:5173 |
52 | | - ``` |
| 1 | +# 🚀 CrackCode – Gamified Coding Learning Platform |
53 | 2 |
|
54 | | ---- |
55 | | -// merge test |
56 | | - |
57 | | - |
58 | | -node server.js |
59 | | -``` |
| 3 | +> Learn coding like solving a mystery 🕵️♂️ |
| 4 | +> Crack problems, earn rewards, level up your skills. |
60 | 5 |
|
61 | 6 | --- |
62 | 7 |
|
63 | | -## Questions API (No Auth Needed) |
| 8 | +## 📌 Overview |
64 | 9 |
|
65 | | -### Test 1: Get All Careers |
66 | | -``` |
67 | | -GET http://localhost:5050/api/questions/careers |
68 | | -``` |
69 | | -**Expected:** List of 3 careers (MLEngineer, DataScientist, SoftwareEngineer) |
70 | | - |
71 | | ---- |
| 10 | +**CrackCode** is a full-stack gamified coding platform designed to make learning programming **engaging, interactive, and addictive**. |
72 | 11 |
|
73 | | -### Test 2: Get ML Engineer Easy Questions |
74 | | -``` |
75 | | -GET http://localhost:5050/api/questions?career=MLEngineer&difficulty=Easy |
76 | | -``` |
77 | | -**Expected:** 20 Easy questions from MLEngineerQ collection |
| 12 | +Instead of traditional problem-solving, users take on the role of a **detective**, solving coding challenges to progress through cases, earn XP, unlock badges, and climb leaderboards. |
78 | 13 |
|
79 | 14 | --- |
80 | 15 |
|
81 | | -### Test 3: Get Data Scientist Medium Questions |
82 | | -``` |
83 | | -GET http://localhost:5050/api/questions?career=DataScientist&difficulty=Medium |
84 | | -``` |
85 | | -**Expected:** 20 Medium questions from DataScientistQ collection |
| 16 | +## ✨ Key Features |
| 17 | + |
| 18 | +### 🧠 Interactive Coding Experience |
| 19 | +- Built-in **code editor** with real-time execution |
| 20 | +- Supports multiple languages (Python, C++, Java, JavaScript) |
| 21 | +- Integrated with **Judge0 API** for code evaluation |
| 22 | + |
| 23 | +### 🎮 Gamification System |
| 24 | +- XP (Experience Points) system |
| 25 | +- Levels & progression tracking |
| 26 | +- Daily streaks 🔥 |
| 27 | +- Virtual currency (tokens) |
| 28 | + |
| 29 | +### 🏆 Achievements & Badges |
| 30 | +- Unlock badges based on milestones: |
| 31 | + - First problem solved |
| 32 | + - 5 / 10 / 25 problems solved |
| 33 | + - Language mastery badges |
| 34 | +- Leaderboard ranking system |
| 35 | + |
| 36 | +### 🤖 AI-Powered Assistance |
| 37 | +- AI-generated hints |
| 38 | +- Error diagnosis system |
| 39 | +- Guided learning support |
| 40 | + |
| 41 | +### 📊 User Analytics Dashboard |
| 42 | +Track user progress including: |
| 43 | +- Problems solved |
| 44 | +- Difficulty distribution (Easy/Medium/Hard) |
| 45 | +- Programming language progress |
| 46 | +- XP growth |
| 47 | + |
| 48 | +### 🔐 Authentication & Security |
| 49 | +- JWT-based authentication |
| 50 | +- Email verification & OTP system |
| 51 | +- Secure password hashing using bcrypt |
86 | 52 |
|
87 | 53 | --- |
88 | 54 |
|
89 | | -### Test 4: Get Software Engineer Hard Questions |
90 | | -``` |
91 | | -GET http://localhost:5050/api/questions?career=SoftwareEngineer&difficulty=Hard |
92 | | -``` |
93 | | -**Expected:** 20 Hard questions from SoftwareEngineerQ collection |
| 55 | +## 🏗️ Tech Stack |
94 | 56 |
|
95 | | ---- |
| 57 | +### 💻 Frontend |
| 58 | +- React.js |
| 59 | +- Tailwind CSS |
| 60 | +- Axios |
| 61 | +- Vite |
96 | 62 |
|
97 | | -### Test 5: Get Questions by Category |
98 | | -``` |
99 | | -GET http://localhost:5050/api/questions?career=SoftwareEngineer&difficulty=Hard&category=Security |
100 | | -``` |
101 | | -**Expected:** Only Security category questions |
| 63 | +### ⚙️ Backend |
| 64 | +- Node.js |
| 65 | +- Express.js |
| 66 | +- MongoDB (Mongoose) |
| 67 | +- Redis (Caching & performance optimization) |
102 | 68 |
|
103 | | ---- |
| 69 | +### 🧪 Code Execution |
| 70 | +- Judge0 API |
104 | 71 |
|
105 | | -### Test 6: Get Single Question |
106 | | -``` |
107 | | -GET http://localhost:5050/api/questions/69b1eb1f858eabad2fed4967?career=SoftwareEngineer |
108 | | -``` |
109 | | -(Use an actual `_id` from your Test 4 response) |
| 72 | +### 🐳 DevOps & Deployment |
| 73 | +- Docker & Docker Compose |
| 74 | +- Nginx (Frontend serving) |
| 75 | +- DigitalOcean (Hosting) |
| 76 | +- GitHub (Version Control + CI/CD) |
110 | 77 |
|
111 | 78 | --- |
112 | | - |
113 | | -### Test 7: Submit Answer |
114 | | -``` |
115 | | -POST http://localhost:5050/api/questions/submit |
116 | | -Content-Type: application/json |
117 | | -
|
118 | | -Body (raw JSON): |
119 | | -{ |
120 | | - "career": "SoftwareEngineer", |
121 | | - "questionId": "69b1eb1f858eabad2fed4967", |
122 | | - "answer": "A tree-like structure of a web page" |
123 | | -} |
124 | | -``` |
125 | | -**Expected:** `{ "success": true, "correct": true }` |
126 | | - |
127 | | ---- |
128 | | - |
129 | | -### Test 8: Submit Wrong Answer |
130 | | -``` |
131 | | -POST http://localhost:5050/api/questions/submit |
132 | | -Content-Type: application/json |
133 | | -
|
134 | | -Body: |
135 | | -{ |
136 | | - "career": "SoftwareEngineer", |
137 | | - "questionId": "69b1eb1f858eabad2fed4967", |
138 | | - "answer": "wrong answer" |
139 | | -} |
140 | | -``` |
141 | | -**Expected:** `{ "success": true, "correct": false, "correctAnswer": "..." }` |
142 | | - |
143 | | ---- |
144 | | - |
145 | | -## Progress API (Auth Required) |
146 | | - |
147 | | -### Test 9: Login First |
148 | | -``` |
149 | | -POST http://localhost:5050/api/auth/login |
150 | | -Content-Type: application/json |
151 | | -
|
152 | | -Body: |
153 | | -{ |
154 | | - "email": "your@email.com", |
155 | | - "password": "yourpassword" |
156 | | -} |
157 | | -``` |
158 | | -**Copy the token from response!** |
159 | | - |
160 | | ---- |
161 | | - |
162 | | -### Test 10: Get Progress (with token) |
163 | | -``` |
164 | | -GET http://localhost:5050/api/progress?career=MLEngineer |
165 | | -
|
166 | | -Authorization: Bearer <your_token> |
167 | | -``` |
168 | | -In Postman: **Authorization tab → Bearer Token → Paste token** |
169 | | - |
170 | | ---- |
171 | | - |
172 | | -### Test 11: Update Progress |
173 | | -``` |
174 | | -POST http://localhost:5050/api/progress/update |
175 | | -Authorization: Bearer <your_token> |
176 | | -Content-Type: application/json |
177 | | -
|
178 | | -Body: |
179 | | -{ |
180 | | - "career": "MLEngineer", |
181 | | - "difficulty": "Easy", |
182 | | - "correct": true |
183 | | -} |
184 | | -``` |
185 | | - |
186 | | ---- |
187 | | - |
188 | | -### Test 12: Get All Progress |
189 | | -``` |
190 | | -GET http://localhost:5050/api/progress/all |
191 | | -Authorization: Bearer <your_token> |
192 | | -``` |
193 | | - |
194 | | ---- |
195 | | - |
196 | | -### Test 13: Reset Progress |
197 | | -``` |
198 | | -POST http://localhost:5050/api/progress/reset |
199 | | -Authorization: Bearer <your_token> |
200 | | -Content-Type: application/json |
201 | | -
|
202 | | -Body: |
203 | | -{ |
204 | | - "career": "MLEngineer" |
205 | | -} |
0 commit comments