Node.js is probably the most popular backend technology in the industry. Companies like Twitter, LinkedIn, Uber, and many others use Node.js as their primary server technology or combine it with other languages. It has a lot of things going for it like a huge community, a great ecosystem, and it uses the same language in the front end and back end.

Since C# and .NET are my main programming languages, I’m trying to figure out if I’m using an underrated technology or if the market trend has a point. ASP.NET, the .NET server framework, is popular in its own right. Ever since the .NET runtime became open source and cross-platform, it’s been improving and gaining popularity, but it’s still far from Node.js, especially among startups.

I recently wrote an article about the pros of Node.js and why startups are all-in on this tech. But taking the other side of the argument, .NET has a lot of advantages as well, ones I know very well. Here are 7 reasons for startups to consider choosing .NET over Node.

1. .NET has better Performance

Performance is the biggest weakness of Node.js. Not to say that Node.js is unbearably slow, but when you need any sort of computation on the backend or a high throughput of requests, Node.js isn’t a good choice. The main reason is that the runtime is single-threaded, which is a big waste with today’s multi-core processors that allow executing many operations in parallel. Recent benchmarks in techempower show Node.js is far behind ASP.NET Core.

.NET is not the fastest tech. That title would probably go to some minimalistic Rust or C++ implementation. But out of the mainstream web frameworks (excluding niche projects like Just or may_minihttp ), it’s one of the fastest.

Single query benchmark:

single-query nodejs aspnet

Multiple queries benchmark:

multiple-query nodejs aspnet benchmark

Fortune cookie benchmark:

fortune ASP.NET vs Node.js benchmark

2. Node.js requires to mix & match languages to compensate for performance

When looking deeper into tech stacks of companies that chose Node.js, it’s almost always used in a microservice architecture combined with other languages and runtimes like Go, Rust, Java, and Python. Node.js and JavaScript are great for high-level REST servers that just send queries to a database, a queue, or another service. It’s not good, however, when you need to do some compute work, like run an algorithm or work with the file system.

C# and the .NET runtime, in contrast, are fast and versatile. In most use cases, you won’t need to use a native language like Rust or C++ to gain an extra performance benefit. This means that you can save the overhead of adding an additional language to your project’s tech stack. Another language is always best avoided because you’ll need more specialists, more infrastructure, and the teams become less versatile.

3. C# is an amazing language

It’s hard to argue about which language is better. Everyone has their preferences and biases. But I’d claim C# is one of the most powerful, productive, and popular languages in the industry right now.

  • It’s a high-level c-style object-oriented language, which will be familiar and productive for most developers.
  • Despite being a high-level language, it allows low-level control over sensitive code when needed for performance optimizations. You can work with pointers and direct access memory access if you choose to.
  • It has rich functional language capabilities like LINQ and extension methods .
  • It’s type-safe, much more so than TypeScript, but it also has dynamic capabilities like JavaScript when you need them.
  • It has great documentation and a sizeable community. Not as big as in the realm of JavaScript development, but still very big.

A few examples of projects using C# are the Bing search engine, StackOverflow, and Unity (the most popular game engine) which lets you use C# as the programming language.

4. Best tooling available

I’d argue that C# has the best tools in the world. The best IDEs, the best debugging experience, and the best profilers.

JavaScript or TypeScript doesn’t have the strongly-typed nature of C#, so advanced code navigation and refactorings aren’t possible. In many cases, it’s not feasible to know who implements your interface or who references your class’s function. Often Node.js has to rely on basic text search, whereas in C# IDEs you can navigate to usage and implementations with a shortcut key. The same goes for powerful refactor capabilities, like implementing interfaces, adding parameters, and extracting functions or classes. If you’ve been using Visual Studio or Rider for a long time, you’ll probably experience a real loss in productivity moving to Visual Studio Code.

As far as debugging concerns, the Chrome Developer Tools debugger or VSCode debugger don’t come close to Visual Studio’s experience. I might be a bit biased since I know all the features in .NET, having written a book about it , but I’m a rather average user when it comes to debugging Node.js.

5. Easier built-in development loop

In Node.js you can build your development environment pipeline in any way you want with tools like Babel, Webpack , ESLint , etc. You can use different JavaScript versions, bundle everything into a single file or to many slices, minify, and more. This is a very customizable process. There are many different tools for every part of the pipeline. Webpack can be replaced by Rollup or Parcel , ESLint can be changed to prettier , etc. There are a million different ways to build your JavaScript project and every single company seems to have its own unique setup. A setup that requires a whole lot of development and maintenance. Although I have to admit there are modern ways to get a rich development environment up and running quickly with tools like Vite .

