Skip to content

πŸš€ A Twitter clone built with MERN Stack featuring real-time interactions, JWT auth, and Cloudinary image uploads. Includes social features like posts, follows, likes, comments, notifications and profile customization with modern Tailwind CSS UI.

License

Notifications You must be signed in to change notification settings

ammrshmbng/twitter-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐦 Twitter Clone - MERN Stack Project

License: MIT Version

Overview

A Twitter clone application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js) with modern features and real-time functionality.

Key Features

  • JWT Authentication
  • Follow/Unfollow System
  • Create & Delete Posts
  • Post Comments
  • Like Posts
  • Image Upload (Cloudinary)
  • Notifications
  • Profile Editing
  • Modern UI with Tailwind CSS
  • Data Fetching with React Query

Tech Stack

  • Frontend:

    • React.js
    • Tailwind CSS
    • DaisyUI
    • React Query
    • React Router DOM
    • React Icons
  • Backend:

    • Node.js
    • Express.js
    • MongoDB
    • JWT
    • Cloudinary
    • Bcrypt

Project Structure

twitter-clone/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ db/
β”‚   β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ routes/
β”‚   └── server.js
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   β”œβ”€β”€ index.html
β”‚   └── package.json
└── package.json

Installation & Setup

Prerequisites

  • Node.js (v14+)
  • MongoDB
  • Cloudinary Account

Environment Variables

MONGO_URI=your_mongodb_uri
PORT=5000
JWT_SECRET=your_jwt_secret
NODE_ENV=development
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

Installation Steps

  1. Clone repository
git clone https://github.com/username/twitter-clone.git
cd twitter-clone
  1. Install dependencies
npm install
cd frontend && npm install
  1. Setup environment variables
  • Create .env file in root folder
  • Fill with required variables (see example above)
  1. Run application
# Development mode
npm run dev

# Production build
npm run build
npm start

Features & Usage

1. Authentication

  • Register with email, username, and password
  • Login with username/email
  • JWT token authentication

2. Post Management

  • Create posts with text and/or images
  • Like and unlike posts
  • Comment on posts
  • Delete own posts

3. User Profile

  • Edit profile information
  • Upload profile and cover photos
  • View followers and following
  • Edit bio and links

4. Social Interaction

  • Follow/unfollow users
  • Like and follow notifications
  • Following timeline
  • Suggested users

Development

Scripts

{
  "dev": "NODE_ENV=development nodemon backend/server.js",
  "start": "NODE_ENV=production node backend/server.js",
  "build": "npm install && npm install --prefix frontend && npm run build --prefix frontend"
}

API Endpoints

  • POST /api/auth/signup - Register user
  • POST /api/auth/login - Login user
  • GET /api/posts - Get timeline posts
  • POST /api/posts - Create new post
  • PUT /api/users/profile - Update profile

Contributing

  1. Fork repository
  2. Create new branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Create Pull Request

Debug & Troubleshooting

  • Ensure MongoDB is running
  • Check environment variables
  • View console logs for errors
  • Validate request body

License

This project is licensed under the MIT License - see LICENSE file for details.

Acknowledgments

  • Tailwind CSS for styling
  • DaisyUI for UI components
  • Cloudinary for image hosting
  • MongoDB Atlas for database hosting

Contact & Support

  • Create issues for bug reports
  • Pull requests for contributions
  • Email for further inquiries

About

πŸš€ A Twitter clone built with MERN Stack featuring real-time interactions, JWT auth, and Cloudinary image uploads. Includes social features like posts, follows, likes, comments, notifications and profile customization with modern Tailwind CSS UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published