An advanced, full-stack social media application built with React Native (Expo), Node.js, Express, and MongoDB. Designed to replicate the core experience of X (formerly Twitter), featuring real-time updates, secure authentication, media sharing, and a responsive mobile interface.
- 🔐 Robust Authentication: Secure sign-up and login powered by Clerk, ensuring safe user access and session management.
- 📱 Native Mobile Experience: Built with React Native and Expo for a smooth, high-performance mobile experience on Android and iOS.
- 📝 Create & Share: Users can create dynamic posts with text and images, uploaded securely via Cloudinary.
- 👥 Social Interactions: Full social suite including Likes, Comments, and User Profiles.
- 🔔 Notifications System: Stay updated with a dedicated notifications tab for interactions and activity.
- 💬 Direct Messaging: Integrated private messaging system for user-to-user communication.
- 🔍 Smart Search: Discover users and content through an efficient search interface.
- 🛡️ Advanced Security: Protected by Arcjet for bot detection, rate limiting, and attack prevention.
- 🎨 Modern UI/UX: Beautifully styled with NativeWind (Tailwind CSS) for a clean, consistent, and dark-mode friendly design.
- Framework: React Native (via Expo)
- Routing: Expo Router
- Styling: NativeWind (Tailwind CSS)
- State Management: TanStack React Query
- Auth: Clerk (Clerk Expo)
- HTTP Client: Axios
- Icons: Expo Vector Icons
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Mongoose ODM)
- Auth: Clerk (Express SDK)
- Security: Arcjet (Bot protection & Rate limiting)
- Storage: Cloudinary (Image uploads)
- Utilities: Multer (File handling), CORS, Dotenv
Follow these steps to set up the project locally.
- Node.js (v18+ recommended)
- npm or yarn
- MongoDB Database URL
- Accounts for Clerk, Cloudinary, and Arcjet
-
Clone the repository:
git clone https://github.com/your-username/x-clone.git cd x-clone -
Setup Backend:
cd backend npm install -
Configure Backend Environment: Create a
.envfile in thebackenddirectory and add the following:PORT=3000 NODE_ENV=development # Database MONGODB_URI="mongodb+srv://..." # Authentication (Clerk) CLERK_PUBLISHABLE_KEY="pk_test_..." CLERK_SECRET_KEY="sk_test_..." # Security (Arcjet) ARCJET_ENV="development" ARCJET_KEY="aj_..." # Storage (Cloudinary) CLOUDINARY_CLOUD_NAME="your_cloud_name" CLOUDINARY_API_KEY="your_api_key" CLOUDINARY_API_SECRET="your_api_secret"
-
Start Backend Server:
npm run dev # Server will run on http://localhost:3000 and expose your network IP -
Setup Mobile App: Open a new terminal:
cd mobile npm install -
Configure Mobile API: Ensure
utils/api.tspoints to your backend's network IP if running on a real device. -
Run Mobile App:
npx expo start
- Press
afor Android Emulator - Press
ifor iOS Simulator - Scan the QR code with Expo Go on your phone
- Press
x-clone/
├── backend/ # Express.js API Server
│ ├── src/
│ │ ├── config/ # DB & Env Config
│ │ ├── controllers/ # Route Logic
│ │ ├── middlewares/ # Arcjet & Auth Middleware
│ │ ├── models/ # Mongoose Schemas
│ │ ├── routes/ # API Routes (User, Post, Comment)
│ │ └── server.js # Entry Point
│ └── package.json
│
└── mobile/ # React Native Expo App
├── app/ # Expo Router Pages
│ ├── (auth)/ # Login/Signup/Welcome
│ ├── (tabs)/ # Main App Tabs (Home, Search, Profile)
│ └── _layout.tsx # Root Layout
├── assets/ # Images & Fonts
├── components/ # Reusable UI Components
├── utils/ # API Client & Helpers
└── package.json
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is proprietary and confidential.
Made with ❤️ by Sakila Lakmal