A full-stack web application that allows developers to create, share, like, and comment on code snippets. Built using the MERN stack (MongoDB, Express, React, Node.js) with secure JWT-based authentication.
- Frontend (Vercel): https://binfn.vercel.app
- Backend (Render): https://binfn.onrender.com
- User registration and login using JWT
- Create, read, update, and delete code snippets
- Fields include title, description, language, tags, and the code itself
- Search snippets by keyword or user
- Like or unlike any snippet
- Add comments with timestamps
- View snippet details including likes and comments
- Node.js
- Express.js
- MongoDB & Mongoose
- JWT for authentication
- Helmet, CORS for security and logging
- React (with Hooks)
- Axios for API communication
- Tailwind CSS for styling
- Frontend: Vercel
- Backend: Render
-
Clone the repository:
git clone https://github.com/Bharaneedharan-K/Code-Sharing-Platform.git cd server -
Install dependencies:
npm install
-
Create a
.envfile:PORT= your_port_number MONGODB_URI=your_mongodb_connection ACCESS_TOKEN_SECRET=your_jwt_secret -
Start the server:
npm start
-
Navigate to the frontend directory:
cd ../client -
Install dependencies:
npm install
-
Run the frontend:
npm start
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup | Register new user |
| POST | /api/auth/login | Login and get JWT |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/snippets | Create a snippet |
| GET | /api/snippets | Get all snippets |
| GET | /api/snippets/:id | Get snippet by ID |
| PUT | /api/snippets/:id | Update snippet |
| DELETE | /api/snippets/:id | Delete snippet |
| Method | Endpoint | Description |
|---|---|---|
| PATCH | /api/snippets/:id/like | Like or unlike a snippet |
| POST | /api/snippets/:id/comment | Add a comment |
| GET | /api/snippets/:id/comments | Get comments for snippet |
This project is licensed under the MIT License.