Twitter clone web application built using Next.js, Tailwind CSS, Prisma, and MongoDB. This clone allows users to post tweets, follow other users, like tweets, and perform various other Twitter-like functionalities.
https://github.com/ayusshrathore/twitter-clone/assets/61450246/a5a1e045-bcc9-4d6e-b33a-1611ddf7667c
To run the Twitter clone locally, you need to have the following installed on your machine:
Clone the repository:
git clone https://github.com/ayusshrathore/twitter-clone.git
cd twitter-clone
Install the dependencies:
npm install
Configure the environment variables:
Create a new file named `.env in the root directory and add the following variables:
DATABASE_URL="mongodb://localhost:27017/twitter-clone" # Replace with your MongoDB connection URL
NEXTAUTH_JWT_SECRET="your-jwt-secret" # Replace with your own JWT secret key
NEXTAUTH_SECRET="your-nextauth-secret" # Replace with your own NextAuth secret key
Start the development server:
npm run dev
The application will be accessible at http://localhost:3000
.
To deploy the Twitter clone application, you can follow the deployment instructions specific to each technology used:
Ensure to set the appropriate environment variables for the deployed environment.
The file structure of the Twitter clone application is as follows:
├── pages/
│ ├── _app.tsx
│ ├── index.tsx
│ ├── notifications.tsx
│ └── api/
│ ├── auth/
│ │ ├── [...nextauth].ts
│ ├── posts/
│ │ ├── index.ts
│ │ ├── [postId].ts
│ ├── users/
│ │ ├── index.ts
│ │ ├── [userId].ts
│ ├── notifications/
│ │ ├── [userId].ts
│ ├── comments.ts
│ ├── current.ts
│ ├── edit.ts
│ ├── follow.ts
│ ├── like.ts
│ ├── register.ts
│ ├── posts/
│ │ ├── [postId].tsx
│ ├── users/
│ │ ├── [userId].tsx
├── components/
│ ├── layout/
│ │ ├── FollowBar.tsx
│ │ ├── Sidebar.tsx
│ │ ├── SidebarItem.tsx
│ │ ├── SidebarLogo.tsx
│ │ ├── SidebarTweetButton.tsx
│ ├── modals/
│ │ ├── EditModal.tsx
│ │ ├── LoginModal.tsx
│ │ ├── Modal.tsx
│ │ ├── RegisterModal.tsx
│ ├── posts/
│ │ ├── CommentFeed.tsx
│ │ ├── CommentItem.tsx
│ │ ├── PostFeed.tsx
│ │ ├── PostItem.tsx
│ ├── users/
│ │ ├── UserBio.tsx
│ │ ├── UserHero.tsx
│ ├── Avatar.tsx
│ ├── Button.tsx
│ ├── Form.tsx
│ ├── Header.tsx
│ ├── ImageUpload.tsx
│ ├── Input.tsx
│ ├── Layout.tsx
│ ├── NotificationsFeed.tsx
│ └── ...
├── libs/
│ ├── prismadb.ts
│ ├── fetcher.ts
│ ├── serverAuth.ts
│ └── ...
├── hooks/
│ ├── useCurrentUser.ts
│ ├── useEditModal.ts
│ ├── useFollow.ts
│ ├── useLike.ts
│ ├── useLoginModal.ts
│ ├── useNotifications.ts
│ ├── usePost.ts
│ ├── usePosts.ts
│ ├── useRegisterModal.ts
│ ├── useUser.ts
│ ├── useUsers.ts
├── styles/
│ ├── globals.css
├── prisma/
│ ├── schema.prisma
├── public/
│ ├── images/
├── package.json
Contributions to the Twitter clone project are welcome! If you find any issues or want to contribute enhancements, feel free to open an issue or submit a pull request. Please follow the standard GitHub workflow when contributing.
When submitting a pull request, ensure to include a clear description of the changes and any necessary steps to test the changes.
This Twitter clone project is licensed under the MIT License.
This project was inspired by the functionality and design of the Twitter platform.
For any questions or inquiries, please contact [email protected].
Happy tweeting!