X-Clone is a modern web application that mimics the core functionalities of X (formerly Twitter), providing a platform for users to share short posts, interact with content, and follow other users. Built with Next.js, it leverages server-side rendering and client-side interactivity for a seamless user experience.
This project was developed as a learning exercise and a demonstration of building a full-stack application using contemporary web technologies. The primary goals were to:
- Gain hands-on experience with Next.js for building performant React applications.
- Implement robust user authentication and data management using Supabase.
- Practice building a responsive and intuitive user interface.
- Understand the architecture of a social media-like platform.
- User Authentication: Secure sign-up, sign-in, and sign-out functionalities powered by Supabase Auth.
- Post Creation: Users can create and publish short text-based posts.
- Real-time Updates: (Assuming, based on Supabase) Potentially real-time display of new posts.
- User Profiles: (Implied by user_id in posts) Basic user profile management.
- Responsive Design: Adapts to various screen sizes for a consistent experience on desktop and mobile.
- Next.js: React framework for building server-rendered and statically generated web applications.
- React: JavaScript library for building user interfaces.
- Supabase: Open-source Firebase alternative providing a PostgreSQL database, authentication, and real-time subscriptions.
- Tailwind CSS: A utility-first CSS framework for rapidly building custom designs.
- JavaScript (ES6+): The primary programming language.
Follow these steps to set up and run the project locally.
- Node.js (v18 or higher recommended)
- npm or Yarn
- A Supabase project
-
Clone the repository:
git clone https://github.com/ShahriarX2/X-Clone.git cd X-Clone -
Install dependencies:
npm install # or yarn install -
Set up Supabase Environment Variables: Create a
.env.localfile in the root of your project and add your Supabase project credentials:NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEYYou can find these keys in your Supabase project settings under "API".
-
Run Supabase SQL Policies: Execute the SQL commands from
supabase_policies.sqlin your Supabase SQL Editor to set up necessary database policies for authentication and data access.
To start the development server:
npm run dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
.
├── app/ # Next.js app directory (pages, layouts, API routes, context)
│ ├── api/ # API routes (e.g., authentication)
│ ├── context/ # React Contexts (e.g., AuthContext)
│ ├── ... # Other pages and layouts
├── components/ # Reusable React components
├── public/ # Static assets
├── utils/supabase/ # Supabase client and server utilities
├── .env.local # Environment variables (local)
├── next.config.mjs # Next.js configuration
├── package.json # Project dependencies and scripts
├── postcss.config.mjs # PostCSS configuration (for Tailwind CSS)
├── README.md # Project README
└── supabase_policies.sql # SQL for Supabase database policies
Contributions are welcome! Please feel free to open an issue or submit a pull request.
MIT License (Assuming MIT, or specify if different)