frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Oxyde – Pydantic-native async ORM with a Rust core

https://github.com/mr-fatalyst/oxyde
39•mr_Fatalyst•3d ago
Hi HN! I built Oxyde because I was tired of duplicating my models.

If you use FastAPI, you know the drill. You define Pydantic models for your API, then define separate ORM models for your database, then write converters between them. SQLModel tries to fix this but it's still SQLAlchemy underneath. Tortoise gives you a nice Django-style API but its own model system. Django ORM is great but welded to the framework.

I wanted something simple: your Pydantic model IS your database model. One class, full validation on input and output, native type hints, zero duplication. The query API is Django-style (.objects.filter(), .exclude(), Q/F expressions) because I think it's one of the best designs out there.

Explicit over implicit. I tried to remove all the magic. Queries don't touch the database until you call a terminal method like .all(), .get(), or .first(). If you don't explicitly call .join() or .prefetch(), related data won't be loaded. No lazy loading, no surprise N+1 queries behind your back. You see exactly what hits the database by reading the code.

Type safety was a big motivation. Python's weak spot is runtime surprises, so Oxyde tackles this on three levels: (1) when you run makemigrations, it also generates .pyi stub files with fully typed queries, so your IDE knows that filter(age__gte=...) takes an int, that create() accepts exactly the fields your model has, and that .all() returns list[User] not list[Any]; (2) Pydantic validates data going into the database; (3) Pydantic validates data coming back out via model_validate(). You get autocompletion, red squiggles on typos, and runtime guarantees, all from the same model definition.

Why Rust? Not for speed as a goal. I don't do "language X is better" debates. Each one is good at what it was made for. Python is hard to beat for expressing business logic. But infrastructure stuff like SQL generation, connection pooling, and row serialization is where a systems language makes sense. So I split it: Python handles your models and business logic, Rust handles the database plumbing. Queries are built as an IR in Python, serialized via MessagePack, sent to Rust which generates dialect-specific SQL, executes it, and streams results back. Speed is a side effect of this split, not the goal. But since you're not paying a performance tax for the convenience, here are the benchmarks if curious: https://oxyde.fatalyst.dev/latest/advanced/benchmarks/

What's there today: Django-style migrations (makemigrations / migrate), transactions with savepoints, joins and prefetch, PostgreSQL + SQLite + MySQL, FastAPI integration, and an auto-generated admin panel that works with FastAPI, Litestar, Sanic, Quart, and Falcon (https://github.com/mr-fatalyst/oxyde-admin).

It's v0.5, beta, active development, API might still change. This is my attempt to build the ORM I personally wanted to use. Would love feedback, criticism, ideas.

Docs: https://oxyde.fatalyst.dev/

Step-by-step FastAPI tutorial (blog API from scratch): https://github.com/mr-fatalyst/fastapi-oxyde-example

Comments

throwawayffffas•3d ago
Lol I never knew django orm is faster than SQLAlchemy. But having used both that makes sense.

> Why Rust? ... Rust handles the database plumbing. Queries are built as an IR in Python, serialized via MessagePack, sent to Rust which generates dialect-specific SQL, executes it, and streams results back. Speed is a side effect of this split, not the goal.

Nice.

So what does it take to deploy this, dependency wise?

mr_Fatalyst•3d ago
Just pip install oxyde, that's it. The Rust core (oxyde-core) ships as pre-built wheels for Linux, macOS, and Windows, so no Rust toolchain needed. Python-side dependencies are just pydantic, msgpack, and typer for the CLI. Database drivers are bundled in the Rust core (uses sqlx under the hood), so you don't need to install asyncpg/aiosqlite/etc separately either.
kstrauser•1h ago
> Lol I never knew django orm is faster than SQLAlchemy.

I don’t believe that for a second. Both are wonderful projects, but raw performance was never one of Django ORM’s selling points.

I think its real advantage is making it easy to model new projects and make efficient CRUD calls on those tables. Alchemy’s strong point is “here’s an existing database; let users who grok DB theory query it as efficiently and ergonomically as possible.”

mr_Fatalyst•1h ago
I was surprised too when I saw the results. The benchmarks test standard ORM usage patterns, not the full power of any ORM. SQLAlchemy is more flexible, but that flexibility comes with some overhead. That said, the ORM layer is rarely the bottleneck when working with a database. The benchmarks were more about making sure that all the Pydantic validation I added comes for free, not about winning a speed race.
ForHackernews•1h ago
This sounds great and there's a real gap in the ecosystem for a tool like this. https://sqlmodel.tiangolo.com/ looked promising but it's actually worse than useless because if you add it to your Pydantic models, it disables all validation: https://github.com/fastapi/sqlmodel/issues/52
mr_Fatalyst•1h ago
Thanks! Yeah, that SQLModel issue is actually one of the things that pushed me to build this. In Oxyde the models are just Pydantic BaseModel subclasses, so validation always works, both on the way in and on the way out via model_validate().
roel_v•1h ago
Why would one want to couple these two? Doesn't that couple, say, your API interface with your database schema? Whereas in reality these are separate concepts, even if, yes, sometimes you return a 'user' from an API that looks the same as the 'user' in the database? Honest question, I only just recently got into FastAPI and I was a bit confused at first that yes, it seemed like a lot of duplication, but after a little bit of experience, they are different things that aren't always the same. So what am I missing?
mr_Fatalyst•1h ago
The ORM doesn't force you to use the DB model as your API schema. It's a regular Pydantic BaseModel, so you can make separate request/response schemas whenever you need to. For simple CRUD, using the model directly saves boilerplate. For complex cases, you decouple them as usual. The goal is not one model for everything, it's one contract. Everything speaks Pydantic, whether it's your API layer or your database layer.
whinvik•21m ago
Yeah I have always struggled to figure out why I would use SQLModel.

Big fan of FastAPI but I think SQLModel leads to the wrong mental model that somehow db model and api schema are the same.

Therefore I insist on using SQLAlchemy for db models and pydantic for api schemas as a mental boundary.

instig007•1h ago
> But infrastructure stuff like SQL generation, connection pooling, and row serialization is where a systems language makes sense.

not really, what makes sense is being JIT-able and friendly to PyPy.

> Type safety was a big motivation.

> https://oxyde.fatalyst.dev/latest/guide/expressions/#basic-u...

> F("views") + 1

If your typed query sub-language can't avoid stringly references to the field names already defined by the schema objects, then it's the lost battle already.

mr_Fatalyst•1h ago
The Rust core is not just about speed. It bundles native database drivers (sqlx), connection pooling, streaming serialization. It's more about the full IO stack than just making Python faster. On F("views"), fair point. It's a conscious trade-off for now. The .pyi stubs cover filter(), create(), and other query methods, but F() is still stringly-typed. Room for improvement there.
instig007•36m ago
> It's more about the full IO stack than just making Python faster.

Does it mean that your db adapter isn't necessarily DBAPI (PEP-249) compliant? That is, it could be that DBAPI exception hierarchy isn't respected, so that middlewares that expect to work across the stack and catch all DB-related issues, may not work if the underlying DB access stack is using your drivers?

> but F() is still stringly-typed. Room for improvement there.

Yeah, I'm pretty sure F() isn't needed. You can look at how sqlalchemy implements combinator-style API around field attributes:

    import sqlalchemy as sa
    from sqlalchemy.orm import DeclarativeBase


    class Base(sa.orm.DeclarativeBase):
        pass

    class Stats(Base):
        __tablename__ = "stats"

        id = sa.Column(sa.Integer, primary_key=True)
        views = sa.Column(sa.Integer, nullable=False)

    print(Stats.views + 1)
The expression `Stats.views + 1` is self-contained, and can be re-used across queries. `Stats.views` is a smart object (https://docs.sqlalchemy.org/en/21/orm/internals.html#sqlalch...) with overloaded operators that make it re-usable in different contexts, such as result getters and query builders.
mr_Fatalyst•28m ago
Right, it's not DBAPI compliant. The whole IO stack goes through Rust/sqlx, so PEP-249 doesn't apply. Oxyde has its own exception hierarchy (OxydeError, IntegrityError, NotFoundError, etc.). In practice most people catch ORM-level exceptions rather than DBAPI ones, but fair to call out.

On F(), good point. The descriptor approach is something I've been thinking about. Definitely on the radar.

TZubiri•1h ago
Didn't the committee agree that ORMs were a mistale and a thing of the past?
mr_Fatalyst•1h ago
Must have missed that meeting. ORMs are not for everything, but for CRUD-heavy apps with validation they save a lot of boilerplate. And there's always execute_raw() for when you need to go off-script.
zamalek•47m ago
Micro-orms (mapping to parameters and from columns) are generally fine last i read. It is the general aversion to writing a SELECT that is suspect.
knrz•1h ago
Lowkey hope this replaces Django ORM
mr_Fatalyst•57m ago
Thanks! Not really trying to replace Django ORM though, it's great at what it does. Just trying to build the ORM I'd personally want to use in 2026.
waterTanuki•51m ago
We need more creative names for rust packages because this is going to cause confusion

There's already Oxide computers https://oxide.computer/ and Oxc the JS linter/formatter https://oxc.rs/.

mr_Fatalyst•46m ago
Yeah, we're running out of ways to spell oxide (^_^)
jgauth•12m ago
This looks great, and like it could address a need in ecosystem. Also, the admin dashboard is such a great feature of django, nice job building it from the get-go.

Leanstral: Open-Source foundation for trustworthy vibe-coding

https://mistral.ai/news/leanstral
232•Poudlardo•3h ago•40 comments

Meta’s renewed commitment to jemalloc

https://engineering.fb.com/2026/03/02/data-infrastructure/investing-in-infrastructure-metas-renew...
311•hahahacorn•5h ago•128 comments

The “small web” is bigger than you might think

https://kevinboone.me/small_web_is_big.html
284•speckx•6h ago•127 comments

US commercial insurers pay 254% of Medicare for the same hospital procedures

https://github.com/rexrodeo/american-healthcare-conundrum
127•rexroad•6h ago•74 comments

My Journey to a reliable and enjoyable locally hosted voice assistant (2025)

https://community.home-assistant.io/t/my-journey-to-a-reliable-and-enjoyable-locally-hosted-voice...
303•Vaslo•10h ago•92 comments

Show HN: Oxyde – Pydantic-native async ORM with a Rust core

https://github.com/mr-fatalyst/oxyde
40•mr_Fatalyst•3d ago•21 comments

Show HN: Trackm, a personal finance web app

https://trackm.net
5•iccananea•23m ago•0 comments

Why I love FreeBSD

https://it-notes.dragas.net/2026/03/16/why-i-love-freebsd/
328•enz•12h ago•152 comments

Language Model Teams as Distrbuted Systems

https://arxiv.org/abs/2603.12229
63•jryio•6h ago•27 comments

Starlink Mini as a failover

https://www.jackpearce.co.uk/posts/starlink-failover/
168•jkpe•15h ago•147 comments

Show HN: Thermal Receipt Printers – Markdown and Web UI

https://github.com/sadreck/ThermalMarky
10•howlett•3d ago•3 comments

AnswerThis (YC F25) Is Hiring

https://www.ycombinator.com/companies/answerthis/jobs/CNdatw5-founding-engineering-lead
1•ayush4921•2h ago

Launch HN: Voygr (YC W26) – A better maps API for agents and AI apps

58•ymarkov•7h ago•37 comments

Polymarket gamblers threaten to kill me over Iran missile story

https://www.timesofisrael.com/gamblers-trying-to-win-a-bet-on-polymarket-are-vowing-to-kill-me-if...
1268•defly•11h ago•849 comments

Apideck CLI – An AI-agent interface with much lower context consumption than MCP

https://www.apideck.com/blog/mcp-server-eating-context-window-cli-alternative
113•gertjandewilde•8h ago•103 comments

Nvidia Launches Vera CPU, Purpose-Built for Agentic AI

https://nvidianews.nvidia.com/news/nvidia-launches-vera-cpu-purpose-built-for-agentic-ai
105•lewismenelaws•3h ago•68 comments

Show HN: Claude Code skills that build complete Godot games

https://github.com/htdt/godogen
132•htdt•7h ago•77 comments

On The Need For Understanding

https://blog.information-superhighway.net/on-the-need-for-understanding
70•zdw•4d ago•30 comments

In space, no one can hear you kernel panic

https://increment.com/software-architecture/in-space-no-one-can-hear-you-kernel-panic/
5•p0u4a•3d ago•1 comments

AirPods Max 2

https://www.apple.com/airpods-max/
174•ssijak•10h ago•341 comments

Home Assistant waters my plants

https://finnian.io/blog/home-assistant-waters-my-plants/
241•finniananderson•4d ago•128 comments

Corruption erodes social trust more in democracies than in autocracies

https://www.frontiersin.org/journals/political-science/articles/10.3389/fpos.2026.1779810/full
628•PaulHoule•12h ago•323 comments

The bureaucracy blocking the chance at a cure

https://www.writingruxandrabio.com/p/the-bureaucracy-blocking-the-chance
79•item•1d ago•110 comments

Lies I was told about collaborative editing, Part 2: Why we don't use Yjs

https://www.moment.dev/blog/lies-i-was-told-pt-2
188•antics•3d ago•95 comments

Cert Authorities Check for DNSSEC from Today

https://www.grepular.com/Cert_Authorities_Check_for_DNSSEC_From_Today
80•zdw•1d ago•181 comments

Kona EV Hacking

http://techno-fandom.org/~hobbit/cars/ev/
112•AnnikaL•5d ago•64 comments

Lazycut: A simple terminal video trimmer using FFmpeg

https://github.com/emin-ozata/lazycut
139•masterpos•11h ago•46 comments

US Job Market Visualizer

https://karpathy.ai/jobs/
385•andygcook•8h ago•306 comments

MoD sources warn Palantir role at heart of government is threat to UK security

https://www.thenerve.news/p/palantir-technologies-uk-mod-sources-government-data-insights-securit...
573•vrganj•12h ago•232 comments

Comparing Python Type Checkers: Typing Spec Conformance

https://pyrefly.org/blog/typing-conformance-comparison/
90•ocamoss•11h ago•33 comments