Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda

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. 🚀


Tech Stack

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
  • bcryptjs for password hashing
  • CORS, dotenv
  • Seed script powered by @faker-js/faker

Features

Auth & Account

  • Register with username + email + password
  • Login via email or username + password
  • JWT-based sessions; /auth/me for current user
  • Local storage persistence and auto-injected Authorization header via Axios interceptor 🔐
  • Update profile bio (PUT /users/profile)

Social Graph

  • 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)

Posts

  • 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

Search & Navigation

  • 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

Scripts

Client

  • npm run dev – start Vite dev server
  • npm run build – production build
  • npm run preview – preview built app

Server

  • npm run dev – start API with nodemon
  • npm 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)

Running Locally

  1. In server/: create .env (see above), then:

    npm install
    npm run seed
    npm run dev
  2. In client/: create .env (see above), then:

    npm install
    npm run dev
  3. Open the client URL (Vite will print it) and log in or register.


Notes & Decisions

  • 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

About

A simplified X/Twitter clone (to practice MERN stack)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages