https://github.com/lokhande2000/marketpulse
The Stock Discussion Platform backend enables users to register, post stock-related discussions, comment, like posts, and filter/sort content using the MERN stack, with JWT authentication and real-time updates.
https://github.com/lokhande2000/marketpulse
express mongodb node-js npm-package soket-io
Last synced: 3 months ago
JSON representation
The Stock Discussion Platform backend enables users to register, post stock-related discussions, comment, like posts, and filter/sort content using the MERN stack, with JWT authentication and real-time updates.
- Host: GitHub
- URL: https://github.com/lokhande2000/marketpulse
- Owner: lokhande2000
- Created: 2024-09-12T08:55:12.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-13T03:38:21.000Z (about 1 year ago)
- Last Synced: 2025-03-12T06:15:02.765Z (7 months ago)
- Topics: express, mongodb, node-js, npm-package, soket-io
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MarketPulse
This project is a backend service for a Stock Discussion Platform, built with the MERN stack. Users can discuss various stocks, create posts, add comments, like posts, and filter or sort stock-related posts. The backend manages user authentication, post management, comments, and likes.
## Features
- User Authentication: JWT-based authentication system with registration and login.
- Stock Post Management: Users can create posts about specific stocks, edit, delete, and view posts.
- Comment System: Users can comment on posts.
- Like System: Users can like or unlike posts.
- Filtering & Sorting: Posts can be filtered by stock symbol or tags and sorted by creation date or likes.
- Real-time Updates (Optional): New comments or likes can be updated in real-time using Socket.io.## Tech Stack
- MongoDB: For data storage.
- Express.js: For creating the backend API.
- Node.js: JavaScript runtime for the backend.
- JWT: For secure user authentication.
- Socket.io (Optional): For real-time updates.
- Swagger/Postman: For API documentation.## Installation
Follow these steps to set up and run the project locally.
## Prerequisites
- Node.js: Ensure you have Node.js installed. You can download it from here.
- MongoDB: Ensure MongoDB is installed and running locally or use a cloud-based service like MongoDB Atlas.
- Postman: For testing the API, you can use Postman or Swagger for documentation.## Setup
1. Clone the repository:
`git clone https://github.com/lokhande2000/MarketPulse.git`
2. Navigate to the project directory:
`cd backend`
3. Install the necessary dependencies:
`npm install`
4. Create a .env file in the root of your project, and add the following environment variables:
`MONGO_URI=your-mongodb-connection-string
JWT_SECRET=your-jwt-secret
PORT=8080`
5. Start the server:
`npm start` 6. The server should be running at http://localhost:8080.# API Endpoints
## Authentication
- POST /auth/register: Register a new user.
- POST /auth/login: Login user and return JWT.
- GET /auth/profile/
: Get user profile by ID.
- PUT /auth/profile: Update user profile.
Stock Posts
- POST /posts: Create a new stock post.
- GET /posts: Get all stock posts with optional filtering and sorting.
- GET /posts/
: Get a single stock post with comments.
- DELETE /posts/
: Delete a post by its ID.
Comments
- POST /comments/
: Add a comment to a post.
- DELETE /comments/
: Delete a comment by its ID.
Likes
- POST /likes/
: Like a post.
- DELETE /likes/
: Unlike a post.## Folder Structure
```
.
├── controllers
│ ├── authController.js
│ ├── postController.js
│ ├── commentController.js
│ ├── likeController.js
├── models
│ ├── userModel.js
│ ├── postModel.js
│ ├── commentModel.js
│ ├── likeModel.js
├── routes
│ ├── authRoutes.js
│ ├── postRoutes.js
│ ├── commentRoutes.js
│ ├── likeRoutes.js
├── middleware
│ ├── authMiddleware.js
├── index.js
└── .env```