A lightweight, X/Twitter-style clone app built with the MERN stack. Create posts, follow people, like content, and browse a personalized feed — all with JWT auth and a responsive, Tailwind-powered UI. 🚀
Frontend
- React 19 + Vite 7
- React Router
- Tailwind CSS (v4 integration via
@tailwindcss/vite) + DaisyUI utility classes - Axios (with auth interceptor & baseURL from
VITE_API_URL) - ErrorBoundary + protected route guards
Backend
- Node.js + Express 5
- MongoDB + Mongoose 8
- JWT (
jsonwebtoken) for auth bcryptjsfor password hashing- CORS, dotenv
- Seed script powered by
@faker-js/faker
- Register with username + email + password
- Login via email or username + password
- JWT-based sessions;
/auth/mefor current user - Local storage persistence and auto-injected
Authorizationheader via Axios interceptor 🔐 - Update profile bio (
PUT /users/profile)
- Follow / Unfollow users (
PUT /users/:id/follow) - Followers / following counts and modals (
/users/:id/followers,/users/:id/following) - Popular Users sidebar — ranked by
postCount + totalLikes(aggregation pipeline)
- Create & delete your own posts
- Like / Unlike posts (
PUT /posts/:id/like) with live counts - Personalized feed (
GET /posts/feed) for you + people you follow (fallback to all posts if needed) - View user’s posts and liked posts
- @mentions in post text are clickable and route to
/user/:username
- Debounced user search (
/users/search/:query) - Clean, responsive layout with a mobile bottom nav
- Safe UX: Loading states, toasts/messages, and an Error Boundary for runtime errors
Client
npm run dev– start Vite dev servernpm run build– production buildnpm run preview– preview built app
Server
npm run dev– start API with nodemonnpm run seed– seed DB (users, follows, posts, likes)npm run seed:purge– purge & reseed
Seeding Notes
- All seeded users share the password:
password123 - Counts and probabilities are configurable via
SEED_*envs - After seeding, you can log in with any generated username/email (check DB or Popular Users list for names)
-
In server/: create
.env(see above), then:npm install npm run seed npm run dev
-
In client/: create
.env(see above), then:npm install npm run dev
-
Open the client URL (Vite will print it) and log in or register.
- Likes are tracked both as an array (
likes) and a denormalized count (likeCount) for efficiency. - The feed endpoint returns posts from you + following, newest first, capped to 20 (client gracefully falls back to
/posts). - Popular users are computed via aggregation:
score = postCount + totalLikes. - UI uses Tailwind utility classes (with DaisyUI classnames like
btn) for fast iteration. 🎯
This repo was built as a learning/practice project