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/
202•todsacerdoti•8h ago

Comments

monadoid•7h ago
This is well written, thanks!
cr125rider•7h ago
Litestar is awesome. It’s great it’s got more than a single maintainer too.
ddejohn•7h 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•7h ago
Good to see it using port 8000 as default, and not Flasks 5000 (does not work on Mac anymore)
femtozer•5h ago
I wasted a couple of hours recently before realizing that AirPlay was using port 5000...
hnuser123456•7h ago
It's a python web framework, for those curious to know more before clicking through.
LigmaBaulls•7h ago
thanks, saved me some time.
NeutralForest•7h 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•7h 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.
SalmoShalazar•4h ago
Mind elaborating a bit on why you migrated away from django ninja? Just curious, I’ve been using it for some small side projects and have enjoyed it.
sambaumann•7h 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•7h ago
I usually just use asyncpg.
MitPitt•7h ago
You can use asyncpg in SQLAlchemy
jessekv•6h ago
Yep! But I don't.
jg0r3•1h ago
Lol same, writing SQL and directly wrangling Async connection pools always seemed way easier for me than trying to jam sqlalchemy into whatever hole I'm working with.
WD-42•5h ago
The most interesting thing about this project to me is that it appears to alleviate some of the warts of working with SqlAlchemy.

Pretty much every time I start a project that needs a DB I just use Django. SqlAlchemy and Alembic are usually not worth dealing with.

hariwb•7h 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•6h ago
I am really disappointed at the new generation of Python frameworks' documentation, which seem to have the same "docs are tutorials + chatty blog posts which imprecisely describe the APIs" attitude of Javascript libs.

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.

rmonvfer•5h ago
This, I’ve already said it in another reply but FastAPI is 10x harder to use because of this. I’ve had to read FastAPI code many times to literally reverse engineer features because they are not documented in any way.

Documentation is for reference, tutorials are for learning, I just don’t even understand how maintainers don’t go crazy with the absolute lack of references…

And SQL Model is even worse in that regard.

rtpg•4h ago
maintainers just having to assume every behavior is needed for backwards compatibility... and you still have the absolute mess which was pydantic 1 -> 2 (or django-ninja 0.x -> 1.0)

Everyone talks about moving fast and being dynamic but everyone I know deep in this has lost like actual years to churning from this kind of behavior.

cbzbc•7h ago
How do people deploy this framework typically - speaking for myself, I found NGINX Unit somewhat fiddly.
devjab•7h ago
With uvicorn.
intalentive•7h ago
uvicorn systemd service behind nginx reverse proxy
indigodaddy•6h ago
Or just docker/uvicorn
intalentive•6h 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•6h ago
It definitely seems worth checking out. I've been using FastAPI for a few years now.
thewisenerd•6h 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•6h 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•6h 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...
sureglymop•4h ago
Looking at the docs and trying to figure out what this is for. Is it essentially when you want to break out of the "request lifecycle" and queue something to run after your response has already been returned?

It strikes me that I haven't used web frameworks a lot and never even questioned how that may not be an easy thing to do!

miki123211•5h ago
TBH, the FastAPI "docs" are at https://github.com/polarsource/polar/tree/main/server

If you want to actually figure out how to scale FastAPI for a large-ish app, including auth, testing and all that stuff, all with modern practices, "how they do it in that repo" is probably a good way to start with.

ilumanty•5h ago
FastAPI used to have an emoji-ridden docs page for concurrency. Criticism was not handled well.

This made it clear to me that something about the project is off.

https://github.com/fastapi/fastapi/discussions/6656

stackskipton•5h ago
Tiangolo is type who wants to do it his way without a ton of input . One of reasons Litestar was developed.
rmonvfer•5h ago
Thank you! I’m actually pretty happy with what I’ve built tbh and how far has FastAPI taken us but this repo is proof that you have to reinvent the wheel if you want to build something serious.

In any case, that’s a treasure trove right there!, I actually had no idea Polar was open source, much less that it’s built on FastAPI!

It’s such a shame that the actual documentation doesn’t even scratch the surface, I would’ve saved so much time if they just included a disclaimer along the lines of “Hey, this architecture we are showing here it’s only valid for toy projects, you will need much more work to build a real production system” but again, I guess I’m the only one to blame.

no_carrier•5h ago
> Then came the SQLModel problems. The author pushes it very hard in the FastAPI docs

No it doesn't? The front page for FastAPI contains a pretty lengthy tutorial with no mention of SQLModel. The only time SQLModel gets a significant mention is on a page explaining connecting a relational DB, but it makes it clear that any DB at all can be used. Something has to be chosen for the tutorial, so it makes sense the author would choose their own.

