Ask HN: Simplest stack to build web apps in 2021?
I'm looking to build a new app with a frontend, rest API, and server-side rendering. I'd prefer a single batteried framework supporting all of these out of the box.
It's been a while since I can develop from a clean slate and I was hoping web dev in 2021 would be much simpler than what I am used to. However, I spent this entire morning looking at modern frameworks (not going to name them to avoid turning this into a different kind of discussion) and I'm kinda disappointed. They all look complicated and require lots of configs and plumbing to get started.
Any stack/framework that you find simple and joyful to develop with?
188 comments
[ 3.4 ms ] story [ 231 ms ] thread2. Not sure of it's market share, does it attract many jobs and projects and in which sectors?
Thanks
Could always try out F# if you think the grass is greener out there.
PHP => Symfony or Laravel
Python => Django or Flask
Javascript => Node/Express
Ruby => Rails
Then there are others like elixir/Phoenix etc and then you can do your own in Go etc.
I do recommend dipping in Laravel first, before Livewire.
I've not used it in depth yet, but from a poke around the overall design and syntax seem very nicely thought out (much more logical/intuitive than Flask, honestly) and it's very fast.
With the addition of:
C# => .Net Core
Their latest web framework running on the latest long-term support version of .NET
Rooting for quarkus to become more mature though. (Recently tried based on someone's recommendation on HN).
Flutter is great for native iOS and Android though.
The development framework is pretty nice with the way you can share code between native and web, but the end result is just lacking.
I don't get your point, Dart is also compiled to JavaScript.
Dart is very easy to learn so whether a lot of people know it or not is not really an issue. Any competent programmer will be able to learn it in a few days.
In my brief experience, learning the language and framework only took a few days and it was much easier than making sense of all the issues with the current frontend web stack. Dart also has JavaScript interop so using libraries written in js is not an issue. [1]
1: https://dart.dev/web/js-interop
It tries to automate a lot via the ember-data module (which also makes queries automatically, e.g. left/right joins etc) so it shines with its predefined rules, lots of former rails people seem to contribute to its ecosystem these days.
[1] https://emberjs.com
From my personal perspective I'd say that Ember tries to keep the "fatigue" effect as low as possible when comparing it with e.g. what's going on since the React Hooks "refactors" everywhere.
Put in on a VM, deploy with Ansible, and call it a day.
This is my boilerplate: https://github.com/ttymck/fastapi-fullstack-boilerplate
If you don't mind separating them out (which lets you use different tools for your web tier and your middle tier) I'd probably use a combination of a static page driven by VueJS on the frontend and Golang on the backend for the API.
[1]: https://v3.nuxtjs.org/getting-started/introduction
I personally am looking into using it (or most probably next.js) with Cloudflare Workers / Durable Objects. Running backend code close to end users is awesome.
Edit - to make life extra easy also set it up with Postgres and deploy to Heroku. Everything literally just works.
What would you choose?
It'd be great to see that change over time, but to be honest I'd be more excited to see some movement behind the crystal lang, because I love coding in Ruby. All of my side projects are now being written in Ruby because I don't need something that scales in microseconds, or 10's of milliseconds for that matter, and I feel so much more productive.
Again, I hope I'm proven wrong. I think Phoenix has a lot of potential, but it still has a long way to dethrone Rails.
Do you realize how biased you sound to be?
I've been using Rails for 10+ years now and setting up a phoenix app is very intuitive. A lot of "oh this is like X in Rails". IME most of the complexity was around JavaScript and that's changed with esbuild.
However it sets up with very similar patterns to Rails. Something I'd expect as it's creators came from Rails. Usually the differences are specific to FP vs OO.
Admittedly coming in from another language especially with an OO background would be harder as it's a smaller community than Rails and doesn't have 10 years of documentation sitting out there. That said documenting elixir code is much easier IMO, so that is sure to change. Also the scope of FP languages requires significantly less documentation IME.
The only thing vs Rails that I have found somewhat needing more attention in Phoenix is SSO integration but it's there and progressing especially with the Phoenix 1.6 changes.
It is not. From the outside the end result for the user might be similar, but that's where the similarities end. Elixir's LiveView what I assume you're talking about keeps state on the server, in memory, and sychronizes changes back to the client over a websocket. Hotwire is "stateless" in the sense that no end user state is kept in memory on the server across requests. You can also use most of Hotwire without websockets.
My previous company was using Elixir, and they moved away from it because everything took longer to develop, the ecosystem of libraries was very lacking, the tooling (such as editor support) was terrible, and it was very difficult to hire experienced developers.
Performance wise, I agree, it is faster and you will use less servers. A nice problem to have to be honest.
But I insist, they have almost nothing in common other than maybe the end user result. The approaches they take are architecturally very different and with very different trade offs.
But if you really want a full stack framework or don’t want to deal with fancy JavaScript frameworks, I think you’re better off sticking with Rails/Django/Express or something you’ve probably heard of.
Is very pragmatic. That means your whole investment in the arcane ways of JS are dust. Not hipster at all.
---
More seriously, Is of little issues here. You setup and it works, so is not something that lead to "generate content" like other setups.
I found only a significant issue (to me) (https://github.com/bigskysoftware/htmx/issues/596) but then I do something that have never done in long time with a JS library: I poke into the source and fix it myself. Far easier than expected! (ie: The code is plain!)
I quite like HTMX myself, although I consider it a tool you use to enhance websites and not something you use to build full blown web apps.
Yes you could inspect the headers and such to determine what type to return, but the core problem remains, that the HTML in those is not reusable whereas as JSON would be.
How much overhead this is for you depends on your design of course, but it does mean some work might potentially be wasted if you go down the full SPA application later and even if not changing layouts and such might be a pain.
if it is greenfield development, it is much better to simply return SSR HTML and avoid that complexity
you can join the discord for more immediate help:
https://htmx.org/discord
Web2py (being phased out by py4web which I haven't tried) made that very easy. If your api is accessed as api/hello.html, it can return HTML. According to the extension, hello.json, hello.csv, hello.txt, hello.pdf, etc. can return the adequate content.
Of course you can always return JSON regardless of the extension, but I found the same endpoints serving different formats very convenient.
Seriously, is super productive this way!
Here's a great talk on why he asserts that: https://www.youtube.com/watch?v=J_7_mnFSLDg
Not sure I 100% agree, but I appreciate the fresh look at oil patters.
Everything is now all at the same global namespace and all of the issues that people run into with specificity go away in the process.
It’s not my personal choice on how to solve that problem I think shadowDOM via web components are a much nicer option personally but Tailwind has a lot of very enthusiastic fans who seem to enjoy it.
Half of TailwindCSS is a _way_ of using styles, but the other half is almost a theme: a set of margins, paddings, text sizes, colours, etc. that work well together.
Each class is applied in pipeline.
And ONLY to that tag. This is key. This leads to know, exactly, what are the effects on each tag, making the UI design very readable.
Then, you can customize it, and have a way to generate a VERY small CSS as result (another big advantage!) because the naming is normalized.
In short: Is the "same" but with more structure, predictability and tooling applied.
The more you need to customize, and the more pain you to "reverse" a CSS made by others, the more this make sense.
https://unpoly.com/
Very lightweight without much black box magic.
Miguel Grinberg’s tutorials and book are a great and quick crash course.
So much can be accomplished with server-side rendering and some jQuery sprinkled on top. (jQuery isn't even strictly necessary with modern vanilla JS, but it's very nice syntactic sugar at the least.)
90% of apps/sites will fit into a basic CRUD/REST document format, which is exactly what server-side HTML served over a RESTful interface was made for. Judicious use of jQuery fills in the front end blanks for all but the most advanced use cases.
The big benefit of this is that you're not locked in to the JS framework-of-the-week once it inevitably becomes either deprecated by its mammoth corporate sponsor who doesn't care about you, or when it's no longer the new hotness and you can't find developers who understand it anymore. jQuery has been around with a largely stable interface for a decade and a half.
The secondary benefit is that you're not including some vast framework with innumerable, inauditable dependencies, requiring special expertise from highly-paid developers, just to put an AJAX button on a webform.
Easily add highly profitable products to your Shopify store. The new dropshipping tool from lets you add trending products to your Shopify store in minutes. It's the simplest and smartest way to dropship.
https://rebrand.ly/h5v3qsw
I also leave you this free guide, it helped me a lot:
https://rebrand.ly/x0qwcbv
Azure functions or Google Firebase for the backend.
With this approach you might not need to pay a cent depending on your usage, plus you can take advantage of the large ecosystem of React components. For a "non-serverless" approach, I would set up a VM on Linode and use docker-compose behind nginx.
https://kemalcr.com/
https://luckyframework.org/
Plenty of folks who "haven't used a framework, but heard X is great" are missing out on the real deal. Give it a go, you won't regret it!
I've met a few devs recently that are starting with that for simple CRUD projects even though they could easily spin something up in Rails.