An open API service indexing awesome lists of open source software.

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.

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/)

```