Building a scalable social media clone requires a solid foundation. I opted for a decoupled architecture using Node.js and Express for the backend, serving RESTful APIs to the React frontend.
This separation of concerns ensures that the client remains lightweight while the server handles the heavy lifting of authentication (JWT) and data processing.
Designing the NoSQL schema was tricky due to the highly relational nature of a social network (Users following Users, Posts belonging to Users, Comments belonging to Posts).
I utilized Mongoose references to link collections, allowing for efficient .populate() queries when fetching complex feed data without duplicating records.
A modern social app needs instant feedback to feel alive. Instead of relying on constant HTTP polling, I implemented Socket.io.
This creates a persistent, two-way connection between the browser and the server, enabling instant notifications, direct messaging, and real-time "like" updates across all connected clients.
With deeply nested components like feed posts, comment sections, and user profiles, "prop drilling" quickly became an anti-pattern.
I integrated Redux Toolkit for global state management. This allowed the app to smoothly share the user's authentication state, cached feed data, and active socket connection globally.