How to choose a programming language for a web app


I’m thinking about starting a new web app.
I’m in the planning stage right now, and I’m thinking about which programming language I should use.
The main thing I’m optimising for is productivity and velocity. I want to build high-quality software fast with the limited time that I have in between software development consulting work that I do. At the same time, I want to be able to scale the project and maintain it over time easily.
I thought I’d share my thought process of how I evaluate the different languages so you could come up with your own conclusions for what’s best for you and your project.
First, I look through the languages I have worked with: PHP, Ruby, JavaScript/TypeScript.
For you, the options might be different based on your past experiences. But general principles still apply.
Here’s how I see these language ecosystems:
PHP strengths:
- Massive ecosystem of packages.
- Has great battery included frameworks like Laravel.
- Laravel comes with in built solutions for ORM, Queues, Caching, Databases, Authentication, Storage different frontends (React + Inertia.js, Livewire for server-side rendered UIs).
- These solutions work nicely together because they’re designed around one framework.
- Relatively easy to find developers who have worked with PHP.
- Easy to self-host on a VPS. I have apps in production right now running on 8 EUR VPS.
PHP weaknesses:
- Infrastructure as code cloud tooling for PHP is not great. Especially if you want to go serverless, as PHP is mostly designed to run in containers.
- I had mixed emotions when I saw that Laravel Cloud was released. Looks like a platform as a service that locks you in at the infrastructure level.
- Younger developers coming into the industry almost never learn PHP. This is sad because it’s a great language, but the reality is that if you ask most newer developers which language they started coding in, you’ll rarely see PHP these days. You can imagine what the talent pool will look like in 5-10 years with this trend.
- The strengths of good PHP packages are also it’s weaknesses. I see a pattern where some PHP developers are unable to design their own solutions and think outside the box because they have spent years relying on the packages. Then, when they need to design something that a package doesn’t support, they take forever writing glue code between those packages.
- The main weakness of PHP for me is the lack of good AI libraries for building applied AI solutions. I honestly think that the PHP community is dropping the ball on this one. I see projects like Prism working on this problem, but the momentum is nowhere near where TypeScript is with libraries like Vercel AI SDK and Mastra AI.
Ruby (on Rails) strengths:
- Super productive defaults and ergonomics. I love things like self-validating models in Active Record.
- I love the focus on web fundamentals, both in the frontend and backend.
- On the deployment side, Rails has a good integration with Kamal, allowing you to deploy apps without PaaS to your own servers with Docker.
- Rails has huge open source projects like OpenProject and GitLab. You can learn how real production systems work by reading that source code. It’s a great way to learn real-world patterns as opposed to theoretical tutorials and articles.
- Some of the largest startups of the past decade, like Shopify, used Rails to scale their platform, so you know the ecosystem is both simple to start for small apps and scalable if needed.
Ruby (on Rails) weaknesses:
- Ruby has the same problems with the talent pool I mentioned about PHP, but worse. Even fewer developers are coming into the industry and learning Ruby than PHP.
- Same issue as PHP with applied AI tooling. Ruby has SDKs for basic AI stuff, but I haven’t found agent development libraries that are well-maintained and growing. I saw langchainrb getting some traction, but the maintenance is not as active as in the TypeScript ecosystem.
- Although I’m sometimes tempted to write my frontend code in vanilla JavaScript and join the Rails No Build movement, the reality is that for more advanced frontend work, you still need something like React.
JavaScript/TypeScript strengths:
- Probably the most active ecosystem right now.
- The only ecosystem where you can realistically use the same language for both frontend and backend.
- Great serverless support with tools like SST.
- New developers are typically learning to code with JavaScript.
- Great applied AI libraries like Mastra AI and Vercel AI SDK.
JavaScript/TypeScript weaknesses:
- Higher churn of technologies than in other technologies. What was popular 2 years ago is no longer popular. This makes longer-term projects hard to maintain.
- There are like 20 ORMs, 50 frameworks and several runtimes. You have to be very diligent about how you pick your tools and how you design your architecture to withstand changes in tools over time.
- JavaScript is easy to learn but hard to master because there are many influencers pushing bad software development practices, like not writing tests.
Personally, I will pick TypeScript because the trade-offs seem right to me.
Here’s why:
- I need good serverless support because I want to offload the server scaling to a 3rd party. I also don’t want top pay for compute I don’t use.
- Using serverless also enables me to preview environments.
- I want to move faster by using the same language on the frontend and backend.
- I want great support for applied AI libraries in case I decide to build some AI features.
- I want to build a high-end frontend experience. TypeScript with React shines there.
Are you in the process of choosing the best programming language for your next project?
If so, I have some spots available for a free discovery call on my website: darnadigital.com.
We can discuss further which programming language is best for your team and your project.