The money-native web framework — payments, paywalls and metering as first-class primitives. Zero dependencies.
Project description
⚡ Larz
The money-native web framework.
pip install larz
Larz is a small, from-scratch, dependency-free Python web framework where payments, paywalls, subscriptions, trials, and usage-metering are first-class primitives — not something you bolt on with three libraries and a weekend.
Flask makes routes easy. Django makes data easy. Larz makes getting paid easy.
from larz import Larz
import larz.money as money
app = Larz(secret="change-me")
money.enable(app) # payments on. Zero keys in dev.
@app.paid("$9/mo", trial_days=7) # subscription with a free trial
@app.get("/pro/report")
def report(req):
return "<h1>Pro report for %s</h1>" % req.subject
@app.metered("$0.02/call") # per-call billing from prepaid credit
@app.post("/api/summarize")
def summarize(req):
return {"summary": run(req.json()["text"])}
app.run()
A request to /pro/report from someone who hasn't paid is automatically
sent through checkout (or given their free trial); when they come back, they're
served. A request to /api/summarize with no credit gets a clean 402. You
never write if user.is_paid.
Batteries included — all pure stdlib
| Area | What you get |
|---|---|
| Money | @app.paid · @app.metered · @app.plan · subscriptions, renewals, cancel + dunning · free trials · coupons · credit packs · invoices/receipts · customer portal (/larz/account) · entitlement events · /larz/admin revenue dashboard |
| Providers | Mock · Stripe · Paddle · Lemon Squeezy · Paystack · PayPal · GemVault · Dodo · Crypto — all via stdlib urllib, no SDKs. Add your own in ~40 lines. |
| Auth | larz.auth — users, scrypt passwords, @app.login_required, req.user, API keys (@app.api_key_required, plan-gated), RBAC (@app.require_role), email-verify + password-reset tokens |
| API tooling | @app.validate(schema) · auto OpenAPI (/openapi.json + /docs) · paginate() · a webhooks framework (sign, deliver, retry) |
| ORM | larz.models — relationships (ForeignKey), field types (datetime/json/decimal…), query operators (views__gt, title__like), pagination, hooks, transactions, auto-migrations |
| Admin | larz.admin — an auto-generated CRUD admin panel over your models |
| Ops | larz.ops — @app.cache · background jobs (@app.job) · cron scheduler (@app.schedule) · email (SMTP) · .env config · /healthz + /metrics |
| Templating | {{ }} / {% for %} / {% if %} · inheritance ({% extends %}/{% block %}) · filters (` |
| Core | WSGI engine · typed routing · signed-cookie sessions · blueprints · static files · debug pages |
| Security · SEO · CLI | Rate limiting, bot filter, CSRF, CORS · auto sitemap/robots + OpenGraph + IndexNow · larz new / run / routes |
Why
Every other framework treats money as an afterthought — the thing you wire up last, badly, copy-pasted from a payments tutorial. But for indie hackers, solopreneurs, and anyone shipping a product to make a living, monetization isn't the afterthought — it's the point. Larz puts it in the core.
Use it for
- Paid / metered APIs — AI wrappers, data APIs (
@app.meteredper call) - Content paywalls — reports, courses, paid newsletters (
@app.paid) - Digital products — one-off unlocks and downloads
- Micro-SaaS — a free tier + a Pro plan with a trial (
@app.plan)
Design principles
- Zero dependencies. Pure Python standard library —
sqlite3,urllib,wsgiref. Runs anywherepython3runs, including constrained boxes and phones. - Provider-agnostic. The framework never hard-codes a processor. Implement
create_checkout+parse_webhookand any processor drops in. - Portable by default. No modern-SQLite assumptions, no C extensions.
Run the demos (no API keys)
python3 examples/paid_app.py # the essentials: paid + metered routes
python3 examples/saas_app.py # a full mini-SaaS: plans, trials, credits,
# templates, ORM, dashboard, security
Then open http://127.0.0.1:8000/ and click through. Visit /larz/admin?token=admin123
on the SaaS demo to see the revenue dashboard.
Test
python3 tests/test_core.py # 15 — routing, sessions, paywall, metering
python3 tests/test_features.py # 43 — money, providers, templating, security
python3 tests/test_v1.py # 52 — ORM, auth, API, admin, ops, billing
110 checks, no pytest required.
Scaffold a new app
python3 -m larz new myapp
cd myapp && python3 -m larz run
Status
v1.0.0 — real and tested, but not yet production-hardened (WSGI dev server, in-memory rate limiting, MockProvider is dev-only). Roadmap: ASGI/async core, production server recipe, dunning/renewal reminders, richer analytics, a hosted docs site at larzos.com/larz.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file larz-1.0.0.tar.gz.
File metadata
- Download URL: larz-1.0.0.tar.gz
- Upload date:
- Size: 49.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069df8d689418c24a2c25d3999563b9512f78282d4fea5a84e7dd52ba35d8527
|
|
| MD5 |
e46b40fe6cae192194aae4054fd0c930
|
|
| BLAKE2b-256 |
744f97613072eb37fcf3780090f6cbc85016d0687ca6e0a8a7273a8a5687385d
|
Provenance
The following attestation bundles were made for larz-1.0.0.tar.gz:
Publisher:
publish.yml on larz-scripter/larz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
larz-1.0.0.tar.gz -
Subject digest:
069df8d689418c24a2c25d3999563b9512f78282d4fea5a84e7dd52ba35d8527 - Sigstore transparency entry: 2245852937
- Sigstore integration time:
-
Permalink:
larz-scripter/larz@8dbfa3d5e3f44ad1fa1491fb7800f0703bf502bd -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/larz-scripter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dbfa3d5e3f44ad1fa1491fb7800f0703bf502bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file larz-1.0.0-py3-none-any.whl.
File metadata
- Download URL: larz-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de36bcbbc4e5565323754e7bd345809828afca2c310408dd03ac186f8619b165
|
|
| MD5 |
fb0c105152074c891b4804d78bd6aab0
|
|
| BLAKE2b-256 |
60530df6dbccc0d1d81b2f5b4b558c5d42ac93c7c7a97f5d9d04bbfaa1746d87
|
Provenance
The following attestation bundles were made for larz-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on larz-scripter/larz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
larz-1.0.0-py3-none-any.whl -
Subject digest:
de36bcbbc4e5565323754e7bd345809828afca2c310408dd03ac186f8619b165 - Sigstore transparency entry: 2245853299
- Sigstore integration time:
-
Permalink:
larz-scripter/larz@8dbfa3d5e3f44ad1fa1491fb7800f0703bf502bd -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/larz-scripter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dbfa3d5e3f44ad1fa1491fb7800f0703bf502bd -
Trigger Event:
push
-
Statement type: