It doesn’t matter if you’ve ever worked on the little “friends and family” project which turned out to be way more popular than expected or you start planning to make your dream startup idea to come true.

There’s no place for the compromise, and in this article, I’ll show you why it’s an excellent idea to plan for the global expansion from the first line of code using one of my hobby projects which popularity unexpectedly skyrocketed within few months and what I’ve done to keep up with demand as scaling up infrastructure horizontally was not an option.

I’ve spent some time travelling around the world which gave me a fantastic opportunity to discover new cultures, learn more about the meaning of life and of course — meet new people and gathered a lot of contacts. To keep up with everyone and not allow the disrespect by reading and not responding to the messages, I used the power of Telegram Messenger groups to gather everyone in one place and let the discussions to flow and friendships to flourish. Shortly after my friends started adding their friends, who considered our group kind enough to invite theirs which quickly left us with over 2000 people discussing everything from their daily lives and university struggles to global economics and politics. As usual in those cases, some rogue elements started to appear, trying to disrupt the peaceful and friendly nature of the group. It was time to act.

Image for post

Meet LittleGuardian, the bot.

It was mostly PoC, simple bot to guard one of my groups from annoying spammers. Nothing special from the beginning as it started from 30 lines of logic and after few months developed into few hundreds of non-optimised Ruby code. Everything was kept in the memory, so with every restart bot suffered from amnesia and the fun with spam detection started all over again. It was “designed” to work only on my group and listen to hardcoded admins. That caused some issues when people wanted to use it in their groups. Because even the PoC was quite efficient — it started spreading across the Telegram platform, being used by administrators of groups to maintain control over the content.

Lesson 1: Never, ever hardcode anything.

It doesn’t matter if your project is used only by you or close friends or you don’t want to make it public, ever. Always assume that things will change randomly, and the fantastic solution you have implemented will not cover all the use cases and possibilities.

Questions I should’ve asked myself back then.

  • What if I’d add new admin?
  • Adding new admin required me to restart the bot process. It was far from efficient and impossible when I was on the move.
  • What if someone won’t be trustworthy and I’ll remove them?
  • Same as above with a higher level of urgency, assuming that in “bot’s brain” admins are always on clear to do whatever they want to.
  • What if someone adds the bot to the new group with a completely different set of admins?
  • At that stage, admins were hardcoded, and I’ve had no knowledge of any other groups bot was on ( except their IDs ). I couldn’t manage it in any way.

#vuejs #cloud #programming

Managing Private Projects at Scale
1.10 GEEK