
I rewrote my Node.js API in Go (mostly stdlib). My Docker image went from 200MB to 10MB. Would love some feedback!
Hey everyone, I recently migrated my personal REST API backend from Node.js (TypeScript/Express) to Go, sticking almost entirely to the standard library (net/http, slog, testing).
I started learning Go late december last year, took a short break for work, and recently pushed through to finish this rewrite. I'm trying to keep the codebase lean, so I've stuck almost entirely to the standard library.
Here's the GitHub Repo: https://github.com/ccrsxx/api
The API handles Spotify and Jellyfin integrations (with real-time SSE updates), managing guestbook, implementing Auth with GitHub Oauth, and tracking views and likes for my blog contents. For the database layer, I fully migrated to PostgreSQL using sqlc for queries and goose for migrations.
There is one exception to the rewrite: I still run a tiny Express service specifically for generating Open Graph images. I rely satori library to generate it with HTML and Tailwind CSS. I couldn't find a Go library that handles this, and I don't want to write it from scatch lol.
The resource improvements is the most interesting part of this migration IMO. My Docker image decreased from 205MB (Node.js) to just 10.1MB (Go), and average RAM usage dropped from ~100MB down to just 10MB. Running this on my server feels so lightweight now. Screenshot: https://i.ibb.co.com/xKvQJRqN/image.png
Coming from JavaScript world, I honestly disliked Go's error handling at first, it just felt way too verbose. But now I actually love it. Treating errors as real values instead of just throwing exceptions and let it bubble, it makes the code so much more predictable, and it really forces you to think about every possible unhappy path.
(AI disclosure: I used AI for boilerplate like converting massive TS interfaces into Go structs, grasping DI patterns to learn, and writing some of the tests. However, the core logic, wiring, and actual implementation were written by hand.)
Feedback is highly welcomed! If there are more idiomatic "Go ways" to handle my logic, please let me know.