Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

SocialNet - Full Stack Social Media Application

A full-stack social media web application built with the MERN stack (MongoDB, Express.js, React, Node.js).


Features

  • User registration and login with JWT authentication
  • Create, view, and delete posts with image upload
  • Like and comment on posts
  • Follow / unfollow users
  • User profiles with followers and following count
  • Explore page to discover all posts
  • Suggested users panel
  • Responsive design

Tech Stack

Frontend: React, React Router, Axios, React Icons, React Hot Toast
Backend: Node.js, Express.js, MongoDB, Mongoose, JWT, Bcrypt
Storage: Cloudinary (image uploads)
Database: MongoDB Atlas


Project Structure

socialnet/
├── backend/
│   ├── config/         # Cloudinary config
│   ├── controllers/    # Auth, Post, User logic
│   ├── middleware/     # JWT auth middleware
│   ├── models/         # User, Post schemas
│   ├── routes/         # API routes
│   └── server.js       # Entry point
├── frontend/
│   ├── public/
│   └── src/
│       ├── components/ # PostCard, CreatePost, Layout, SuggestedUsers
│       ├── context/    # AuthContext
│       ├── pages/      # Home, Explore, Profile, Login, Register
│       └── App.js

Setup & Installation

Prerequisites

  • Node.js 16+
  • MongoDB Atlas account
  • Cloudinary account (free tier)

1. Clone the repository

git clone https://github.com/Prince-1512/socialnet.git
cd socialnet

2. Backend Setup

cd backend
npm install

Create .env file (copy from .env.example):

PORT=5000
MONGO_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_secret_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

Start backend:

npm run dev

3. Frontend Setup

cd frontend
npm install
npm start

4. Open in browser

http://localhost:3000

API Endpoints

Method Endpoint Description
POST /api/auth/register Register user
POST /api/auth/login Login user
GET /api/auth/me Get current user
GET /api/posts/feed Get feed posts
GET /api/posts/explore Get all posts
POST /api/posts Create post
PUT /api/posts/:id/like Like/unlike post
POST /api/posts/:id/comment Add comment
DELETE /api/posts/:id Delete post
GET /api/users/:username Get user profile
PUT /api/users/:id/follow Follow/unfollow
GET /api/users/search?q= Search users
GET /api/users/suggested Suggested users

Author

Prince Ranjan
MCA Final Year | School of Management Sciences, Varanasi
GitHub · LinkedIn

About

Full Stack Social Media Web Application built with MERN Stack (MongoDB, Express, React, Node.js)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages