My Wonky Idea for a Uni Social Media

I’m terrible at being social online. Absolutely terrible. Maybe it’s screen fatigue from spending all day on my computer between classes, programming and Youtube, but I don’t bother much with interacting with social networking apps. And being fed up with this was why I set out to create my own social network that would be a better solution than everything else right now.

I’m pretty much halfway through uni and there is absolutely zero social networks I wanna be active on. Instagram is just photos galore, Linkedin is professional Quora at this point and there’s simply nothing for me to find out people from my university and interact with them. Sure, there’s Whatsapp, but it’s limited to groups, and it’s such a major hassle keeping track of messages and finding people to connect with on similar interests. Discord is great, but what I had in mind was pretty much a weird fusion of Facebook and Reddit, harnessing the strengths of both.

As you can tell, design is not something I pride myself upon.

I built a decent foundation for it, added topics where users could post, comment, upvote/downvote. You could add friends, edit your profile, view other profile pages, which about covered everything I would have wanted to develop in the first phase. And then there was messaging.

The messaging dilemma was my second major problem to solve in my development journey, after understanding authorization inside out for my first project, JEEBuddy. Quick tip, if you’re thinking about manually encrypting and tracking keys and tokens in an SQL database using a PHP file, RUN AWAY AS FAST AS YOU CAN.

I had come across the idea of sockets before, so I knew I had to look into that. For context, sockets are used to communicate in real time between a server/database to a user client. And this is important because my website only refreshed on page reloads. So I hacked up a nice little socket interaction, and before you know it, users can now friend and message each other on my platform!

Messaging is such a fun system design problem to tackle.

That’s not where it ends though. Obviously, this was enough for me to call it a day but it’s not a scalable solution. If users were going to text, there would be a point where the amount of messages between them would cost too much to transport back and forth, and there’s next to zero chance that messages older than a few days are revisited at all. Aha, batch loading here we go!

If you were to naively implement pagination, it would solve your problem but going back to old messages would be tedious, since to fetch the messages between x and x+y (x being the index of the message you want to fetch and y being the number of messages), you’d have to parse through the first x-1 messages anyway.

I’ve worked with GraphQL for another project and that’s where they introduced this simple but elegant way of pagination. Instead of fetching between two indices, using the last document fetched as a ‘key’ would greatly improve the experience, since the O(n) search is now turned into O(log n) (And the base for the log is 8192, meaning there’s practically no possibility for this search to take over a second.

so elegant

And with that, I wrapped up the messaging module and ticked it off my checklist.

That was about where I abandoned the project. I did a little research and the purpose didn’t feel as important to me anymore. Whatsapp worked perfectly fine for most of my peers, and I realized I was once again trying to solve a problem that may not be as prominent as I accounted it to be. I won’t deny it, there is a gap in the market for a new age social network. Reddit’s ideology of subreddits and posts is fabulous and I would love to see more platforms adopt a similar methodology. But, that’s not for this project or me to solve (right now at least).

But hey, atleast it works.

I still hold the codebase dear to my heart though because it’s such a beautiful skeleton to build other applications off of, and I do have an idea for another product brewing up in my head. Hopefully in due time I’m able to describe my experience with the new idea I’m working on.

Leave a Reply

Your email address will not be published. Required fields are marked *