https://github.com/himanshudubey7/skill_bridge_backend
Skill Exchange Platform (Backend) โ A Node.js and MongoDB-powered API that enables users to register, create skill-based profiles, post skill offers or requirements, and communicate through a simple messaging system. Includes JWT authentication and RESTful endpoints for easy integration.
https://github.com/himanshudubey7/skill_bridge_backend
expressjs jwt-authentication mongodb nodejs socket-io
Last synced: 3 months ago
JSON representation
Skill Exchange Platform (Backend) โ A Node.js and MongoDB-powered API that enables users to register, create skill-based profiles, post skill offers or requirements, and communicate through a simple messaging system. Includes JWT authentication and RESTful endpoints for easy integration.
- Host: GitHub
- URL: https://github.com/himanshudubey7/skill_bridge_backend
- Owner: himanshudubey7
- Created: 2025-04-06T00:49:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-04T06:08:53.000Z (about 1 year ago)
- Last Synced: 2025-05-04T07:19:38.675Z (about 1 year ago)
- Topics: expressjs, jwt-authentication, mongodb, nodejs, socket-io
- Language: JavaScript
- Homepage:
- Size: 4.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฌ Skill Bridge Platform - Backend
A backend API for a Skill Exchange Platform where users can sign up, create skill-based profiles, post their skills or requirements, and
communicate with each other through a simple messaging system. Built using **Node.js**, **Express**, **MongoDB**, and **JWT-based Authentication**.
---
## ๐ Project Structure
skill-exchange-backend/
โโโ models/
โ โโโ user.js
โ โโโ profile.js
โ โโโ skillPost.js
โ โโโ chat.js
โโโ routes/
โ โโโ authRoutes.js
โ โโโ profileRoutes.js
โ โโโ skillPost.js
โ โโโ messages.js
โโโ .env
โโโ server.js
โโโ package.json
โโโ README.md
## ๐ Features
- ๐ User Authentication (JWT-based)
- ๐ค User Profiles with Skills and Requirements
- ๐ Skill Posting (Filterable by category or keyword)
- ๐ Simple Messaging System (store & fetch messages between users)
- ๐ CORS support for frontend integration
- ๐ฆ MongoDB (Mongoose) based models and schema validation
## ๐ง Installation
### 1. Clone the repository
bash
git clone https://github.com/yourusername/skill-exchange-backend.git
cd skill-exchange-backend
### 2. Install dependencies
```bash
npm install
```
### 3. Set up environment variables
Create a `.env` file in the root with the following variables:
```env
PORT=5000
MONGO_URI=mongodb://localhost:27017/skill-exchange
JWT_SECRET=your_jwt_secret_key
```
> ๐ก You can use MongoDB Atlas or a local MongoDB instance.
---
## โถ๏ธ Run the server
```bash
npm start
```
The server will be running at:
๐ `http://localhost:5000`
---
## ๐ ๏ธ API Routes
### ๐ Authentication
- **POST /api/auth/register** โ Register a new user
- **POST /api/auth/login** โ Login and get JWT token
### ๐ค Profiles
- **POST /api/profile** โ Create or update user profile
- **GET /api/profile/:userId** โ Get profile by user ID
### ๐ข Skill Posts
- **POST /api/posts** โ Create a skill/requirement post
- **GET /api/posts** โ Get all posts (with optional filters)
### ๐ฌ Messages
- **POST /api/messages/send** โ Send a message to another user
- **GET /api/messages/:userId** โ Fetch all messages between logged-in user and target user
---
## ๐งช Testing with Postman
1. Register/login a user โ Get JWT token
2. Create profile and posts
3. Use the token in `Authorization` header for protected routes:
```
Authorization: Bearer
```
4. Test sending messages:
```
POST /api/messages/send
Body:
{
"to": "",
"message": "Hey, let's connect!"
}
```
5. Fetch messages:
```
GET /api/messages/
```
---
## ๐ฑ Frontend Integration
To test messaging, you can use a simple frontend HTML page:
```html
const socket = io("http://localhost:5000", {
auth: {
token: "<your_jwt_token>"
}
});
socket.emit("send_message", { to: "<user_id>", message: "Hello!" });
socket.on("receive_message", (data) => {
console.log("Received:", data);
});
```
> You can also skip real-time sockets and rely on REST messaging endpoints if you want simpler integration.
---
## ๐ก Future Improvements
- โ
Real-time chat with Socket.IO
- ๐ฌ Notifications for new messages
- ๐ง AI-suggested matches or skill pairings
- ๐ฑ Full frontend (React) integration
- ๐ User ratings and endorsements
---
## ๐ Author
This project is belongs to himanshudubey7.
---
## ๐ค Author
- GitHub: [himanshudubey7](https://github.com/himanshudubey7)
- LinkedIn: [Linkdin](https://www.linkedin.com/in/himanshu-dubey-887275249/)
```