https://github.com/shivam-kumar-59/project-h-backend
A powerful backend system designed to handle user authentication, social interactions, job postings, and more with seamless integrations like Clerk and Ngrok. Built using Node.js, Express.js and MongoDB, this backend ensures scalability, reliability, and security.
https://github.com/shivam-kumar-59/project-h-backend
Last synced: about 2 months ago
JSON representation
A powerful backend system designed to handle user authentication, social interactions, job postings, and more with seamless integrations like Clerk and Ngrok. Built using Node.js, Express.js and MongoDB, this backend ensures scalability, reliability, and security.
- Host: GitHub
- URL: https://github.com/shivam-kumar-59/project-h-backend
- Owner: SHIVAM-KUMAR-59
- Created: 2024-12-22T13:57:21.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-02-15T09:13:23.000Z (4 months ago)
- Last Synced: 2025-02-15T10:22:22.102Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.1 MB
- Stars: 0
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Project H Backend**
A powerful backend system designed to handle user authentication, social interactions, job postings, and more with seamless integrations like Clerk and Ngrok. Built using **Node.js**, **Express.js** and **MongoDB**, this backend ensures scalability, reliability, and security.
---
## **๐ Features**
- User Authentication (OAuth, OTP, Forgot Password)
- Post Creation, Likes, and Comments
- Job Postings and Applications
- Webhook Integration with Clerk
- Secure API with Webhook Signature Verification---
## **โ๏ธ Prerequisites**
Ensure the following are installed on your system:
- **Node.js** (v14+)
- **MongoDB** (Local or MongoDB Atlas)
- **Ngrok** (For webhook testing)---
## **๐ Getting Started**
Follow these steps to set up and run the project:
### **1. Clone the Repository**
```bash
git clone https://github.com/SHIVAM-KUMAR-59/Project-H-Backend.git
cd Project-H-Backend
```### **2. Install Dependencies**
```bash
npm install
```### **3. Set Environment Variables**
Create a .env file in the root directory and add the following:
```bash
CLERK_PUBLISHABLE_KEY=your_publishable_key
CLERK_SECRET_KEY=your_secret_key
CLERK_WEBHOOK_SECRET=your_webhook_secret
SIGNING_SECRET=whsec_1234567890abcdef
```### **4. Run the Application**
```bash
node index.js
```---
# ๐ API Routes
## Auth Routes
| Method | Endpoint | Description |
| ------ | -------------------------- | ------------ |
| POST | `/auth/login` | User login |
| POST | `/auth/google` | Google OAuth |
| POST | `/auth/github` | GitHub OAuth |
| POST | `/auth/updateUser/:userId` | Update User |
| POST | `/auth/deleteUser/:userId` | Delete User |---
## User Routes
| Method | Endpoint | Description |
| ------ | ---------------------------- | ---------------------- |
| GET | `/users/:id` | Get user details by ID |
| PATCH | `/users/:id` | Update user profile |
| DELETE | `/users/:id` | Delete user |
| POST | `/users/:id/follow-unfollow` | Follow/Unfollow user |
| GET | `/users/:id/followers` | Get followers |
| GET | `/users/:id/following` | Get following |---
## Post Routes
| Method | Endpoint | Description |
| ------ | ------------------------ | ------------------- |
| POST | `/posts` | Create a post |
| GET | `/posts` | Get all posts |
| GET | `/posts/:id` | Get post by ID |
| PATCH | `/posts/:id` | Update post |
| DELETE | `/posts/:id` | Delete post |
| POST | `/posts/:id/like-unlike` | Like/Unlike post |
| POST | `/posts/:id/comment` | Add comment to post |
| GET | `/posts/:id/comments` | Get comments |---
## Job Routes
| Method | Endpoint | Description |
| ------ | ---------------------- | ------------------ |
| POST | `/jobs` | Create job post |
| GET | `/jobs` | Get all job posts |
| GET | `/jobs/:id` | Get job post by ID |
| PATCH | `/jobs/:id` | Update job post |
| DELETE | `/jobs/:id` | Delete job post |
| POST | `/jobs/:id/apply` | Apply for job |
| GET | `/jobs/:id/applicants` | Get job applicants |---
## Comment Routes
| Method | Endpoint | Description |
| ------ | ----------------------- | ----------------- |
| GET | `/comments/:id` | Get comment by ID |
| PATCH | `/comments/:id` | Update comment |
| DELETE | `/comments/:id` | Delete comment |
| POST | `/comments/:id/reply` | Reply to comment |
| GET | `/comments/:id/replies` | Get replies |---
# ๐ ๏ธ Setting Up Ngrok
1. **Install Ngrok**
Download and install Ngrok from the [Ngrok Website](https://ngrok.com/download).2. **Start Ngrok Tunnel**
Run the following command to start an Ngrok tunnel for your application:```bash
ngrok http 5001
```Replace `5001` with the port number your application is running on.
3. **Copy the Generated URL**
After running the command, Ngrok will generate a public URL (e.g., `https://example.ngrok-free.app`).
Use this URL to configure webhooks.# ๐ Schema Diagram
# ๐ User Flow
---
# ๐งช Testing
Use Postman or any API testing tool to test all the endpoints and ensure proper functionality.