DEV Community

Cover image for NodeJS or GoLang for backend API
Raymond Ottun
Raymond Ottun

Posted on

NodeJS or GoLang for backend API

When starting a new project as a polygot developer, why would you choose NodeJS over Golang or vice-versa for your backend/API dev? I have been struggling with this question for a while now especially when the difference is speed is much of a concern when choosing a language.

Top comments (3)

Collapse
 
deepu105 profile image
Deepu K Sasidharan

I would say it really depends on your usecase. There will be compromise on both sides. If your usecase demands a fast app with small footprint with no runtime, like if you wanna run it on a bare minimum server, then Go would be ideal. But compromise being verbose code and probably having to write a lot of code your self. On the other hand NodeJS IMO would be faster to build as you will find most of the stuff you need as libs and code will be less verbose but won't be as fast as Go and will have slightly bigger footprint with need to install NodeJS runtime. Other than that both language can get the job done so really choose based on need

Collapse
 
sqlrob profile image
Robert Myers

Your language isn't chosen in a vacuum.

Which is going to be easier to hire for? If this is a personal project, moot point.

What's the target audience for the source code? If it's you, have fun, pick what you like better. If it's company, and most of the rest of the code is in one language, match that language.

What do intend to use as infrastructure for the backend? Deepu mentioned "installing node", but if you're using serverless architecture or using PaaS, there's no node to install on those, it's part and parcel of the service. If you're rolling your own container, then it might make a difference.

The speed of the language is almost moot. Network and database interactions are probably going to swamp any language differences. Of course, YMMV, it depends on what you're doing. Ease of debugging and speed of writing would be more of a concern to me at the beginning of the project.

Me personally? I'd go with Node. I don't know Go, and that would add to the development time.

Collapse
 
huiren profile image
Tony

Node JS with typescript which have more support in terms of packages.