The situation in .NET is quite the opposite. There are not many technological choices in your build setup because you’ll always be using Microsoft’s MSBuild, .NET SDK, and Visual Studio. You can do some customization, sure, but it’s nothing like a JavaScript project. The only “choices” you’ll be doing are which .NET version to use, which is always going to be the latest, and which type of project you’re building: ASP.NET Web API or ASP.NET MVC, which should be an obvious choice depending on how you want to develop the front-end.

So you can consider the flexibility of Node.js an advantage, which is reasonable, but you can also look at it as a liability. In .NET development, there’s not much that needs to be done with the development environment except in very big projects or special cases. Visual Studio and MSBuild just work and they can handle huge enterprise applications and servers without too many problems.

6. Stable ecosystem

As just mentioned, Node.js and JavaScript have a very rich ecosystem. That includes development tooling, libraries, documentation, etc. For better or worse, this ecosystem is mostly open-source and developed by the community. In many cases, a library you depend on is developed by a small team or even a single person. If that person decides to stop working on the project, you’re screwed. Sure, someone else could pick up the work, or you can fork it yourself and add whatever missing piece you need, but that’s a big hassle for a startup that sprints to create its first product. It’s not the only problem with small open-source projects. What happens when they introduce bugs or security breaches? The maintainers aren’t exactly accountable if their hobby project caused damage to your startup, are they?

I’m not saying big companies don’t have bugs in their products. They might have more for all I know. But you can complain, open a ticket, and even sue Microsoft. You can be certain that a project will continue to be supported for a very long time, and if it stops being supported, you’ll get a notice a few years in advance. As far as stability and reliability, I’m betting the Microsoft .NET runtime and all its tooling are better tested than most open-source libraries for Node.js. This might cost in slower version releases, but it will be more stable.

Having said that, there are plenty of well-maintained libraries that have many contributors and are well-backed by big companies.

7. Compliance, privacy, and security

This argument is based mostly on common sense, not on my experience or expertise. Sorry in advance if I’m making some false assumptions.

You might not consider compliance issues as important or particularly interesting when beginning a startup. I’d imagine founders are focused on making a product, hiring, raising funds, and choosing the company’s logo. But it’s one of the most important aspects of your product. In some industries, like healthcare, military, and government, it’s crucial that your app will be secure, protect personal information, and comply with standards like HIPAA , GDPR , and ISO 27001 . Even if you’re not working in such an organization, you probably want the big customers that do care about these things.

Going back to our choice of technology, does it matter for compliance/privacy/security if you choose Node.js or ASP.NET? Applications running on both technologies can be compliant with standards or not, secure or not, and protected for privacy or not. But when you choose Node.js, you also choose to use open-source libraries and ecosystems. There’s a bigger chance that some library has security or privacy breaches. And there’s a much bigger chance these projects don’t adhere to the crazy standards Microsoft sets for itself in terms of compliance. And even if you’re taking the best steps to secure your application, doing penetration testing and whatnot, you can’t compete with Microsoft’s reputation. If a government customer knows you’re using Microsoft tech stack from top to bottom, they’ll be more likely to trust your app.

Finishing up

I hope I convinced you of at least some of these points. A lot of the arguments are subjective, like who has better tooling, or which programming language is better. I’ll be the first to admit Node.js has advantages over ASP.NET as well, as I wrote in my previous article 8 reasons startups prefer Node.js over .NET, and are they justified? . What’s your opinion? Write a comment below and let me know. Cheers.

M ↓   Markdown
T
Thomas Levesque
1 point
2 years ago

JavaScript or TypeScript doesn’t have the strongly-typed nature of C#, so advanced code navigation and refactorings aren’t possible.

This is true for JavaScript, but not for TypeScript. TypeScript has a very strong and flexible type system; I wouldn't say it's really "better" than C#'s type system, because it's too different to compare, but it can do things that are impossible in C#. TypeScript code navigation and refactoring work great in VS Code.

