This project is a clone of the X (formerly Twitter) web application. It includes user authentication, posting, and follows functionality, as well as a feed where users can view and interact with posts.
- Authentication: Users can sign up, log in, and manage sessions.
- Posts: Users can create, like, and view posts.
- Follow System: Users can follow/unfollow other users.
- Responsive Design: The application is optimized for desktop and mobile devices.
- Real-time Updates: Posts and interactions are displayed dynamically.
-
Signin/Login Page
- This is the Signin/login interface where users can enter their credentials to sign in or navigate to the sign-up page if they don’t have an account.
- This is the Signin/login interface where users can enter their credentials to sign in or navigate to the sign-up page if they don’t have an account.
-
Home Feed
- React: For building the frontend of the application.
- react-router-dom: For navigation between different pages and routes.
- Tailwind CSS: For styling and creating a responsive layout.
- React Query: For data fetching and state management of authentication and posts.
- MongoDB: As the database for storing user data and posts.
- Express.js: Backend framework for handling requests and user authentication.
- JWT (JSON Web Tokens): For managing sessions and securing routes.
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd twitter-clone
-
Install dependencies:
npm install
-
Set up your environment variables. Create a
.env
file in the root directory with the following information:MONGO_URI=<your-mongodb-uri> JWT_SECRET=<your-jwt-secret>
-
Start the development server:
npm start
-
Open your browser and navigate to:
http://localhost:3000
├── src
│ ├── components
│ │ ├── common
│ │ │ ├── Sidebar.js
│ │ │ ├── RightPanel.js
│ │ │ ├── Downbar.js
│ │ ├── pages
│ │ │ ├── auth
│ │ │ │ ├── LoginPage.js
│ │ │ │ ├── SignUpPage.js
│ │ │ ├── home
│ │ │ │ └── HomePage.js
│ │ │ ├── notification
│ │ │ │ └── NotificationPage.js
│ │ │ ├── profile
│ │ │ │ └── ProfilePage.js
│ ├── App.js
│ ├── index.js
- Login Page: Allows users to sign in or navigate to the sign-up page.
- Home Page: Displays the feed where users can view and interact with posts.
- Sidebar: Displays the navigation links such as Home, Notifications, and Profile.
- Right Panel: Suggests users to follow and displays relevant user profiles.
- Downbar: The footer that includes quick links for the user.
-
Authentication
POST /api/auth/login
: Logs in a user.POST /api/auth/signup
: Registers a new user.
-
Posts
GET /api/posts
: Fetches posts from the database.POST /api/posts
: Allows an authenticated user to create a new post.
-
User
GET /api/user/:username
: Fetches user data for a specific profile.POST /api/user/follow
: Allows an authenticated user to follow another user.
This project is licensed under the MIT License.
Feel free to contribute to the project by submitting issues, feature requests, or pull requests.