Skip to content

Bharaneedharan-K/Code-Sharing-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

🚀 Code Snippet Sharing Platform

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.

🌐 Live Demo


📸 Features

🔐 Authentication

  • User registration and login using JWT

🧠 Snippet Management

  • Create, read, update, and delete code snippets
  • Fields include title, description, language, tags, and the code itself
  • Search snippets by keyword or user

❤️ Interactions

  • Like or unlike any snippet
  • Add comments with timestamps
  • View snippet details including likes and comments

🛠 Tech Stack

🔧 Backend

  • Node.js
  • Express.js
  • MongoDB & Mongoose
  • JWT for authentication
  • Helmet, CORS for security and logging

🎨 Frontend

  • React (with Hooks)
  • Axios for API communication
  • Tailwind CSS for styling

☁ Hosting

  • Frontend: Vercel
  • Backend: Render

🚀 Getting Started Locally

Backend

  1. Clone the repository:

    git clone https://github.com/Bharaneedharan-K/Code-Sharing-Platform.git
    cd server
  2. Install dependencies:

    npm install
  3. Create a .env file:

    PORT= your_port_number
    MONGODB_URI=your_mongodb_connection
    ACCESS_TOKEN_SECRET=your_jwt_secret
    
  4. Start the server:

    npm start

Frontend

  1. Navigate to the frontend directory:

    cd ../client
  2. Install dependencies:

    npm install
  3. Run the frontend:

    npm start

📡 API Overview

Auth Routes

Method Endpoint Description
POST /api/auth/signup Register new user
POST /api/auth/login Login and get JWT

Snippet Routes

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

Like and Comment Routes

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

🧠 License

This project is licensed under the MIT License.

About

This website is a code snippet sharing platform that lets developers share and find code easily. It supports multiple languages with syntax highlighting and user accounts for saving snippets. The platform helps improve collaboration and coding efficiency.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors