A Twitter clone application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js) with modern features and real-time functionality.
- 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
-
Frontend:
- React.js
- Tailwind CSS
- DaisyUI
- React Query
- React Router DOM
- React Icons
-
Backend:
- Node.js
- Express.js
- MongoDB
- JWT
- Cloudinary
- Bcrypt
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
- Node.js (v14+)
- MongoDB
- Cloudinary Account
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- Clone repository
git clone https://github.com/username/twitter-clone.git
cd twitter-clone- Install dependencies
npm install
cd frontend && npm install- Setup environment variables
- Create
.envfile in root folder - Fill with required variables (see example above)
- Run application
# Development mode
npm run dev
# Production build
npm run build
npm start- Register with email, username, and password
- Login with username/email
- JWT token authentication
- Create posts with text and/or images
- Like and unlike posts
- Comment on posts
- Delete own posts
- Edit profile information
- Upload profile and cover photos
- View followers and following
- Edit bio and links
- Follow/unfollow users
- Like and follow notifications
- Following timeline
- Suggested users
{
"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"
}POST /api/auth/signup- Register userPOST /api/auth/login- Login userGET /api/posts- Get timeline postsPOST /api/posts- Create new postPUT /api/users/profile- Update profile
- Fork repository
- Create new branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Create Pull Request
- Ensure MongoDB is running
- Check environment variables
- View console logs for errors
- Validate request body
This project is licensed under the MIT License - see LICENSE file for details.
- Tailwind CSS for styling
- DaisyUI for UI components
- Cloudinary for image hosting
- MongoDB Atlas for database hosting
- Create issues for bug reports
- Pull requests for contributions
- Email for further inquiries