DevTinder is a MERN stack web application designed to help developers connect and collaborate, similar to Tinder but specifically for developers. Users can create profiles, explore other developers, send connection requests, and manage their matches.
This repository contains the backend of DevTinder, built with Node.js, Express, and MongoDB, following a microservices architecture for scalability.
⚠️ Note: The backend is fully functional and ready for further scaling and optimizations.
I learned and maintained all my Node.js knowledge in one place: Namsate Nodejs
- Backend Framework: Node.js + Express.js
- Database: MongoDB + Mongoose
- Authentication: JWT (JSON Web Tokens) + Cookies
- Encryption: bcryptjs for password hashing
- API Testing: Postman
- Environment Variables Management: dotenv
- Package Manager: npm
✅ User Signup, Login, and Logout
✅ JWT-based authentication with secure cookies
✅ Password encryption using bcryptjs
✅ Authentication middleware to protect routes
✅ View user profile
✅ Edit profile details (restricted fields for security)
✅ Update password with validation
✅ Send connection requests (Interested
or Ignored
)
✅ Accept or reject received requests
✅ Prevent duplicate requests using MongoDB validation
✅ Prevent self-requests using Mongoose .pre
middleware
✅ Fetch suggested developers while excluding:
- Logged-in user
- Existing connections
- Ignored users
- Users with pending requests
✅ Implemented pagination usingskip
&limit
✅ Optimized query using MongoDB $nin and $ne operators
✅ User Schema:
- Sanitized input fields (
trim
,lowercase
, validation) - Unique constraints on email and username
✅ ConnectionRequest Schema:
fromUserId
,toUserId
,status
with enum validation- Indexed fields for optimized queries
- Prevents multiple requests between the same users
✅ Indexes & Compound Indexes:
- Used
index: true
for faster queries - Implemented compound indexes to optimize search
✅ Authentication Middleware: Protects private routes
✅ Error Handling Middleware: Centralized error response
✅ Mongoose .pre
Middleware: Prevents self-requests
✅ Modular route organization for maintainability
✅ APIs structured into separate routers (auth
, profile
, connections
, users
)
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /auth/signup |
Register a new user | ❌ |
POST | /auth/login |
Authenticate user & issue JWT | ❌ |
POST | /auth/logout |
Logout user by clearing JWT cookie | ✅ |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
GET | /profile/view |
Get logged-in user profile | ✅ |
PATCH | /profile/edit |
Update allowed profile fields | ✅ |
PATCH | /profile/password |
Update user password | ✅ |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /request/send/:status/:toUserId |
Send a connection request (Interested/Ignored) | ✅ |
POST | /request/review/:status/:requestId |
Accept/Reject a request | ✅ |
GET | /user/requests/received |
Fetch pending connection requests | ✅ |
GET | /user/connections |
Fetch accepted connections | ✅ |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
GET | /user/feed?page=1&limit=10 |
Get suggested developer profiles with pagination | ✅ |
git clone https://github.com/akshadjaiswal/devTinder-backend.git
cd devTinder-backend
Create a .env
file and add:
DATABASE_URL=mongodb+srv://<username>:<password>@cluster0.mongodb.net/devTinder
JWT_SECRET=your_jwt_secret
PORT=3000
npm start
Server runs at: http://localhost:3000/
The frontend for DevTinder is available at: 🔗 DevTinder Frontend Repository
Make sure the backend is running before accessing the frontend.
Explore my additional repositories to deepen your understanding of related topics in the JavaScript ecosystem:
- Namaste Javascript: A repository focused on learning Javascript concepts, from basics to advanced programming.
- Namaste React: A repository dedicated to mastering React.js, covering foundational and advanced aspects of building interactive UIs.
Since the project is now fully functional, improvements are still welcome!
✅ Feel free to open issues for bugs or feature requests.
✅ Fork the repository and submit a pull request.
🔹 Real-time notifications using WebSockets
🔹 Messaging System for better user interaction
🔹 Profile Search & Filtering
🔹 Unit Testing for API reliability
This project is open-source and available under the MIT License.