(C# is still my favorite language, but I find TypeScript pretty awesome too)

M
Michael Shpilt
1 point
2 years ago

I agree that TypeScript is great, and it sure can do some things C# can't (like union types), but you can easily cheat in TypeScript. You can cast any object to "any" and then work with it dynamically. I'm sure there are other things but I can't think of any off the top of my head. Every time you cheat somehow you hurt intellisense in the IDE as well.

?
Anonymous
0 points
2 years ago

In C# you can cast anything to “dynamic” and cheat the same way. Having the possibility to do something bad doesn’t mean that you should do it. (:

O
Oleksii Korniienko
0 points
2 years ago

It's a really weird comparison with dynamic. I have seen a lot of typescript code that uses “strong” typing as actually every second project either uses JavaScript or typescript and working with any when people don’t know which type to indicate. I have seen very very little usage of dynamic type, so its not fair comparison

J
John Crim
0 points
2 years ago

I use C# on the backend and typescript on the front end. I love C#, and I like Typescript b/c I think it's more or less the best that can be done for type-checking javascript. Javascript is a liability, as are other barely typed languages, though it does improve slowly. Thomas is correct that Typescript provides the code navigation and refactoring that is comparable to what is done with C# in C# IDEs (note that nothing touches ReSharper and C# RE refactorings) - that specific sentence in the article is wrong.

I would amend this article/change this point to cover the runtime type safety of .NET/C#, which is vastly superior to Javascript. C# gives you compile time and runtime type safety, but with Typescript you're only getting compile time type safety. Consequently, you get higher quality or require fewer tests to verify runtime correctness with C#.

Overall this is a good article - I agree with your points and they are important and provide a ton of value.

C
Casey Spaulding
0 points
19 months ago

How about a React frontend with an ASP.NET backend ?

?
Anonymous
0 points
2 years ago

This is a great article. I agree with everything you've said. I use both .NET Core and NodeJS in my company, I prefer .NET Core much more. When deployed, it runs so much faster. For NodeJS, we're at the mercy of our linter to find errors. For C#, it's been never as issue. Broken codes do not make it out to production.

M
Michael Shpilt
0 points
2 years ago

Awesome, thanks for the feedback. I’d guess Node.js enthusiasts would claim you needed more tests to find errors. Or typeScript.

?
Anonymous
0 points
2 years ago

Thanks for the article. Having played around with different languages for years now, C# is the best programming language I've used.

M
Michael Shpilt
0 points
2 years ago

Did you try the new popular ones like Rust, Go, Scala, and Kotlin?

?
Anonymous
0 points
2 years ago

For benchmark test results I would like to ask you to read this article: https://dusted.codes/how-fast-is-really-aspnet-core

M
Michael Shpilt
1 point
2 years ago

Wow according to this, .NET Core is 10x faster than Node.js!

S
Sanam Pakuwal
0 points
2 years ago

I love javascript in frontend and c# in backend.

?
Anonymous
0 points
2 years ago

The biggest downside to using .Net at server side is that it forces you to use and understand two different programing languages, IDEs, ecosystems: one for server-side and one for client-side. Havig two different technology stacks is not a good thing. On the other hand with NodeJS+Typescript it's easy to switch from client-side to server-side development - you require only one skillet. I personally switched from .Net to NodeJS+Typescript two years ago and have never looked back!

M
Michael Shpilt
0 points
2 years ago

I absolutely agree, but in a big application you'll probably have to use other languages to compensate for Node.js perf, so you're not truly avoiding another tech stack.

?
Anonymous
0 points
2 years ago

You can use Blazor for C# on the frontend!

?
Anonymous
0 points
2 years ago

I love c# but please correct paragraph 1 see: https://dusted.codes/how-fast-is-really-aspnet-core

S
Stephane Pellegrino
0 points
2 years ago

Nice article, thanks !

By the way, what is today the "best" web server for .Net core according to you ? Kerstrel, IIS ?

P
puria Kordrostami
0 points
2 years ago

man seriously, JavaScript under the hood is working in multithread and uses multi cores. please fix that.(eventloop libuv)

M
Michael Shpilt
0 points
2 years ago

Don't know about under the hood, but user code is still going to run in a single thread unless you're using service workers. Not to confuse with asynchoronousity.

?
Anonymous
0 points
17 months ago

what about cost of running node and not-node? I would like to see comparing !

V
Volo Maslov
0 points
17 months ago

Good article, I'm using C# from .NET 3.5, and it's very good for growing products with a median team.

Having the background of 7 years with .NET and 4 years with NodeJS I'd say next:

  • I'll pick a NodeJS for my next "what if" or "let's just do it" project or to build a PoC of something as quick as possible. You can replace NodeJS also with Go here (more nerdy and powerful). Another reason could be a socket-based component of distributed software, like realtime updates or chat system, as NodeJS shines here.
  • And for a C# - it's a good pick when I know what I'm going to build in advance, the domain is "somehow stable" and it's visible how to get a revenue from a product, the scale-out is on horizon, and the team is required (so the software has medium+ size).

As usually it's all depends, and if you have a team of super-duper developers you can take whatever you like. Just keep in mind that they may leave at some point, and having an onion architecture in NodeJS with custom build framework may not work well, while C# has its standards there. Don't take it wrong, you can still do all the greatest software with JS/TS, utilizing the edge patterns within a distributed system, but its maintainability will be lower than .NET or Java because of different mentality behind (SDK, toolset, contributors, open source quality, developers maturity).