If SQLModel isn't right for you then you're the only person to blame. I've been through that tutorial before and settled on plain old SQLAlchemy.

canadiantim•4h ago
Doesn't Litestar suffer from some of this too? Do you think Litestar would be better for building complex applications than FastAPI, despite less community adoption / documentation / discussion?
croemer•3h ago
Is there really less documentation? FastAPI mostly has tutorials to get started and is light on deep/reference material. A single person can only do so much.
canadiantim•3h ago
Documentation-wise I'm mainly comparing to Django, because I agree FastAPI actually quite light on reference docs too.

I've actually tried using litestar before and always been keeping an eye on it, but for a full fledged website needing forms, auth, etc. I find it hard to move away from just slightly tweaking Django for my needs - but still I feel drawn to Litestar as it's in between FastAPI and Django but still much closer to the former. I hope/believe in time I will feel comfortable migrating to Litestar for complex sites

kreelman•1h ago
I'm starting out with API style apps. This post was great since it covered several architectural and tool points I'd not thought of.

I think I'll use LiteStar for my app now too.

Thanks for your good comment and I 2nd your thanks to the author.

andrewstuart•6h 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.

hangonhn•3h ago
Huge fan of Starlette too. I use it for all my projects at work. That said, for some of my coworkers, I’ve pointed them to Litestar because it’s very similar to Starlette (I think it was originally built on it) but it has dependencies injection. It’s an useful feature for some projects.
zokier•5h ago
I know fastapi gets the hype, but I have found plain starlette quite usable by itself. Sure, it doesn't have the whole kitchen sink, but if you just need something small and simple then it fits the bill. In comparison Litestar seems closer to fastapi/django in scope
holler•1h ago
Same, I've built all my recent api's in Starlette alone and I find it excellent. It's clean, concise, well documented, and you can extend it as needed, supporting small -> very large projects.
rick1290•5h ago
How does this compare to Django? I see you have quite a bit of Django content. How would you decide to use Litestar vs Django on a new greenfield project?
davepeck•5h ago
I think Litestar is superb for building API backends. Love it; use it; only good things to say. Their Advanced Alchemy is coming along nicely, too.

Litestar of course supports old-school server-template-rendered sites, too; it even has a plugin for HTMX requests and responses. In practice, I find that the patterns that serve API endpoints so well sometimes get in the way of old-school "validate form and redirect, or re-render with errors" endpoints. In particular, Litestar has no "true" form support of its own; validation is really intended to flag inbound schema mismatch on API calls, not flag multiple individual error fields. Using `@post("/route", exception_handlers={...})` is pretty awkward for these endpoints. I'd be excited to see some better tools/DX in-the-box here.

androiddrew•5h ago
When I look at a litestar all it feels a lot more planned out and patterned. I wish I was better at async.

I’ve recently converted to Golang, but I’d love to come back and do a litestar app in the future.

jaza•3h ago
Nice write-up! I've heard about Litestar now and then, haven't tried it, maybe I should give it a go. I've been using FastAPI quite heavily for the past several years.

I think OP's arguments about FastAPI being hard to work with in a bigger codebase are exaggerated. Splitting up the routes into multiple files, each with its own route object, and then importing and building up a big hierarchy of route objects, isn't that hard, it does the job for me. Agreed that it's probably not well documented enough, how to structure a larger FastAPI codebase - but follow a mix of best practices and your personal tastes, break it up into modules, split it into specific files for constants / errors / routes / schemas / crud / etc, and you can scale up sanely.

I haven't used SQLAlchemy with FastAPI - for my day job I mainly connect to data stores for which it doesn't make sense - so maybe I'm biased, because I've avoided that pain.

baggiponte•2h ago
Litestar is really underrated but deserves much more usage! I’ve been meaning to try it for at least a year now, but always felt a bit scary to tell the team “hey let’s deviate from our stack”
dtkav•36m ago
Connexion is also worth a look IMO. It uses spec-first development (a major benefit in larger orgs and for public APIs), and can plug into different server frameworks.

(I used to be a maintainer, but it has been years since I worked on it).

8organicbits•14m ago
> So if you’re going to be writing a database-backed web application in Python, and you’re not doing Django, you are almost certainly going to be using SQLAlchemy.

I've preferred the Django ORM over SQLAlchemy, but I'm curious what others feel. I've gone so far as to use Django ORM for non-web projects as well. It takes a bit of work to extract though. If Django ORM had a better stand-alone story, I think more people would use it.

Mac history echoes in current Mac operating systems

http://tenfourfox.blogspot.com/2025/08/mac-history-echoes-in-mac-operating.html
42•classichasclass•1h ago•7 comments

