MonOrm
An async ORM for Python and TypeScript with one Rust core. You write the schema once in Prisma syntax. The Rust core plans the SQL and runs it on PostgreSQL or SQLite. Both languages get the same queries, the same migrations and generated, typed models.
Under active development. It works today, and the author runs it in production. It is version 0.1.0: install it with
pip install monormornpm install monorm. Other people should not use it in production yet, or do so at their own risk. Evaluate it against your own app before you rely on it.
About 1.97× faster end to end than Django (async), up to 3.55×. Source: the geometric mean of 20 cases in one run on one machine, with the database round trip included (results). Method, limits and the cases where it is not faster: Benchmarks.
The name is MonOrm.
Example
The schema (the same in both languages):
model User {
id Int @id @default(autoincrement())
name String
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
title String
published Boolean
author_id Int
author User @relation(fields: [author_id], references: [id])
}
Python:
users = await User.objects.filter(User.posts.published).load(User.posts)
TypeScript:
const users = await User.objects.filter(User.posts.published).load(User.posts);
Both examples run as they are: examples/quickstart (in-memory SQLite).
Why
- The schema language is Prisma's. One
schema.prismafile, with the editor tooling that already exists (docs). - The model API is Django-style.
Model.objects,filter(),load()and migrations that come from the schema. - Typed expressions in the style of SQLAlchemy, and generated typed models.
- One Rust engine behind both languages: the schema compiler, the SQL planner and the database drivers are shared.
Inspired by
Thank you to the projects below. We claim only what we took from each.
- Robyn: a Python surface with the hot path in Rust through PyO3. We use the same split for the database layer.
- Prisma: the schema-first idea and the
schema.prismalanguage. MonOrm is independent of Prisma (details). It is not a drop-in replacement for Prisma Client, and its query API is its own. - Django: the model API (
Model.objects, querysets) and migrations from the schema (monorm makemigrations,monorm migrate, see schema.md).
Quickstart
There is one package for each registry:
pip install monorm # the engine, every built-in extension and the auth app; `python -m monorm generate`
npm install monorm # the same for Node and Bun; `npx monorm generate`
The monorm command line comes with the Python and npm packages.
Both packages hold PostgreSQL and SQLite. They build for 3 platforms: Linux x86-64, macOS arm64 and Windows x86-64.
An extension that is not built in is a separate package that you install next to monorm (optional-packaging.md).
To build from source:
uv venv .venv && . .venv/bin/activate
uv pip install maturin
python languages/python/packaging/stage.py # the extension libraries of this platform
maturin develop # the one monorm package
python examples/quickstart/quickstart.py # Python 3.11 or later
cd languages/js && npm install && npm run assemble
cd ../../examples/quickstart && npm install && node quickstart.ts # Node 23.6 or later
Upgrade from the split packages
Before v0.1.0 the project had a thin monorm package, a native package for each profile and one package for each extension.
Remove them, then install monorm:
pip uninstall monorm-native-postgres monorm-native-sqlite monorm-native-combined monorm-native-tooling \
monorm-timestamps monorm-soft-delete monorm-locking monorm-inherit monorm-query-defaults \
monorm-generic monorm-proxy monorm-composition monorm-file-storage monorm-auth
pip install monorm
npm uninstall @ufstack/monorm @ufstack/monorm-native-postgres @ufstack/monorm-native-sqlite @ufstack/monorm-native-combined @ufstack/monorm-native-tooling @ufstack/monorm-auth \
@ufstack/monorm-timestamps @ufstack/monorm-soft-delete @ufstack/monorm-locking @ufstack/monorm-inherit @ufstack/monorm-query-defaults \
@ufstack/monorm-generic @ufstack/monorm-proxy @ufstack/monorm-composition @ufstack/monorm-file-storage
npm install monorm
The monorm[postgres] and monorm[sqlite] extras are gone: the wheel has both drivers.
Two copies of one extension id stop the load with the error "installed twice", which names the package to uninstall.
In a schema, import "app:monorm-auth" is the Python name of the auth app and import "app:auth" is the Node name.
Change the imports in your code from @ufstack/monorm to monorm and from @ufstack/monorm-<name> to monorm/extensions/<name>.
You need uv, Rust (cargo), and Node 20.19+ or 22.12+ (or Bun) for the TypeScript package.
Features
| Feature | Read |
|---|---|
| Schema language, SQLite and PostgreSQL types, client defaults, code generation | schema.md |
| Python API: queries, pagination, subqueries, windows, CTEs, writes, transactions, locks, hooks | python-api.md |
| TypeScript API with the same sections | typescript-api.md |
| Migrations from the schema | schema.md |
Protected writes, cursor pagination, the N+1 finder (monorm.debug) |
python-api.md |
| Packaging: one package for each registry, outside extension packages | optional-packaging.md |
Auth app (in the monorm package) |
auth.md |
Build-time extensions are Rust crates. The monorm package has these built in:
proxy models, query defaults, model composition, file storage, generic relations, timestamps, soft delete, locking and inheritance.
See the extension index.
Databases and platforms
| Databases | PostgreSQL and SQLite |
| Python | 3.11 to 3.14 |
| TypeScript | Node 20.19+ or 22.12+, and Bun |
| Rust | Coming soon. A typed read client is in languages/rust/ and is not published. |
| CI | Linux, macOS and Windows (package builds); Linux with PostgreSQL 18 (feature check) |
Benchmarks
Measured in one run (d428e01, 2026-10-28) on a shared cloud VM (vm, Linux 6.18.44 x86_64) with PostgreSQL 16.15.
Contenders: Django 6.1.2 (sync and async), SQLAlchemy 2.1.6 (sync and async, asyncpg), Prisma 7.10.1, Drizzle 0.45.4 and pg 8.23.1.
"N× faster" is the contender median time divided by the monorm median time.
Every number is measured and end to end: it includes the database round trip.
| Case | Python vs Django async | Python vs SQLAlchemy async | Node vs Prisma | Node vs Drizzle |
|---|---|---|---|---|
read-pk |
2.31× faster | 2.72× faster | 2.30× faster | 1.56× faster |
read-1000 |
3.26× faster | 2.77× faster | 1.96× faster | 1.43× faster |
prefetch-to-many |
3.20× faster | 2.64× faster | 1.87× faster | 3.63× faster |
m2m |
3.55× faster | 2.62× faster | 2.40× faster | 3.95× faster |
bulk-insert-1000 |
1.87× faster | 13.23× faster | 4.47× faster | 2.11× faster |
concurrent |
3.32× faster | 2.77× faster | 1.59× faster | 1.78× faster |
tx-5 |
1.10× faster (level) | 1.19× faster | 1.40× faster | 0.97× (slower, level) |
| Geometric mean of 20 cases | 1.97× faster | 2.56× faster | 1.90× faster | 1.50× faster |
- The Python work alone (build the query and make the SQL, no database) is 4.39× faster than Django async (geometric mean of 10 cases). This number is approximate.
- Level or slower cases: a case is level when the interval of its speed-up includes 1.00.
- Python vs Django async:
tx-5(1.10×, level). - Python vs Django sync:
insert-1(1.07×),bulk-update-100(1.10×) andtx-5(1.03×) are level. - Python vs SQLAlchemy sync:
tx-5is 0.92× (slower, level). Against SQLAlchemy async, no case is level. - Node vs Prisma:
bulk-update-100(1.08×) anddelete-100(1.03×) are level. - Node vs Drizzle:
projection-1000(1.01×),filter(1.11×),update-1(1.08×),bulk-update-100(0.99×, slower),delete-100(1.05×) andtx-5(0.97×, slower) are level.
- Python vs Django async:
- Bun has only 3 cases (
read-pk,read-1000,bulk-insert-1000): 2.48× faster than Prisma and 1.46× faster than Drizzle (geometric means), none level. - Against Django sync the Python geometric mean is 1.59× faster, against SQLAlchemy sync 2.25×.
- It is one run on a shared VM. Treat a difference whose interval overlaps 1.00 as no difference. Django async has no async
atomic(), which affectstx-5.
Full tables, the method and the raw data: bench/RESULTS.md and bench/compare/README.md.
Run the comparison yourself before you decide.
Status and limits
Both API docs list what is not done yet: Python and schema. The API is async only. There is no MySQL driver. The crate on crates.io comes later.
Docs
- docs/README.md: the documentation index (core, extensions, performance).
- examples/blog: a schema, its generated models and migrations, and runnable demos.
- CHANGELOG.md: what changed.
Contributing
Read CONTRIBUTING.md for the setup, the checks and the pull request rules. Report a security problem as described in SECURITY.md.
License
MIT. See LICENSE.
Metadata
Release files for monorm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 164.9 MB
Release files / monorm-0.1.0-cp314-cp314-win_amd64.whl
| Download URL | monorm-0.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
15bf4d555507729f1ca3e8095f39c5cd1a94f60a2f471cfba964ab1373b83c87
|
|
BLAKE2b-256 checksum How to use checksums |
3f2959325f69978ecfb7d0d93815babb1e6f4f1ee8ac44f7286524edaa8860e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | monorm-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
61367b9064c12dc930e63ba8d969ea3edfea76f88194d97ffeb1c0094fab5886
|
|
BLAKE2b-256 checksum How to use checksums |
61a9b677497d57a9913013ac2a5b5a6b776f7b1168d56a1e502696cc3e24cf02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | monorm-0.1.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
12fc850f412948d880710713ef8e201b928a504e9b7a180d89456139a1cd0fd6
|
|
BLAKE2b-256 checksum How to use checksums |
16c77d06c9da3bd74e7468e2bff0a96ed5dd7fff122e8ab63a2a40c95052cb73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp313-cp313-win_amd64.whl
| Download URL | monorm-0.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9a861534a97faed6b0759f376d1c6eb0e1031fbd8cabf6305f33f37d3ebbfee0
|
|
BLAKE2b-256 checksum How to use checksums |
2992d62974c0f18edfa8abc56ae724016e32a79e8655fa646dd01bd658756a5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | monorm-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
eab5c83a33993c2ca840d2473fb4729b8fa613faba4a74c3fc64e531c7703afc
|
|
BLAKE2b-256 checksum How to use checksums |
65deac98060ee4f38d1a38efa73ad7fa597f21235edb1424f8c8b4616d55149f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | monorm-0.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0751f0117bde83785af2ce6d933f6cd45880cdd9cb34384112660d13637bc0ba
|
|
BLAKE2b-256 checksum How to use checksums |
bdb82c2c9d25c4e87ef773669e4f2457c035c862c8dd31ede602481f7d5317d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp312-cp312-win_amd64.whl
| Download URL | monorm-0.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6e64a7e36f9dcc9bb7090a9fb9931639392365a19d194934c17f6c2c65b97fad
|
|
BLAKE2b-256 checksum How to use checksums |
bde46f8e4d9eff0c5d7deb92bd9d9087ce8ab417638cbaae4f02c2c46789f2ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | monorm-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a5cc08d6b59ad8111adbe556f65cd1a0950a3960dad751307b59a0472060f68c
|
|
BLAKE2b-256 checksum How to use checksums |
d2f6c9786fe9e56c79ca31edbc4fb78514c88768516d718254ff762755173877
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | monorm-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7fc9b6dcfb7fc2c6e28dbf55a6392b074961f1805759ce931945cbaa90f39fd7
|
|
BLAKE2b-256 checksum How to use checksums |
2badee0912f4b6ab5c40c4784447a794c62a91f968b964603ce926d70ddc5223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | monorm-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c6bfff9d7f65fed9c356650147082017ea2fe039199d83bab353587a8be99655
|
|
BLAKE2b-256 checksum How to use checksums |
9a13bf9837f5cdbb71a63679b59d9d8ca339f01c227aa80e8be18b0410c6d8b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | monorm-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 14.0 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ecaf4b4791bec0e3a873ab03db9ec1d9e6766824d6bde6ec181d7eb7590e599b
|
|
BLAKE2b-256 checksum How to use checksums |
07d92a858e843afdaa969c471a59d6079672e232db45854bfa354e887c481e5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / monorm-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | monorm-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bea8c23d924cb548eeeac99fa6c9f501165ed9ce538373f05dd2a9b5d11bae66
|
|
BLAKE2b-256 checksum How to use checksums |
975d376d5e38579fa4f4670289e660649068f0234c1ced64880190913fe18841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for monorm 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 12 files in this release have been uploaded with provenance metadata.
Attestation for monorm-0.1.0-cp314-cp314-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.