News for hackers. Stuff that matters.
Re:Ask HN: Go-to web stack today? by luord on Saturday January 05, 2019 @07:23AM (#18831296)
First, be entirely sure that you actually need an SPA.

So, in stages:

- Database: Postgres (you could start with any relational DB, Postgres is just one of the best). It's very, very likely that your model is gonna be relational so better pay that debt upfront. Don't even consider NoSQL this early; we're paying a heavy price on my current job because the initial developers bought that non-relational databases were better at prototyping. Worry about NoSQL and consider switching to any of those if you see, once you release, that the type of data you're handling is more of a stream of mostly independent records than an actual model.

- Like I said, make sure that you actually need an SPA. It's likely that you don't and in that case you can get away with using Django; it gives you pretty much everything you could possibly need.

- If you're dead set on a SPA, go for a more lightweight framework geared towards creating REST APIs. The usual recommendation is flask with any of the rest extensions, but there are other options such as falcon or molten (which is recent, but really well designed).

- Since this is a SPA, use Vue. I find it to be leagues ahead of the js frameworks when it comes to striking a balance between power, expressiveness and ease of use. Much like Flask in the backend, for that matter.

- Dockerize. I don't like promoting a specific tool in this area but docker will make it very easy to develop and deploy your application (also makes it easier to implement the usual suspects like a reverse proxy, a queue, a cache, etc) without having to rely --and thus essentially marry-- any specific tool provided by a given cloud platform.

- Use gitlab for version control. They give continuous integration and private repos for free out of the box.

Re:Ask HN: Go-to web stack today? by Fre_d on Saturday January 05, 2019 @08:44AM (#18831585)
At least briefly consider whether or not you actually need a relational database when starting a project. I work with some rather complex data access using Postgres, JPA, Hibernate, HikariCP, and a second level cache, all within a separate microservice exposed via a REST API. To make matters worse, the responsible developer has since left the project to me.

We don't even use relations, so this essentially means that we are paying a hefty price for something that we don't actually need. A much simpler solution would be to have used MongoDB together with Spring Data, where we can still have caching and object mapping.

Re:Ask HN: Go-to web stack today? by owens99 on Saturday January 05, 2019 @09:47AM (#18831885)
I would personally never use MongoDB again. Broke one too many times. Postgres on the other hand has never failed me.
Re:Ask HN: Go-to web stack today? by Fre_d on Saturday January 05, 2019 @10:33AM (#18832102)
MongoDB was released nearly 10 years ago. Do you believe those issues are still relevant today?
Re:Ask HN: Go-to web stack today? by aeonflux on Saturday January 05, 2019 @10:49AM (#18832187)
If that’s the argumentation then Postgres is over 22 years old which makes it over two times better? On the other hand Windows is over 30 years old and it still hasn’t fixed many issues which for me are the reasons why I don’t want to have anything to do with it.
Re:Ask HN: Go-to web stack today? by Fre_d on Saturday January 05, 2019 @10:56AM (#18832232)
I'm not saying MongoDB is better because it is old, and I was rather hoping you would elaborate. For all I know, you could have had issues with it yesterday or 9 years ago.
Re:Ask HN: Go-to web stack today? by owens99 on Monday January 07, 2019 @05:54PM (#18851122)
I haven't tried it in 4 years myself. But I invested in a company that just launched their product two months ago and already regrets building it on Mongo.
Re:Ask HN: Go-to web stack today? by aeonflux on Saturday January 05, 2019 @10:17AM (#18832016)
Same. I went on hype train, got burned badly and I am never going to use MongoDB again.
Re:Ask HN: Go-to web stack today? by pjmlp on Saturday January 05, 2019 @10:30AM (#18832085)
I would turn the remark around and say that one should consider if a NoSQL database is required at all.
Re:Ask HN: Go-to web stack today? by AYBABTME on Saturday January 05, 2019 @09:48AM (#18831891)
What would Mongo give you that Postgres doesn't?
Re:Ask HN: Go-to web stack today? by snazz on Saturday January 05, 2019 @10:33AM (#18832101)
Non-relational (NoSQL) databases like Mongo serve a different purpose. They store data in forms other than the traditional relational database table. Theoretically, for certain workloads, they make horizontal scaling easier and improve availability. However, most workloads are suited just fine with a relational database like Postgres.
Re:Ask HN: Go-to web stack today? by andrewguenther on Saturday January 05, 2019 @11:52AM (#18832646)
Postgres also had document store functionality and for many workloads performs better than Mongo. In my personal experience, Postgres is better at being Mongo than Mongo.
Re:Ask HN: Go-to web stack today? by Fre_d on Saturday January 05, 2019 @10:30AM (#18832084)
Admittedly I'm not yet using it in production, but the simplicity is the most appealing factor, albeit this depends a lot on client libraries used. In addition to my original comment, with Postgres we also had to deal with schemas and migrations.

We can also easily leverage reactive streams with reactive Spring Data. Technically you could also use JDBC in a reactive manner, but it looks unlikely to work with the frameworks we use with Postgres.

Re:Ask HN: Go-to web stack today? by aeonflux on Saturday January 05, 2019 @10:45AM (#18832165)
If simplicity and lack of migrations is the only advantage of MongoDB then there is no reason to use it in place of Postgres, since you can just use JSONB instead and not worry about any of those.
Re:Ask HN: Go-to web stack today? by jacques_chester on Saturday January 05, 2019 @10:54AM (#18832214)
> with Postgres we also had to deal with schemas and migrations.

Schemata are good things. Migrations are the database insisting on tedious bureaucratic nonsense like "don't blow your foot off" and "don't regret this later".

> Technically you could also use JDBC in a reactive manner, but it looks unlikely to work with the frameworks we use with Postgres.

The Spring team are pretty keen on removing that gap: http://r2dbc.io/

Re:Ask HN: Go-to web stack today? by luord on Saturday January 05, 2019 @04:26PM (#18834374)
> with Postgres we also had to deal with schemas and migrations.

JIC, this is exactly what I meant with "paying that debt upfront". If your model does turn out to be relational and you don't have this, you are going to get burnt, badly.