Claude Code IDE integration for Emacs

https://github.com/manzaltu/claude-code-ide.el
591•kgwgk•14h ago•194 comments

Rules by Which a Great Empire May Be Reduced to a Small One (1773)

https://founders.archives.gov/documents/Franklin/01-20-02-0213
82•freediver•4h ago•28 comments

A Candidate Giant Planet Imaged in the Habitable Zone of α Cen A

https://arxiv.org/abs/2508.03814
26•pinewurst•2h ago•9 comments

Project Hyperion: Interstellar ship design competition

https://www.projecthyperion.org
163•codeulike•7h ago•136 comments

Litestar is worth a look

https://www.b-list.org/weblog/2025/aug/06/litestar/
202•todsacerdoti•8h ago•50 comments

Running GPT-OSS-120B at 500 tokens per second on Nvidia GPUs

https://www.baseten.co/blog/sota-performance-for-gpt-oss-120b-on-nvidia-gpus/
9•philipkiely•1h ago•0 comments

The Day MOOCs Died: Coursera's Preview Mode Kills Free Learning

https://www.classcentral.com/report/coursera-preview-mode-paywall/
38•deepakkarki•3d ago•21 comments

More than two hard disks in DOS

https://www.os2museum.com/wp/more-than-two-hard-disks-in-dos/
7•userbinator•3d ago•1 comments

We'd be better off with 9-bit bytes

https://pavpanchekha.com/blog/9bit.html
104•luu•8h ago•193 comments

Show HN: Kitten TTS – 25MB CPU-Only, Open-Source TTS Model

https://github.com/KittenML/KittenTTS
791•divamgupta•23h ago•322 comments

Jules, our asynchronous coding agent

https://blog.google/technology/google-labs/jules-now-available/
242•meetpateltech•12h ago•164 comments

Writing a Rust GPU kernel driver: a brief introduction on how GPU drivers work

https://www.collabora.com/news-and-blog/blog/2025/08/06/writing-a-rust-gpu-kernel-driver-a-brief-introduction-on-how-gpu-drivers-work/
224•losgehts•12h ago•28 comments

You know more Finnish than you think

https://dannybate.com/2025/08/03/you-know-more-finnish-than-you-think/
63•infinate•2d ago•29 comments

A fast, growable array with stable pointers in C

https://danielchasehooper.com/posts/segment_array/
144•ibobev•9h ago•58 comments

The Bluesky Dictionary

https://www.avibagla.com/blueskydictionary/
119•gaws•7h ago•41 comments

Apple increases US commitment to $600B, announces American Manufacturing Program

https://www.apple.com/newsroom/2025/08/apple-increases-us-commitment-to-600-billion-usd-announces-ambitious-program/
30•Zenbit_UX•4h ago•13 comments

301party.com: Intentionally open redirect

https://301party.com/
69•nahikoa•7h ago•13 comments

Multics

https://www.multicians.org/multics.html
102•unleaded•11h ago•21 comments

Out-Fibbing CPython with the Plush Interpreter

https://pointersgonewild.com/2025-08-06-out-fibbing-cpython-with-the-plush-interpreter/
23•Bogdanp•4h ago•0 comments

Comptime.ts: compile-time expressions for TypeScript

https://comptime.js.org/
104•excalo•3d ago•17 comments

A Man Who Beat IBM

https://every.to/feeds/b0e329f3048258e8eeb7/the-man-who-beat-ibm
45•vinnyglennon•3d ago•15 comments

Show HN: HMPL – Small Template Language for Rendering UI from Server to Client

https://github.com/hmpl-language/hmpl
7•aanthonymax•17h ago•5 comments

Breaking the sorting barrier for directed single-source shortest paths

https://www.quantamagazine.org/new-method-is-the-fastest-way-to-find-the-best-routes-20250806/
139•baruchel•13h ago•43 comments

The Inkhaven Blogging Residency

https://www.inkhaven.blog/
29•venkii•3h ago•29 comments

Zig Error Patterns

https://glfmn.io/posts/zig-error-patterns/
124•Bogdanp•13h ago•33 comments

Automerge 3.0

https://automerge.org/blog/automerge-3/
253•surprisetalk•3d ago•22 comments

303Gen – 303 acid loops generator

https://303-gen-06a668.netlify.app/
181•ankitg12•15h ago•62 comments

Rethinking DOM from first principles

https://acko.net/blog/html-is-dead-long-live-html/
192•puzzlingcaptcha•21h ago•171 comments

AI in Search is driving more queries and higher quality clicks

https://blog.google/products/search/ai-search-driving-more-queries-higher-quality-clicks/
47•thm•10h ago•64 comments