frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Litestar is worth a look

https://www.b-list.org/weblog/2025/aug/06/litestar/
95•todsacerdoti•2h ago

Comments

monadoid•1h ago
This is well written, thanks!
cr125rider•1h ago
Litestar is awesome. It’s great it’s got more than a single maintainer too.
ddejohn•1h ago
Excellent post that actually gets into important details for real-world applications. I'm a huge fan of the design of Litestar.

> I also still think there are a lot of bad use cases for repositories and service layers that people should avoid, but that’s a digression which should probably become its own post

As a huge proponent of the repository pattern, I'll be looking forward to this post.

punnerud•1h ago
Good to see it using port 8000 as default, and not Flasks 5000 (does not work on Mac anymore)
hnuser123456•1h ago
It's a python web framework, for those curious to know more before clicking through.
LigmaBaulls•1h ago
thanks, saved me some time.
NeutralForest•1h ago
Pretty cool post! I'm not sure how I feel about SQLAlchemy (not the star of the post but mentioned quite a bit); it's such a big ball of state that has so many surprises, I wonder if some people build entirely without it.
devjab•1h ago
There is a rather big difference between traditional SQLAlchemy and Advanced Alchemy which is also made by Litestar. We've build with pure SQL and with SQLAlchemy in the past, but since we transitioned from django ninja to Litestar, we've not used SQLAlchemy and are slowly moving away from it. Well I guess Advanced Alchemy is still SQLAlchemy under the hood.
sambaumann•1h ago
I recently built a personal project using peewee and it doesn't have a ton of bells and whistles but it works well for what it does do.
jessekv•1h ago
I usually just use asyncpg.
MitPitt•1h ago
You can use asyncpg in SQLAlchemy
jessekv•21m ago
Yep! But I don't.
hariwb•1h ago
Thanks for writing this. I have similar gripes about FastAPI having developed an application over the past few years; I'm also continually surprised at how prevalent the attitude is that FastAPI has excellent docs, given how divorced the tutorial / toy examples in the docs are from real-world development and measurement of an API.
rtpg•2m ago
I am really disappointed at the new generation of Python frameworks' documentation, which seem to have the same "the only doc pages that matter are tutorials, and everything is written in a chatty style" attitude of Javascript frameworks.

Two words: API Reference.

Have the clinical explanation of methods exposed, with actual breakdowns of what method parameters do. List them all, don't surround it by prose. List out the options! Don't make me dive into the source to find out what I can or can't pass into a parameter!

Having to play this game of "alright I want to know how to use this API, so first I need to figure out what tutorial page _might_ use this" to find the tiny examples that should just be next to the methods I care about in the reference is really frustrating.

cbzbc•1h ago
How do people deploy this framework typically - speaking for myself, I found NGINX Unit somewhat fiddly.
devjab•1h ago
With uvicorn.
intalentive•1h ago
uvicorn systemd service behind nginx reverse proxy
indigodaddy•59m ago
Or just docker/uvicorn
intalentive•53m ago
I've been using Litestar for over a year now, serving both JSON and templated HTML. Great all-around Python async framework that manages to be fast (faster than FastAPI), lightweight, and still has enough batteries included to host a website with auth, sessions, etc. I'm a fan of first-class msgspec support and the Controller class for nested routing.

Highly recommend.

icedchai•27m ago
It definitely seems worth checking out. I've been using FastAPI for a few years now.
thewisenerd•52m ago
love litestar.. working on migrating a couple of internal consoles to it from fastAPI.

the docs could use some love though.

i feel most of it is references [1], the "how to"s could be better.

inb4, "where pull request", i don't grok asgi or the framework nuances to be able to say how to improve on it.

[1] https://diataxis.fr/

rmonvfer•18m ago
Thank you for writing this, I've been building a large backend with FastAPI for the last year or so and I've gone through all the levels of the purgatory.

I began using the standard "tutorial" style and started cringing when I saw the official template [1] place all CRUD operations in a single file (I've been doing Rails and Spring for a while before) and the way dependencies where managed... let's just say I wasn't feeling very comfortable.

Then came the SQLModel problems. The author pushes it very hard in the FastAPI docs (which imho are terrible because when I'm looking for docs I want that, documentation, not a fancy tutorial) but as an ORM (yes I know its a layer on top of SQLAlchemy) it doesn't even support polymorphic models and the community even has contributed PRs that have gone months without any review (is it even maintained anymore? I honestly can't tell).

I guess I'm the only one to blame for choosing FastAPI to build a big project but after having used it quite a lot (and also read its code because again, docs are extremely poor) I wouldn't recommend it for anything serious. Sure, if you want to build a quick CRUD then go ahead and use SQLModel and FastAPI, but keep in mind that its not built for complex applications (at least not without requiring you to write a framework on top, like I've unfortunately done).

So yeah, a big thank you to the author of this post because I will migrate to Litestar as soon as I wake up tomorrow.

rmonvfer•16m ago
edit: reading the litestar docs, it even has a built-in event system! I spent a couple weeks building something I could use with FastAPI...
andrewstuart•15m ago
I love Starlette but not a fan of FastAPI and do not use it.

I read this article but didn’t really get the sense there was anything sufficiently compelling to switch from Starlette.