This is a full-featured Twitter clone app built with modern web development tools and technologies. It mimics the core features of Twitter, including user authentication, posting tweets, notifications, profiles, and more.
- User authentication with Next-Auth
- API calls and data fetching with SWR and Axios
- State management with Zustand
- Responsive design using Tailwind CSS
- Database management with MongoDB and Prisma
- Security with Bcrypt for password hashing
- Framework: Next.js
- Frontend: React, Tailwind CSS
- Backend: Next.js API routes
- Database: MongoDB (with Prisma ORM)
- Authentication: Next-Auth
- State Management: Zustand
- Other Libraries: SWR, Axios, TypeScript, Bcrypt, React Icons
To get a local copy of the project up and running, follow the steps below:
Ensure you have the following installed:
- Node.js: Download from here
- MongoDB: Set up your MongoDB database, either locally or using MongoDB Atlas
-
Clone the repository:
git clone https://github.com/ahmedalsanadi/twitter-app.git cd twitter-app
-
Install dependencies:
npm install
-
Set up the environment variables: Create a
.env
file in the root directory and add the following:DATABASE_URL="YOUR_MONGODB_URL" NEXTAUTH_JWT_SECRET="YOUR_NEXT_AUTH_JWT_SECRET" NEXTAUTH_SECRET="YOUR_NEXT_AUTH_SECRET"
Note: If you're forking this repository, you should create your own MongoDB database on MongoDB Atlas and replace the
DATABASE_URL
with your own. Then, you can push the Prisma schema to your database. -
Push the Prisma schema to the database: After setting up the environment variables, you can push the Prisma schema to your MongoDB database with the following command:
npx prisma db push
-
Run the development server:
npm run dev
The app will be available at http://localhost:3000.
The following environment variables need to be set for the application to run properly:
DATABASE_URL="your-mongodb-database-url"
NEXTAUTH_JWT_SECRET="your-next-auth-jwt-secret"
NEXTAUTH_SECRET="your-next-auth-secret"
After successfully setting up the project and running it locally, you can:
- Register as a user.
- Post tweets.
- Post Comments
- Likes A tweets
- Follow other users.
- View notifications.
- Edit your profile ( Profile Image , Cover Image , Name , Username and password)
To deploy this application on a platform like Vercel, follow these steps:
-
Push your repository to GitHub.
-
Go to Vercel, and sign in with your GitHub account.
-
Import the project from GitHub into Vercel.
-
Set up the environment variables in Vercel, just as you did in your
.env
file:DATABASE_URL
NEXTAUTH_JWT_SECRET
NEXTAUTH_SECRET
-
Deploy the app.
- React: For building the UI.
- Next.js: For server-side rendering and routing.
- Tailwind CSS: For styling.
- MongoDB: As the database to store users, posts, and other app data.
- Prisma: As the ORM for database management.
- Next-Auth: For handling authentication.
- SWR: For efficient data fetching.
- Zustand: For state management.
- Fork the repository.
- Create your own MongoDB database.
- Update the
.env
file with your own environment variables. - Push the Prisma schema to your database:
npx prisma db push
- Make your changes.
- Submit a pull request.
Contributions are welcome! If you'd like to add new features or improve the code, feel free to open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries or feedback, feel free to contact me at:
- Email: [email protected]
- GitHub: Ahmed Al-sanadi