A full-stack social media web application built with the MERN stack (MongoDB, Express.js, React, Node.js).
- 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
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
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
- Node.js 16+
- MongoDB Atlas account
- Cloudinary account (free tier)
git clone https://github.com/Prince-1512/socialnet.git
cd socialnetcd backend
npm installCreate .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 devcd frontend
npm install
npm starthttp://localhost:3000
| 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 |
Prince Ranjan
MCA Final Year | School of Management Sciences, Varanasi
GitHub · LinkedIn