News for hackers. Stuff that matters.

Ask HN: What tech-stack would you use for the following?

Lot of questions appear on HN about which tech-stack to use. So I thought let us all do a thought experiment together. I collected most common features required by apps today(you can suggest additional features, and I will include them in the post), and came up with a hypothetical product. Say, we want to develop a platform with the aim of monetising it and later scaling it to millions of users. The product has following requirements to start with:

0. A user should be able to login via various methods: username/password, finger-print, face-recognition. Login should support 2FA.

1. A user should be able to create a:

  1.1. Post.

    1.1.1 A post could have an optional title.

    1.1.2 A post could have optional tags.

    1.1.3 A post could be edited later.

    1.1.4 A post could be hidden by creator.

    1.1.5 Multiple creators could collaborate on a post; and a post could be moderated.

    1.1.6 A post could have comments and up/down votes.

    1.1.7 A post could be reported by users to the moderators of the platform.

    1.1.8 A user can mark a post as favourite.

  1.2. Request for post.

    1.2.1 A user can request a post on a topic from other users on the platform.

    1.2.1 As with the post, the request can have similar features e.g. title, tags, votes, comments etc.
3. A user can create a group; posts and requests can be posted to a group.

4. A group could be moderated, private, open, or invite-only.

5. Users will earn karma/points for the content they create and the upvotes they receive.

6. Users can create tags that they can use with a post or request. These tags will be available to others too.

Now, this is the basic requirement. But we are ambitious and we dream of building a platform that millions of users will use everyday. And we want to build more features into this platform later on; like specifying Authorisation for users, Real-time text, audio and video communication, collaborative editing, casual multi-player games like snakes-and-ladder, multilingual support, and support for web and native platforms like mobile and desktop. We also want a mechanism where multiple users can share an account, if required. Allow real-time notifications. Also, when we become a unicorn (heck, why not dream big ;)) we want users to be able to contact support using the platform. Later on we also want to do analytics, and also want users to know their history on the platform. And last but not the least, we want to add payments support where users will be able to pay each other for the content and the platform takes commission on each transaction.

Now, keeping these requirements in mind, and the often repeated mantra on HN that one should use the language and stack one knows best to start the project, my stack for the project is as follows(please suggest improvements to this C/C++ based tech-stack if you think it can be better):

Backend: C and C++, uWs, cppgraphqlgen, sqlpp11, postgresql(with pgpool, postgis, patroni, pgbouncer, greenplum), rethinkdb and haproxy.

Frontend: Flutter

What would be your tech-stack for this hypothetical project? Please chime in. Let the crowd be educated :)

