Choosing a language for your web application is no easy task. Especially if you are a SaaS for which your web application or online portal is your core offering. You want to choose something that scales well and covers your business needs both on the front end and back end.
Fabian Wesner, Founder of ROQ has a lot of experience with web apps. He built 3 shop systems (that have generated many eCommerce websites) and now offers a modular, Feature-as-a-Service web application generator for enterprise-level execution of web apps.
Fabian shared on the alphalist CTO podcast his insights into web application - based on his years of experience and study. (He spent 20 years working (and leading companies) in PHP before switching to JavaScript which he studied intensively for 3 months full time.
In this article, we will discuss the factors Fabian mentioned in the podcast that he suggests we use to determine which language. He then uses these factors to suggest a language for each use case (eCommerce, Static Web Application, and Dynamic Web Application (SaaS, online portal etc.).
It is a good idea to use just one language family throughout - from the backend to the front end. This not only prevents language mismatch but also increases team productivity.
Productivity of the team is heavily affected by the amount of programming languages that you use. - Fabian Wesner, Founder of ROQ Technologies, former CTO of Rocket Internet and Spryker
If you are looking for the best all-encompassing language which will minimize the number of languages in your stack, this is what we suggest.
Backend: JavaScript
Frontend: React and Next.js
Mobile App: React Native for mobile app
Server-Side Rendering has a lot of advantages, the primary one being the simplicity of having only a single application instead of "frontend" and "backend". One key disadvantage though is how it works on mobile. Mobile Apps work best with Client-Side Rendering which leverages the power of a smartphone best and allows the app to work even there is no internet connection.
For most web apps, a stateful UI is important, and a framework like React, Vue or Angular does the job best. One could use a Ruby + JavaScript Events + React combination to achieve this, or even have a Single Page Application entirely in Ruby. An alternative is to use a library like Hotwire that sends all browser events to the server so that a piece of HTML can be generated there. The result is then morphed back into the DOM.
But Fabian prefers to keep everything in one language and that is why he uses React Native for the mobile app equivalent of his React + Next.js App. He does admit though that using React is still a highly complex process and at times he felt that he was far off from React’s use case - but for him, it's worth it.
If you are building a web application that also needs to use on an app, this is what we suggest
Speed is important. It determines everything from your customer experience to your hosting setup. When Fabian was the CTO of Rocket Internet, they initially used Magento for their Brazilian store. Yet it was just too slow for their needs - because at the time Brazil did not have a local AWS server so sending traffic to a US-based data center using Magento was just too slow - so they had to host locally which was extremely expensive. This was one of the reasons why Magento was soon replaced by Alice+Bob - Fabian’s first lightweight PHP-based shop system.
Some languages though are faster than others. When building his web stack, Fabian compared different language speeds and he found JavaScript fastest for dynamic web applications.
Almost as fast as Java
10 times faster than PHP
Faster than Python (even to the point Fabian would use Node.js for BI)
If you are building a Web application based on speed, this is what we say:
Potential Solutions: JavaScript or PHP
In Practice: Fabian uses JavaScript for web applications. (Yet for eCommerce he might use PHP based on other factors).
You want to code your program in a language that is easier to get developers in. This is why Fabian advocates for using the latest version of an industry-standard language.
[It is important to use industry standard languages, else] you will also run into technical limitations very quickly and you also will not find developers. I mean, nobody wants to work with an application that is implemented on, [for example] an old version of [Ruby on] Rails. - Fabian Wesner, Founder of ROQ Technologies, former CTO of Rocket Internet and Spryker
How to get good backend JavaScript Engineers?
JavaScript experts are usually better at frontend programming. It is really hard to find a good Node.js engineer for the backend. Even though people might be familiar with Node.js and how it works, there is more that goes into the backend than just Node.js. Even though it is JavaScript, it is still important to implement coding best practices like SOLID principles or “Clean Code” that are required in PHP and Java. Those with a background in Java and PHP know what an interface is, what an abstract class is etc and because of that, they code well. That is why when hiring for a JavaScript-based backend, Fabian sometimes prefers to recruit those with a background in PHP or Java in addition to training JavaScript engineers to code using best practices.
One thing that determines the popularity of a language is usually the ecosystem.
Node.js has a very active ecosystem, perhaps even too active in that there are a lot of new features popping up all the time that you can spend your days just re-platforming your code to suit a newly arrived front-end framework or a tool!
React itself probably has more features than business uses (which probably means developers are having fun). Interestingly enough, while PHP has Laravel, Ruby has Rails and Python has Django, Node.js is yet to have a comparable framework of its own. (Although NestJS is promising and is quickly becoming industry standard, yet in terms of functionality it still lags behind Django/Rails as an ecosystem.) Fabian predicts soon a big company will get behind it and introduce it - just like Facebook did with React.
eCommerce sites are complex as you need to manage the state the whole time. Users need a stateful frontend, but you also need stateless sections to allow for easy scaling. (You might also be interested in hearing Kore Nordmann talk about building scalable eCommerce websites).
Shopping cart
Check Out
Discounting and Sales
Catalogue (display, filtering, configuration)
Multi-currency
Multi-Locale
Inventory management
You also need something highly secure, with great performance, and easy to scale.
Fabian knows all about eCommerce - having built modular shop systems for 3 companies (Rocket Internet, Project A, and Spryker).
Fabian says to just go with PHP for eCommerce as most engineers with eCommerce knowledge are PHP engineers. This is because of the popularity of existing open-source shop systems (like Magento) while there is no relevant shop system based on Ruby, Python, or JavaScript.
You can of course build a basic website by rendering stateless pages with a stateful front end. Yet this might be an overblown solution if you are just looking to render static pages to show content. The simplest way to achieve this would be an HTML app that renders content -built in the language of your choice (PHP/Ruby/Python). This setup won’t work on a mobile app though.
Whether you use a SaaS or a web portal, there is so much complexity when placing all the states in one browser (or mobile app). Again, you are dealing with a lot of state management with a stateful frontend with scaling capabilities (usually through a stateless setup).
You might be also looking for features like:
User management (e.g. forgot password, permissions)
File upload (usually entails security, storage)
Billing (e.g Subscription model, invoice system)
3rd party Integration (e.g. Customer Service Apps (e.g. Twilio), Analytics, ESP, or Local Payment Processing)
Questions you need to ask yourself before devising a tech stack:
The answer depends on your budget. If you need something that will cost under 5000EUR to develop, PHP + Laravel is your best bet. Yet if you want to know the ideal setup that will scale the best? Read on.
If I started a new startup and have only a 5,000 Euro budget, then probably this would not be the stack that I'm using. If I build an enterprise project and I have a half a million then it has to be done like this because this is the industry standard. This is the best practice. There is a reason it is all like this. Otherwise, you will also run into technical limitations very quickly and you also will not find developers ..I mean, nobody wants to work with an application that is implemented on, [for example] an old version of [Ruby on] Rails.
- Fabian Wesner, Founder of ROQ Technologies, former CTO of Rocket Internet and Spryker
NestJS (the modern version of Node.js that is industry standard)
GraphQL (for main API approach)
Federated Graph for putting all the GraphQL together
Apollo server
Microservers
Conclusion
In this article, we discussed the factors that go into choosing a coding language for web applications (language flexibility, clients, speed, and workforce) as well as which language Fabian would use for the 3 most common use cases: eCommerce, static, and dynamic web applications.
Happy Coding.
First published here
This article was based on an alphalist cto podcast episode. The alphalist podcast features interviews of CTOs and other technical leadership figures and topics range from technology to management. Guests from leading tech companies share their best practices and knowledge.
The goal is to support other CTOs on their journey through tech and engineering, inspire and allow a sneak-peek into other successful companies to understand how they think and act. Get awesome insights into the world‘s top tech companies, personalities and trends by listening today on Apple, Spotify, Google, Deezer and more.
If you are a CTO at a tech-product company, perhaps you would be interested in joining alphalist -an exclusive CTO network? Reach out to us for more information.