Ask HN: What tech stack would you use to build a new web app today?
In the past I've used Rails, Django, and other web frameworks with angular and some react or jquery for the front end, and either postgres, mysql or sql server for the database.
If you were to build a new web app product with a fairly complex database schema and functionality, what tech stack would you use as a starter? Obviously things depend a bit on the use case, but let's assume it's a web application that doesn't need high concurrency.
More like building a PoC of a web app start-up that can scale for a few years.
74 comments
[ 6.0 ms ] story [ 139 ms ] thread[1] https://mcfunley.com/choose-boring-technology
Unless a static site or buy option fits right, otherwise it doesn't get any better than a Liveview based app for continued productivity.
I am curious about something that works on node buy is as boring but robust as a LAMP stack, I just hate maintaining shit where stuff is already deprecated after just a few years, but upgrading is not an option because there are 100 dependencies and we are in the hell where 10 packages are vulerable but can't be updated, 10 are abandoned and I need to research replacements and somehow make time to transplant them...
My question is this, Ruby has Rails, PHP has Laravel or Sympony, Python has Django , what is the equivalent for node backends (something that is old,stable and not a mix of 100 packages from 100 random dudes)?
I tend to prioritize "capabilities to build compelling systems" which, to me, means getting to production quickly so user feedback / product-market-fit tests can occur, but then also scaling a team to maintain the application over time because once you've found a good fit its time to grow.
To me stateless CRUD isn't compelling. Its too easy - if your app just provides a GUI in front of a database for Create/Read/Update/Delete operations your app is a database not an app and if all it takes for someone to clone your app is 5 minutes of CRUD generators, then that's not exactly a defensible position to build a business on.
Phoenix like other web frameworks provides generators and quick paths for your usual Web + Database applications. Run some commands and you've got a web app with database persistence. Everyone can do this nowadays (Django, Rails, etc) What Elixir and Phoenix does better than anyone else is distribution, concurrency, fault-tolerance, and real time streaming. These capabilities are possible because of deep details on the virtual machine level and become trouble for cooperatively scheduled runtimes elsewhere (e.g. Python, JS, Java, Ruby, etc).
If you're building something with: websockets, collaboration, chat, i.e. anything real time between many users - save yourself the trouble and look into an Elixir/Erlang solution like Phoenix/Liveview/Channels/Presence.
On the human side Elixir has top tier documentation (example: https://hexdocs.pm/phoenix/channels.html#content) - we've found it doesn't take long for developers with at least a few years under their belt to pick up the language/framework and be productive. You don't have to know everything - just build some familiarity of where to look and you'll figure it out. Its very important that this human side be scalable as well, and that means developer experience, documentation, on-boarding, etc.
I've been using Elixir/Phoenix every day since 2017 to build apps, glue systems together, rebuild Ruby/Rails/PHP/Python apps that don't scale anymore and in general just ship features on time consistently.
The thing that I'd toss in as an "it depends" on the technical scaling side is Postgres - its a boring single server relational database that just works but is still a single server architecture made for spinning disk persistence. SSD/NVME/Persistent Memory and more are new foundations for persistence which means new databases on the new foundations may warrant attention soon. 99% of the time just use Postgres/MySQL though. If you're not sure just use Postgres. For many apps in finance or with stringent auditability that are log-centric using a time series and/or event sourcing database makes sense for the projection / read model flexibility. That said you can use Postgres for that so there's no good excuses for not using it.
I'd say the biggest disadvantage/con to using Elixir/Erlang is that its more of an expert's tool-set. These are sharp tools made for engineers that make sense to engineers with experience to know they want fault tolerance and concurrency. What this means is that a newbie developer might not know what they don't know they want to know when building an app the first time. This caveat is probably true with any tech stack, but there will be a lot to learn about the backend because there's more possibilities on this backend stack. These backends-as-a-service (Firebase, Hasura, etc) will get things rolling quickly but in my experience all the r...
Most of the time getting started with a project involves the boring CRUD stuff, a table with users, login, register, reset password stuff. Then on top of that you add some business logic, this days if you do an SPA that will be done mostly in frontend and in backend you need to validate stuff so users don't send you garbage. The initial comment just had a list of names and no explanation, like what languages/tech is used and for what is good and what are disadvantagtes, now you comment is welcomed and is very clear what this tools are good at.
And no, your app is not that 0.000000000001%
Wouldn't you want client side statefulness if you have an app like an online spreadsheet (google sheets, microsoft excel) that could occasionally lose connection but you still want users to be able to continue working on their document?
Complex client side state or collaborative features might use something like https://github.com/slab/delta-elixir or https://www.inkandswitch.com/local-first/ which is where I'd want JS.
TBH I wouldn't greenfield a new web app with React if I could avoid it - either wrapping a Liveview in a React component or React in a Liveview the purpose would be to gradually transition away from React running the whole DOM/view for a large existing app.
A GraphQL server with Phoenix/Absinthe for a multi-platform app web + mobile (android + ios) is reasonable but still a bigger company/team solution. React + State management like Redux is a ridiculous amount of overhead by default and I would never implement a greenfield web app that way in 2021.
A Liveview interaction follows something like
Backend State <query/command> Liveview <websocket> Client/Browser (where only minimal diffs of changed state is sent over the wire)
and React is
Backend State <query/command> Controller <JSON/HTTP> Axios <Redux/State Management> Virtual DOM <> Browser/Client (where whole json payloads are sent and encoded/decoded over the wire)
Where new state means re-fetching all the state each loop instead of just what changed. The amount of data sent over the wire by default is massive with this React + HTTP/JSON model.
The encoding/decoding of JSON and having to send full payloads then having state management occur in multiple places and languages - it ends up being a lot more to know and think through. The lines of code to write and amount over the wire with the classic JSON over REST + React/Redux makes it almost 100% required to have separate front/backend developers which then means coordination costs for every new feature.
So TLDR; React could make sense for complex components you don't want to reinvent the wheel for or when those interactions are complex and client side. Existing web apps with a lot of React code that is too much to port over all at once can be done piece by piece (where I'd recommend heading towards handling navigation in Phoenix/Liveview and components in React).
* sqlc to connect to PostgreSQL Aurora.
* zerolog for logging.
* chi for router.
* jQuery for JS interactivity.
Those are where my strength lies. I can add or reduce components at a lightning speed using Go.
It's a poc, the only thing that matters is getting it out the door. In fact code might not even be necessary for a poc.
If this were me, I would dig up my last abandoned monolith with all the boring details like routing, migrations, seeding, auth all figured out, rip out the old code and start from there.
I don't think "boring and fast" is the only consideration you should take. You should also consider: "are you going to be able to read your code without wanting to tableflip after a year?"
It's "boring" but C# is an extremely developer-friendly language these days, and it's hard to beat the availability of documentation, examples, and libraries.
EDIT: and on the front-end, the MVC templates that Microsoft provides start with Bootstrap. I've found Bootstrap and some native Javascript provides more than enough flexibility for quite a while. Bootstrap is great for an MVP, and has a lot of flexibility to make it look good!
You can definitely deploy/host the application on Linux just fine - we do it all the time!
https://dotnet.microsoft.com/en-us/download
https://stackoverflow.com/questions/38109524/what-is-the-dif...
[0]: https://stackoverflow.com/a/38109745
Unless you have specific requirements where that stack isn't a good fit, or other reasons not to choose it like it's too niche to hire people for.
Or if you're doing this for fun, use the most exciting one that still looks like it's at least somewhat stable and won't cause you too much trouble.
Personally, I'd go with Django and React with PostgreSQL and probably Bootstrap, because that's what I know. I would be running on my domain on day 1.
What frameworks would have you and your team up and running on day 1? Pick those.
Most known and good frameworks can do what you want. If the product becomes succesfull, scaling up your team with good engineers is harder than scaling the product.
As long as you can do raw queries on your complex database, I do not see how a backend framework you don’t know yet will help you. You will sell the product, not the framework it is running on. If your current stack is still widely used in the industry, focus on the product, not on new tech
Small addition: if it is for hobby or learning: pick one new framework and keep the rest of the stack.
If you ask me to build a web app, I'll role with Flutter Web and Firebase for hosting / auth/ data storage.
But your sorta limited with that. Vue is cool too
https://jumpstartrails.com/
Host on Heroku.
The boilerplate features are covered. Productive developer patterns are already in place. Great test coverage.
You can jump right in to building out the business logic.
- Backend: Express + Sequelize + Postgres
- Frontend: Svelte + TailwindCSS + Webpack
Do I need to iterate very quickly on the database schema? Use a document DB like MongoDB (JSONB on PG is great but has caveats such as atomicity)
Do I need to handle a high volume of background jobs? throw Redis into the mix.
Do I want HA? Make the app stateless (JWTs help in this case but come with their own caveats), duplicate the server 2 more times and put a cloud load balancer in front of all 3 servers.
Do I need to serve low bandwidth or low power devices? I go vanilla JS and limit how much interactions does the page have, or move to server-side rendering only altogether.
And the list goes on. But with no specific constraint, my personal preference goes to that initial stack (and I’m very productive in it).
I know it so I can develop relatively quickly with it plus it has so much built in already.
It's also a mature framework so chances of running into bugs for normal tasks is lower than newer/cutting edge and if I do need help there are high chances that someone else has already dealt with it.
Deployment and scaling can also be taken care of by something like Heroku which already supports Django so I can best use my time focusing on the development of valuable business logic rather than reinventing the wheel and maintenance.
backend: python flask, sqlalchemy
frontend: react, bootstrap