Skip to content

Latest commit

Β 

History

History
102 lines (79 loc) Β· 3.13 KB

File metadata and controls

102 lines (79 loc) Β· 3.13 KB

FullStack Twitter Clone

A full-stack Twitter clone built with the MERN stack (MongoDB, Express.js, React, Node.js) that replicates core Twitter functionality including user authentication, posting, following, and notifications.

Table of Contents

Features

  • User authentication (signup, login, logout)
  • Create, read, update, and delete posts
  • Like and comment on posts
  • Follow/unfollow users
  • Real-time notifications
  • User profiles with profile picture and bio editing
  • Responsive design for all device sizes

Technologies Used

Backend

  • Node.js - JavaScript runtime environment
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling tool
  • JWT - JSON Web Tokens for authentication
  • Bcrypt - Password hashing
  • Cloudinary - Image hosting service
  • Cookie-parser - Parsing cookie header

Frontend

  • React - JavaScript library for building user interfaces
  • React Router - Declarative routing for React
  • Tailwind CSS - Utility-first CSS framework
  • DaisyUI - Tailwind CSS component library
  • TanStack Query - Server state management
  • React Icons - Popular icons as React components
  • Vite - Frontend build tool

Project Structure

.
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ controllers/     # Request handlers
β”‚   β”œβ”€β”€ db/             # Database connection
β”‚   β”œβ”€β”€ middleware/     # Custom middleware
β”‚   β”œβ”€β”€ models/         # Mongoose models
β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   └── server.js       # Entry point
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/ # React components
β”‚   β”‚   β”œβ”€β”€ hooks/      # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ pages/      # Page components
β”‚   β”‚   β”œβ”€β”€ utils/      # Utility functions
β”‚   β”‚   β”œβ”€β”€ App.jsx     # Main App component
β”‚   β”‚   └── main.jsx    # Entry point
β”‚   └── vite.config.js  # Vite configuration

API Endpoints

Authentication

  • POST /api/auth/signup - Register a new user
  • POST /api/auth/login - Login user
  • POST /api/auth/logout - Logout user
  • GET /api/auth/me - Get authenticated user

Users

  • GET /api/users/profile/:username - Get user profile
  • PUT /api/users/follow/:id - Follow/unfollow user
  • PUT /api/users/update - Update user profile
  • GET /api/users/suggested - Get suggested users

Posts

  • POST /api/posts/create - Create a new post
  • GET /api/posts/all - Get all posts
  • GET /api/posts/liked/:id - Get posts liked by user
  • GET /api/posts/following - Get posts from followed users
  • GET /api/posts/user/:username - Get user's posts
  • DELETE /api/posts/:id - Delete a post
  • PUT /api/posts/like/:id - Like/unlike a post

Notifications

  • GET /api/notifications - Get user notifications
  • DELETE /api/notifications - Delete all notifications

Screenshots

alt text alt text