Skip to content

Commit 1fbed4f

Browse files
committed
feat(core): setup modular NestJS backend with JWT auth and MongoDB
### Summary Initialized a scalable NestJS backend with modular architecture, JWT authentication, and MongoDB integration — forming a production-ready foundation for contests and alerts. ### Added - Modular structure for Auth, Users, Contests, and Alerts - MongoDB integration via Mongoose and env management - JWT-based authentication with Passport strategy and guards - Full user lifecycle: signup, signin, signout, token refresh - bcrypt password hashing (12 salt rounds) - Zod validation with global validation pipes - Protected routes and user preference management - Documentation setup (AUTH.md, USERS.md) ### Infrastructure - Jest testing: 56 test cases across 12 suites - ESLint + Prettier for code quality - Environment-based configuration management - Production-ready error handling and security ### API Endpoints - `POST /auth/signup` — Register new user - `POST /auth/signin` — Login user - `POST /auth/signout` — Logout user (protected) - `POST /auth/refresh` — Refresh JWT token - `GET /users/profile` — Get user profile (protected) - `PUT /users/profile` — Update user profile (protected)
0 parents  commit 1fbed4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+17995
-0
lines changed

README.md

Lines changed: 783 additions & 0 deletions
Large diffs are not rendered by default.

backend/.env.example

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# ==============================================
2+
# CodeNotify - Environment Configuration
3+
# ==============================================
4+
# Copy this file to .env.local and fill in the values
5+
6+
# ==============================================
7+
# Server Configuration
8+
# ==============================================
9+
PORT=3000
10+
NODE_ENV=development
11+
12+
# ==============================================
13+
# Database Configuration
14+
# ==============================================
15+
# For local development (default MongoDB port)
16+
MONGO_URI=mongodb://localhost:27017/codenotify
17+
18+
# For MongoDB Atlas (cloud)
19+
# MONGO_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/codenotify?retryWrites=true&w=majority
20+
21+
# ==============================================
22+
# Authentication
23+
# ==============================================
24+
# Generate a strong secret key (at least 10 characters)
25+
# You can use: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
26+
JWT_SECRET=your_jwt_secret_key_here_change_this_in_production
27+
JWT_REFRESH_SECRET=your_jwt_refresh_secret_key_here_change_this_in_production
28+
29+
# ==============================================
30+
# Contest Platform APIs
31+
# ==============================================
32+
# Codeforces API endpoint (optional, can be left empty for now)
33+
CODEFORCES_API=https://codeforces.com/api
34+
35+
# LeetCode API endpoint (optional, can be left empty for now)
36+
LEETCODE_API=https://leetcode.com/graphql
37+
38+
# ==============================================
39+
# WhatsApp Cloud API (Meta Business)
40+
# ==============================================
41+
# Get these from: https://developers.facebook.com/apps
42+
# Optional - only needed when implementing WhatsApp notifications
43+
44+
# Your WhatsApp Business API Access Token
45+
WHATSAPP_API_KEY=your_whatsapp_api_access_token
46+
47+
# Your WhatsApp Phone Number ID
48+
WHATSAPP_PHONE_ID=your_whatsapp_phone_id
49+
50+
# Your WhatsApp Business Account ID
51+
WHATSAPP_BUSINESS_ACCOUNT_ID=your_business_account_id

backend/.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

0 commit comments

Comments
 (0)