If You’re Thinking of Switching to Go for Backend… Read This First

Nitesh Singh Nitesh Singh
3 min read

🚪 My API Gateway Deserved Better Than Express

I was building backend services in Express.js—fast, flexible, and easy to spin up. But then it hit me: JavaScript isn’t type-safe. One typo, and suddenly user.name becomes undefined.name—hello, production bugs.

Sure, I tried TypeScript. It helps, but deep down, it felt like I was just patching holes in a leaky ship.

That’s when I turned to Go—a statically typed, compiled language with built-in type safety and way better performance than Node.js. But it’s no walk in the park. Go is more like a double shot of espresso—strong, fast, but not sweet. No sugar syntax, no hand-holding, and error handling that demands you own every failure.

⚙️ What I Wanted in a Backend

I’ve always wanted to use pointers in a real-world project—not just in DSA practice sessions. And I had this itch to write raw SQL, ditch the ORMs and have full control over the queries.

I didn’t want magic. I wanted visibility.

For this project, I also wanted to shift away from my usual function-based structure and try something closer to class-based development—think modularity, cleaner organization, and maybe even some inheritance and dependency injection (DI) vibes.

Go doesn’t do classes, but with structs, interfaces, and a pinch of embedding, I could still get pretty close. Once I got used to Go’s way of favoring composition over inheritance, things actually became simpler and more maintainable.

🧱 My API Gateway, My Rules

Now here’s where I may sound a bit dramatic—but hear me out.

My API Gateway is the front door to my microservices. And you don’t build your front gate out of cardboard, right? I wanted it to be fast, type-safe, and as close to the metal as I could get.

That’s why I wrote it in Go—no heavy frameworks, no bloat. I wanted to handle HTTP manually, set headers myself, manage timeouts properly, and feel every line of traffic flowing through.

The only package I brought in was chi for routing—because rolling your own router is a bit too raw, even for me. But otherwise, this was Go in its purest form: raw handlers, middleware, reverse proxy, and eventually authentication and authorization—all under one roof.

And honestly? It was fun. Like manual-transmission, stick-shift kind of fun.

💬 Final Thoughts

If you’ve been thinking about trying a new language for your backend—and your brain is wired like mine (wants control, raw SQL, pointers, class-like structure, and blazing-fast execution)—Go is absolutely worth a shot.

It’s not easy at first. But it gives you confidence that the thing you’re building? You truly understand it.

And hey—thanks for reading this far.
As a bonus, here’s one weird Go quirk I ran into:

0
Subscribe to my newsletter

Read articles from Nitesh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nitesh Singh
Nitesh Singh