|
1 | | -# CodeNotify 🔔 |
| 1 | +# CodeNotify |
2 | 2 |
|
3 | | -**Smart Contest Alert System** - Never miss a competitive programming contest again. |
| 3 | +> **Smart Contest Alert System** |
| 4 | +> Never miss a competitive programming contest again. Get personalized notifications from Codeforces, LeetCode, CodeChef, and AtCoder. |
4 | 5 |
|
5 | | -Get personalized notifications from **Codeforces**, **LeetCode**, **CodeChef**, and **AtCoder** with multi-channel delivery (Email, WhatsApp, Push). |
| 6 | + |
6 | 7 |
|
7 | | -[](LICENSE) |
8 | | -[](https://nestjs.com/) |
9 | | -[](https://www.typescriptlang.org/) |
10 | | -[](https://www.mongodb.com/) |
| 8 | +## 📚 Documentation |
11 | 9 |
|
12 | | ---- |
| 10 | +Complete documentation is available in the [`docs`](./docs) directory. |
13 | 11 |
|
14 | | -## ✨ Features |
| 12 | +- **[Quick StartGuide](./docs/guide/quick-start.md)** |
| 13 | +- **[Server Documentation](./docs/server/modules/README.md)** |
| 14 | +- **[Client Documentation](./docs/client/README.md)** |
| 15 | +- **[API Reference](./docs/api/overview.md)** |
15 | 16 |
|
16 | | -- 🔐 **Secure Authentication** - JWT-based auth with refresh token rotation (15min access + 7 days refresh) |
17 | | -- 🌐 **Multi-Platform Integration** - Unified adapter pattern for 4 major competitive programming platforms |
18 | | -- 🔔 **Multi-Channel Notifications** - Email (Resend), WhatsApp (Cloud API), and Push notifications |
19 | | -- ⚡ **Automated Scheduling** - Contest sync every 6 hours, notifications every 30 minutes |
20 | | -- 🎯 **Advanced Filtering** - Full-text search, platform/phase/type/difficulty filters with pagination |
21 | | -- 🏗️ **Modular Architecture** - NestJS modules with dependency injection following SOLID principles |
22 | | -- 📊 **Analytics & Statistics** - Global and platform-specific contest analytics |
23 | | -- ✅ **Type-Safe Validation** - Zod schemas with TypeScript type inference |
24 | | -- 🔒 **Enterprise Security** - JWT guards, RBAC, CORS, environment management |
25 | | -- 🗄️ **Optimized Database** - MongoDB with compound indexes and aggregation pipelines |
| 17 | +## ✨ Features |
26 | 18 |
|
27 | | ---- |
| 19 | +- **Multi-Platform**: Support for Codeforces, LeetCode, CodeChef, and AtCoder. |
| 20 | +- **Smart Notifications**: |
| 21 | + - Personalized alerts based on your preferences. |
| 22 | + - Multi-channel delivery: **Email**, **WhatsApp**, and **Push**. |
| 23 | + - Customizable timing (e.g., "Notify me 2 hours before"). |
| 24 | +- **Secure Authentication**: |
| 25 | + - JWT-based auth with refresh tokens. |
| 26 | + - **New**: Email OTP verification flow. |
| 27 | +- **Robust Architecture**: |
| 28 | + - **Server**: NestJS, MongoDB, BullMQ (Scheduling). |
| 29 | + - **Client**: Next.js 15, Tailwind CSS, Zustand, React Query. |
28 | 30 |
|
29 | | -## 🚀 Quick Start |
| 31 | +## 🚀 Getting Started |
30 | 32 |
|
31 | 33 | ### Prerequisites |
32 | 34 |
|
33 | | -- Node.js 22.x or higher |
34 | | -- MongoDB 7.x or higher |
| 35 | +- Node.js 18+ |
| 36 | +- MongoDB |
35 | 37 | - npm or yarn |
36 | 38 |
|
37 | 39 | ### Installation |
38 | 40 |
|
39 | | -```bash |
40 | | -# Clone the repository |
41 | | -git clone https://github.com/Celestial-0/CodeNotify.git |
42 | | -cd CodeNotify |
43 | | - |
44 | | -# Install server dependencies |
45 | | -cd server |
46 | | -npm install |
47 | | - |
48 | | -# Configure environment |
49 | | -cp .env.example .env.local |
50 | | -# Edit .env.local with your configuration |
51 | | - |
52 | | -# Start development server |
53 | | -npm run start:dev |
54 | | -``` |
55 | | - |
56 | | -The API will be available at `http://localhost:3000` |
57 | | - |
58 | | ---- |
59 | | - |
60 | | -## 🛠️ Tech Stack |
61 | | - |
62 | | -### Server |
63 | | -- **NestJS 11** - Server framework with TypeScript 5.9 |
64 | | -- **MongoDB** - NoSQL database with Mongoose ODM |
65 | | -- **Passport JWT** - Authentication with bcrypt |
66 | | -- **Zod** - Runtime validation & type safety |
67 | | - |
68 | | -### Platform Integrations |
69 | | -- **Codeforces** - REST API integration |
70 | | -- **LeetCode** - GraphQL API integration |
71 | | -- **CodeChef** - REST API integration |
72 | | -- **AtCoder** - Community API integration |
73 | | - |
74 | | -### Notification Services |
75 | | -- **Resend** - Email notifications |
76 | | -- **WhatsApp** - Cloud API messaging |
77 | | -- **Push** - Mobile push alerts |
78 | | - |
79 | | ---- |
80 | | - |
81 | | -## 📡 API Endpoints |
82 | | - |
83 | | -CodeNotify provides a comprehensive REST API with **40+ endpoints**: |
84 | | - |
85 | | -### Authentication (6 endpoints) |
86 | | -- `POST /auth/signup` - Create new user account |
87 | | -- `POST /auth/signin` - Authenticate user |
88 | | -- `POST /auth/refresh` - Get new access token |
89 | | -- `POST /auth/signout` - Invalidate tokens |
90 | | -- `GET /auth/me` - Get current user profile |
91 | | -- `POST /auth/verify-email` - Verify email address |
92 | | - |
93 | | -### Users (8 endpoints) |
94 | | -- `GET /users/profile` - Get user profile |
95 | | -- `PATCH /users/profile` - Update user profile |
96 | | -- `GET /users/preferences` - Get notification preferences |
97 | | -- `PATCH /users/preferences` - Update notification preferences |
98 | | -- `GET /users/platforms` - Get selected platforms |
99 | | -- `PATCH /users/platforms` - Update platform preferences |
100 | | -- `DELETE /users/account` - Delete user account |
101 | | -- `GET /users/stats` - Get user statistics |
102 | | - |
103 | | -### Contests (18 endpoints) |
104 | | -- `GET /contests` - List all contests (paginated) |
105 | | -- `GET /contests/:id` - Get contest by ID |
106 | | -- `GET /contests/platform/:platform` - Filter by platform |
107 | | -- `GET /contests/upcoming` - Get upcoming contests |
108 | | -- `GET /contests/running` - Get running contests |
109 | | -- `GET /contests/finished` - Get finished contests |
110 | | -- `GET /contests/search` - Search contests |
111 | | -- `GET /contests/difficulty/:level` - Filter by difficulty |
112 | | -- `GET /contests/type/:type` - Filter by contest type |
113 | | -- `GET /contests/stats` - Get global statistics |
114 | | -- `GET /contests/stats/:platform` - Get platform statistics |
115 | | -- `POST /contests/sync/:platform` - Sync platform contests (admin) |
116 | | -- `POST /contests/sync/all` - Sync all platforms (admin) |
117 | | -- `GET /contests/health` - Health check |
118 | | - |
119 | | -### Notifications (8 endpoints) |
120 | | -- `GET /notifications` - List user notifications |
121 | | -- `GET /notifications/:id` - Get notification by ID |
122 | | -- `PATCH /notifications/:id/read` - Mark as read |
123 | | -- `PATCH /notifications/read-all` - Mark all as read |
124 | | -- `DELETE /notifications/:id` - Delete notification |
125 | | -- `POST /notifications/test` - Send test notification |
126 | | -- `GET /notifications/stats` - Get notification statistics |
127 | | -- `GET /notifications/history` - Get notification history |
128 | | - |
129 | | ---- |
130 | | - |
131 | | -## 🏗️ Architecture |
132 | | - |
133 | | -``` |
134 | | -┌─────────────┐ |
135 | | -│ Client │ |
136 | | -└──────┬──────┘ |
137 | | - │ |
138 | | -┌──────▼──────────────────────────────────────┐ |
139 | | -│ API Gateway (NestJS) │ |
140 | | -├─────────────┬──────────────┬────────────────┤ |
141 | | -│ Auth Module │ Users Module │ Contests Module│ |
142 | | -└─────────────┴──────────────┴────────┬───────┘ |
143 | | - │ |
144 | | - ┌─────────────────┼─────────────────┐ |
145 | | - │ │ │ |
146 | | - ┌───────▼────────┐ ┌─────▼──────┐ ┌───────▼────────┐ |
147 | | - │ Codeforces │ │ LeetCode │ │ CodeChef │ |
148 | | - │ Adapter │ │ Adapter │ │ Adapter │ |
149 | | - └────────────────┘ └────────────┘ └────────┬───────┘ |
150 | | - │ |
151 | | - ┌────────▼────────┐ |
152 | | - │ AtCoder │ |
153 | | - │ Adapter │ |
154 | | - └─────────────────┘ |
155 | | - ┌─────────────────────────────────┐ |
156 | | - │ Scheduler Service │ |
157 | | - │ (Contest Sync + Notifications) │ |
158 | | - └────────────┬────────────────────┘ |
159 | | - │ |
160 | | - ┌────────────▼────────────────────┐ |
161 | | - │ Notifications Module │ |
162 | | - ├──────────┬──────────┬───────────┤ |
163 | | - │ Email │ WhatsApp │ Push │ |
164 | | - └──────────┴──────────┴───────────┘ |
165 | | - │ |
166 | | - ┌────────────▼────────────────────┐ |
167 | | - │ MongoDB │ |
168 | | - │ (Users, Contests, Notifications)│ |
169 | | - └─────────────────────────────────┘ |
170 | | -``` |
171 | | - |
172 | | -### Key Design Patterns |
173 | | -- **Adapter Pattern** - Unified interface for multiple contest platforms |
174 | | -- **Dependency Injection** - NestJS IoC container for loose coupling |
175 | | -- **Repository Pattern** - Data access abstraction with Mongoose |
176 | | -- **Strategy Pattern** - Multi-channel notification delivery |
177 | | -- **Scheduler Pattern** - Cron-based automated tasks |
178 | | - |
179 | | ---- |
180 | | - |
181 | | -## 📚 Documentation |
182 | | - |
183 | | -Comprehensive documentation is available at [https://celestial-0.github.io/CodeNotify/](https://celestial-0.github.io/CodeNotify/) |
184 | | - |
185 | | -- **[Getting Started Guide](docs/guide/introduction.md)** - Learn about CodeNotify's features |
186 | | -- **[API Reference](docs/api/overview.md)** - Complete REST API documentation |
187 | | -- **[Server Architecture](docs/server/architecture.md)** - System design and module structure |
188 | | -- **[Platform Adapters](docs/server/adapters.md)** - Integration with contest platforms |
189 | | -- **[Database Design](docs/server/database.md)** - MongoDB schemas and optimization |
190 | | - |
191 | | ---- |
192 | | - |
193 | | -## 🔧 Configuration |
194 | | - |
195 | | -Create a `.env.local` file in the `server` directory: |
196 | | - |
197 | | -```env |
198 | | -# Server |
199 | | -PORT=3000 |
200 | | -NODE_ENV=development |
201 | | -
|
202 | | -# Database |
203 | | -MONGODB_URI=mongodb://localhost:27017/codenotify |
204 | | -
|
205 | | -# JWT |
206 | | -JWT_SECRET=your-secret-key |
207 | | -JWT_EXPIRES_IN=15m |
208 | | -JWT_REFRESH_SECRET=your-refresh-secret |
209 | | -JWT_REFRESH_EXPIRES_IN=7d |
210 | | -
|
211 | | -# Email (Resend) |
212 | | -RESEND_API_KEY=your-resend-api-key |
213 | | - |
214 | | -
|
215 | | -# WhatsApp (Cloud API) |
216 | | -WHATSAPP_API_URL=https://graph.facebook.com/v17.0 |
217 | | -WHATSAPP_PHONE_NUMBER_ID=your-phone-number-id |
218 | | -WHATSAPP_ACCESS_TOKEN=your-access-token |
219 | | -
|
220 | | -# Push Notifications |
221 | | -PUSH_NOTIFICATION_KEY=your-push-key |
222 | | -``` |
223 | | - |
224 | | ---- |
225 | | - |
226 | | -## 🧪 Testing |
227 | | - |
228 | | -```bash |
229 | | -# Unit tests |
230 | | -npm run test |
231 | | - |
232 | | -# E2E tests |
233 | | -npm run test:e2e |
234 | | - |
235 | | -# Test coverage |
236 | | -npm run test:cov |
237 | | -``` |
238 | | - |
239 | | ---- |
240 | | - |
241 | | -## 📦 Project Structure |
242 | | - |
243 | | -``` |
244 | | -CodeNotify/ |
245 | | -├── server/ |
246 | | -│ ├── src/ |
247 | | -│ │ ├── auth/ # Authentication module |
248 | | -│ │ ├── users/ # User management |
249 | | -│ │ ├── contests/ # Contest management |
250 | | -│ │ ├── notifications/ # Multi-channel notifications |
251 | | -│ │ ├── integrations/ # Platform adapters |
252 | | -│ │ │ ├── platforms/ # Base adapter & registry |
253 | | -│ │ │ ├── codeforces/ # Codeforces adapter |
254 | | -│ │ │ ├── leetcode/ # LeetCode adapter |
255 | | -│ │ │ ├── codechef/ # CodeChef adapter |
256 | | -│ │ │ └── atcoder/ # AtCoder adapter |
257 | | -│ │ ├── common/ # Shared utilities |
258 | | -│ │ └── config/ # Configuration |
259 | | -│ ├── test/ # E2E tests |
260 | | -│ └── package.json |
261 | | -├── docs/ # VitePress documentation |
262 | | -└── README.md |
263 | | -``` |
264 | | - |
265 | | ---- |
| 41 | +1. **Clone the repository** |
| 42 | + ```bash |
| 43 | + git clone https://github.com/Celestial-0/CodeNotify.git |
| 44 | + cd CodeNotify |
| 45 | + ``` |
| 46 | + |
| 47 | +2. **Server Setup** |
| 48 | + ```bash |
| 49 | + cd server |
| 50 | + npm install |
| 51 | + cp .env.example .env |
| 52 | + # Update .env with your credentials |
| 53 | + npm run start:dev |
| 54 | + ``` |
| 55 | + |
| 56 | +3. **Client Setup** |
| 57 | + ```bash |
| 58 | + cd ../client/web |
| 59 | + npm install |
| 60 | + cp .env.example .env.local |
| 61 | + npm run dev |
| 62 | + ``` |
266 | 63 |
|
267 | 64 | ## 🤝 Contributing |
268 | 65 |
|
269 | | -Contributions are welcome! Please read our [Contributing Guide](docs/contributing.md) for details. |
270 | | - |
271 | | -1. Fork the repository |
272 | | -2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
273 | | -3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
274 | | -4. Push to the branch (`git push origin feature/amazing-feature`) |
275 | | -5. Open a Pull Request |
276 | | - |
277 | | ---- |
| 66 | +We welcome contributions! Please see [CONTRIBUTING.md](./docs/contributing.md) for details. |
278 | 67 |
|
279 | 68 | ## 📄 License |
280 | 69 |
|
281 | | -This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details. |
282 | | - |
283 | | ---- |
284 | | - |
285 | | -## 👨💻 Author |
286 | | - |
287 | | -**Yash Kumar Singh** |
288 | | - |
289 | | -- GitHub: [@Celestial-0](https://github.com/Celestial-0) |
290 | | - |
291 | | ---- |
292 | | - |
293 | | -## 🙏 Acknowledgments |
294 | | - |
295 | | -- Built with ❤️ for competitive programmers worldwide |
296 | | -- Powered by [NestJS](https://nestjs.com/), [MongoDB](https://www.mongodb.com/), and [TypeScript](https://www.typescriptlang.org/) |
297 | | -- Contest data from [Codeforces](https://codeforces.com/), [LeetCode](https://leetcode.com/), [CodeChef](https://www.codechef.com/), and [AtCoder](https://atcoder.jp/) |
298 | | - |
299 | | ---- |
300 | | - |
301 | | -<div align="center"> |
302 | | - |
303 | | -**[Documentation](https://celestial-0.github.io/CodeNotify/)** • **[API Reference](https://celestial-0.github.io/CodeNotify/api/overview)** • **[Report Bug](https://github.com/Celestial-0/CodeNotify/issues)** • **[Request Feature](https://github.com/Celestial-0/CodeNotify/issues)** |
304 | | - |
305 | | -</div> |
| 70 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments