79 comments

[ 4.0 ms ] story [ 67.6 ms ] thread
It sounds like they are just saying they should have used the tool they were most familiar with on day 1.
Looks like last week was coding week, current one is marketing week.
Django is massive and ton of baggage to be carrying if you are only doing REST APIs.

This sounds like standard case going with what developers know instead of evaluating tool for job.

Good decision, judging by their general level of impatience with things they would have hated my ORM :).

Also I think the node approach is probably still more performant than FastAPI but that's just a hunch.

Hopefully they won't have security issues because someone hijacked the node package that sets the font color to blue or passes the butter or something.

"Python async sucks", then rants about django

"Python doesn't have native async file I/O." - like almost everybody, as "sane" file async IO on Linux is somehow new (io_uring)

Anyway ..

Sane async does not need io_uring. All the non-linear-time select(2) alternatives are good enough.
Is this 2015?
I am curious, what is the latest and greatest language/framework that they should have used from the start?
That's good. Should've ditched the ORM too.
TL;DR

>I'll preface this by saying that neither of us has a lot of experience writing Python async code

> I'm actually really interested in spending proper time in becoming more knowledgeable with Python async, but in our context you a) lose precious time that you need to use to ship as an early-stage startup and b) can shoot yourself in the foot very easily in the process.

The best advice for a start-up is to use the tools that you know best. And sometimes that's not the best tool for the job. Let's say you need to build a CLI. It's very likely that Go is the best tool for the job, but if you're a great Python programmer, then just do it in Python.

Here's a clearer case where the author was not very good with Python. Clearly, since they actually used Django instead of FastAPI, which should have been the right tool for the job. And then wrote a blog post about Python being bad, but actually it's about Django. So yeah, they should have started with Node from day one.

I would have picked Hono and Drizzle. In part because of the great TS support but also Hono is much faster than Express and supports Zod for validation out of the box. This stack would also allow to use any other runtime (Deno, Bun, or Cloudflare Workers).

Given they used TS and performance was a concern I would also question the decision to use Node. Deno or Bun have great TS support and better performance.

djanko (sic) out fastapi in
When they start moving away from API calls to third parties to their own embeddings or AI they’re in for a bad time.

What’s going to end up happening is they’ll then create another backend for AI stuff that uses python and then have to deal with multiple backend languages.

They should have just bit the bullet and learned proper async in FastAPI like they mentioned.

I won’t even get started on their love of ORMs.

Who is the audience for a post like this? Presumably HN, since the author invoked PG.

But who is "we rewrote our stack on week 1 due to hypothetical scaling issues" supposed to impress? Not software professionals. Not savvy investors. Potential junior hires?

I probably would have pushed for Hono as the underlying framework... That said, I've been a fan of Koa/Oak over Express for a very long time. For API usage, the swagger+zod integration is pretty decent, though it changes the typical patterns a bit.

All-in, there's no single silver bullet to solving a given issue. Python has a lot of ecosystem around it in terms of integrations that you may or may not need that might be harder with JS. It really just depends.

Glad your migration/switch went relatively smoothly all the same.

As a long-time Django user, I would not use Django for this. Django async is probably never the right choice for a green-field project. I would still pick FastAPI/SQLAlchemy over Express and PostHog. There is no way 15 different Node ORMs are going to survive in the long run, plus Drizzle and Prisma seem to be the leaders for now.
FastAPI/SQLAlchemy won’t be more scalable than a typical Django setup. The real bottleneck is the threading model, not the few microseconds the framework spends before handing off to user code. Django running under uWSGI with green threads can outperform Go-based services in some scenarios, largely thanks to how efficient Python’s C ABI is compared to Go.
Same experience working on FastAPI projects. I don’t know how big production apps are maintained (and supported operationally) with the mess that is python+async+types.

Conversely all the node+typescript projects, big and small, have been pretty great the last 10+ years or so. (And the C# .NET ones).

I use python for real data projects, for APIs there are about half a dozen other tech stacks I’d reach for first. I’ll die on this hill these days.

Async and Django don't mix well and I honestly see the whole Django Async as wasted resources, all those "a" prefixed functions etc.

To be honest, I never liked the way async is done in python at all.

However, I love Django and Python in general. When I need "async" in a http cycle flow, I use celery and run it in background.

If client side needs to be updated about the state of the background task, the best is to send the data to a websocket channel known to the client side. Either it's Chat response with LLM or importing a huge CSV file.

Simple rule for me is, "don't waste HTTP time, process quick and return quick".

Do we still need ORMs in the age of AI-assisted coding?

I started ripping them out of a java system even before that.

"we almost quit multiple times"

It was a three day small task?

Probably because they have to deal with customer feedbacks and bugs on existing system. The stress would be huge, making a day like a week long, I guarantee
nodejs excels for me on flow control

theres effectts if you need app level control

theres caolan async if you need series and parallel controls

theres rxjs if you need observables

on web frameworks hono seems nice too. if you need performance, theres uwebsockets.js which beats all other web frameworks in http and websocket benchmarks.

for typesafety aside from typescript, theres ark, zod, valibot, etc.

I do a lot of glueware and semi-embedded stuff with Python... but my goto these days for anything networky is Elixir (LiveView if ux). If I need an event loop, async that is more than a patched on keyword, it just rocks. It is amazing to me how much Elixir does not have, and yet how capably it solves so many problems that other languages have had to add support for to solve.
So basically you just rewrote boilerplate code with complexity of "hello world" and deploy scripts. Without any dependencies, data migrations, real user data and downtime SLA. And after that you had time to write quite long article.

What honest reaction you expect from readers?

It is true that Python's typing and async support feels like someone adding extension to a house that was built 50 years ago.
Folks, if you have problems doing async work, and most of your intense logic/algorithms is a network hop away (LLMs, etc.), do yourself a favor and write a spike in Elixir. Just give it a shot.

The whole environment is built for async from the ground up. Thousands and thousands of hours put into creating a runtime and language specifically to make async programming feasible. The runtime handles async IO for you with preemptive scheduling. Ability to look at any runtime state on a production instance. Lovely community. More libraries than you might expect. Excellent language in Elixir.

Give it a shot.

Can someone explain a plebian C/python/java/go programmer with good idea about languages & runtimes:

==> what makes erlang runtimes so special which you don't get by common solutions for retries etc?