( 9 comments | 7 points | on HN )
Re:Ask HN: What tech-stack would you use for the following? by willy_k on Monday September 05, 2022 @09:54PM (#32731756)
Sounds like a perfect application for an MVC framework. RoR is the most popular, but I would recommend Phoenix (and Elixir) for your project, specifically because you mentioned that scaleability was important to you, and Elixir has a very powerful concurrency and scaling model, as well as a bunch of other features from Phoenix that would benefit your project.
Re:Ask HN: What tech-stack would you use for the following? by alex14fr on Monday September 05, 2022 @08:40AM (#32723625)
Backend: PHP/MySQL Frontend: HTML, Vanilla JS
Re:Ask HN: What tech-stack would you use for the following? by _448 on Monday September 05, 2022 @08:42AM (#32723641)
And how about scaling this later on? What other things will be required to scale this.
Re:Ask HN: What tech-stack would you use for the following? by benstopics on Tuesday September 06, 2022 @07:57AM (#32735887)
You could scale the API with Kubernetes and MySQL with Vitess off-the-shelf or architect the sharding yourself. My only concern with MySQL would be that, contrary to PostgreSQL, you can’t rollback DDL statements which makes migrations a PITA, but this is true at all stages and unrelated to scaling. I find it interesting PHP was mentioned since it gets a bad wrap. I personally think it isn’t that great of a programming language but if it’s what you’re familiar with then more power to you. It’s like if someone said you could articulate ideas in French much better than in English, because it has words for things that English doesn’t, I’d still write a better book in English than French. Although, if you understand the fundamentals of programming languages, then learning a new one, especially a high-level OOP one, doesn’t take that long.
Re:Ask HN: What tech-stack would you use for the following? by cxr on Monday September 05, 2022 @04:08PM (#32728837)
You are (presumably inadvertently) mirroring a character who is the butt end of the joke in a well-known meme.

<https://www.youtube.com/watch?v=b2F-DItXtZs>

Re:Ask HN: What tech-stack would you use for the following? by c7b on Monday September 05, 2022 @11:26AM (#32725340)
Great discussion question! It's also interesting for people moving into web development to see what experienced devs think about this - the sheer quantity of tools and their fast-changing nature can seem quite overwhelming at first.

I just asked a related question [0], if you have any beginner-focussed opinions would appreciate :)

[0] https://news.ycombinator.com/item?id=32724950

Re:Ask HN: What tech-stack would you use for the following? by swah on Monday September 05, 2022 @01:17PM (#32726691)
In my case maybe Typescript + NodeJS + Prisma, rewrite the hot paths later in C++ (actually: Go) services.
Re:Ask HN: What tech-stack would you use for the following? by benstopics on Tuesday September 06, 2022 @08:25AM (#32736178)
My choice of techstack has nothing to do with the feature list because at the end of the day it is whatever gives you an advantage which is whatever you are better at than everything else so long as it has a rich third party library ecosystem to borrow from.

For the database I would choose PostgreSQL because you can rollback schema changes which you can’t in MySQL. SQL Server would also be good but it is more expensive which it is not always supported well depending on the platform, so you would end up gravitating towards Microsoft cloud services for convenience, which can get pricy if you’re not careful.

For the application layer I would pick either ASP.NET Core/C# if I was going the Microsoft route, otherwise Python all the way for everything. I admit that I always thought Python was comparable to PHP in terms of a terrible programming language, but I have discovered that the lack of types, similar to JavaScript, is it’s power. I will say in the wrong hands it will be a disaster for a large monolithic application due to lack of unit testing and clean code principles, and static typing is a great first line of defense from a regression testing standpoint. However, if you know what you’re doing, Python allows you to build infinitely complicated software at the speed of light which is exactly what a startup needs to be able to do: iterate as fast as you can. Build the MVP as fast as possible and user test it, and then go back and unit test as much as you can and also write e2e for the main workflows. If you don’t get into the habit of doing this, or don’t foresee yourself writing unit tests, avoid Python like the plague and stick to a typed programming language. I would not use your product at least because your site is going to go down at some point because a junior dev you hired had a typo and you were too tired or busy or lazy to properly review their code.

For frontend, React. I think any framework would be fine, including vanilla HTML/CSS/JS. I would vouch for any framework that has a lot of third party libraries, although the upside of React is how fast you can build things. I’ve heard of Angular and I’m sure there is so many more, if you’re familiar with it then you will probably be fine.

I know this is a hypothetical situation, but I think in reality you would not really know what all features your users want from the getgo because you have no users yet. One thing I noticed, and I know this is more to do with picking techstacks than a discussion on product market fit, but what is the problem you are trying to solve? It seems like you have a product in mind that you are trying to find a problem for it to solve, which is not recommended. Assuming this hypothetical scenario is in present day, it sounds like you would have Facebook, Reddit, Hacker News, and a multitude of other platforms to compete with. The problem they are trying to solve is that people want to connect with other people. It is interesting to point out that they all solve that problem in similar but different ways and are better at connecting certain kinds of personalities better than others. So I’d just be interested in whether you have thought about a specific type if person you are thinking of or have met that would be better suited for your platform than the others available?

Re:Ask HN: What tech-stack would you use for the following? by benstopics on Tuesday September 06, 2022 @08:42AM (#32736324)
EDIT: I put a lot of emphasis on testing but didn’t mention what technologies I would use. For C# I would use XUnit or something similar there’s a few good ones. For integration testing specifically the db and api layers together I would use XUnit with a containerized docker compose of SQL Server and the application and maybe even use pytest to hit and assert the API, there are many ways you could do this. Same for the Python API, just use pytest and do what you need to do. For e2e I think Cypress is better than Selenium. Selenium is server/client based and requires more boiler plate code. Cypress can be ran as a command line tool, can record video per test, comes with an IDE and has a time travel feature. The only downside is that if you don’t understand React life cycle then the errors you get may be extremely difficult to troubleshoot. Most of the time it involves simplifying your state change events and reducing the number of asynchronous function calls. Selenium I have found is much more forgiving than Cypress, supports XPath out-of-the-box, and is a bit more forgiving when it comes to rendering. But in either product it would be recommended to wrap the base selector function in a while loop try catch which would eliminate this issue altogether.