DEV Community

Muneeb Hussain
Muneeb Hussain

Posted on

I have built an API using TypeScript, Python, and Go, so you don't have to.

I have built an API using TypeScript, Python, and Go to test them and make it easier for you and me to decide which to use.

I'm going to provide my analysis based on developer experience, productivity, performance, deployment, and ecosystem.

I have built APIs using the most commonly used approaches (in all three), so the analysis will be more helpful and applicable to real projects.

- TypeScript (Nest.js)

Developer Experience: Overall, it's good, but sometimes it feels lengthy, and debugging framework-specific errors is hard.
Productivity: The speed of development is decent; it may vary, but for me, it's justifiable and good enough.
Performance: Decent.
Deployment: It might take longer to build, and for proper deployment, you need a good pipeline.
Ecosystem: You will find almost everything you need, but it's on you to connect everything together, as dependency version mismatch is a common issue in the Node.js world.

The Good: Enterprise-level structure and highly opinionated, so you don't mess up the code (although you still can).
The Bad: Doesn't support ESM. You'll have a hard time integrating some third-party modules.

My Opinion: Although it's a good option and easy to start with, it will take time to understand everything and build scalable backends. It's also a great option for microservices.

- Python (FastAPI)

Developer Experience: Great. No BS. Just build it and ship it.
Productivity: It makes life really easy as a backend engineer. You just have to write your business logic, and FastAPI will handle the rest for you.
Performance: Decent.
Deployment: No build steps. Just dockerize it, and you are good to go.
Ecosystem: Great ecosystem. You will find industry-standard solutions to fulfill all of your needs, and you can integrate them really easily.

The Good: It's a really enjoyable experience.
The Bad: The main file may feel crowded as it's an unopinionated framework.

My Opinion: If you're looking to build scalable and performant backends in less time, Python (FastAPI) is the way to go.

- Golang (Chi)

Developer Experience: Great, but sometimes feels like reinventing the wheel.
Productivity: It has great tooling support, making it really productive because everything you need is already baked into Golang's tooling, from development to testing to deployment.
Performance: Fast.
Deployment: Just compile it and ship it. It's a single binary.
Ecosystem: It's decent, as the standard library has everything you need (most of the time).

The Good: Simplicity at its core.
The Bad: The type system feels weird, and it's verbose (you're going to write a lot of for loops).

My Opinion: It's a really popular choice for microservices, but in my opinion, you should only use it when performance is a crucial part of your system. Otherwise, it may be a bad option because it will take a lot more effort to write a backend than with the other two.

That's it, so which one are you going to use for your next project?

Top comments (1)

dolanor profile image
Tanguy ⧓ Herrmann

I would always choose Go as I find the syntax a culmination of best practices from other languages as well. But I do admit it is verbose for some cases.

That's why I was excited about the language getting some generics programming. I created just to avoid most of this boilerplate in REST API creation. It doesn't handle all cases yet, but I'm working on it little by little. If you can try and give me feedback, that would be helpful :)