A complete, deployable money-native SaaS in one Python file — accounts, a Pro plan with a trial, a self-serve billing portal, a metered API with API keys, an auto-admin panel, and background email. Built on Larz, with zero dependencies beyond Larz + gunicorn.
pip install -r requirements.txt
cp .env.example .env # optional — dev works with no keys
python3 app.py # http://127.0.0.1:8000That's a working SaaS: sign up, hit the 3-project free-tier cap, upgrade to a
7-day Pro trial, manage billing at /larz/account, grab an API key, and call the
metered API.
| Feature | How |
|---|---|
| Accounts | larz.auth — register / login / logout, scrypt passwords |
| Free tier + Pro plan | @app.plan("pro"), 7-day trial, 3-project free cap |
| Billing portal | built-in /larz/account (cancel, invoices, credits) |
| Metered API | @app.api_key_required + @app.metered("$0.01/call") |
| Auto-admin | larz.admin over User and Project at /admin |
| Templates | inheritance (base.html) + filters |
| Background email | @app.money.on_grant → app.jobs.enqueue(...) |
| Security | rate limiting + bot filter middleware |
| Config | .env via ops.load_env() |
Fill in .env (a strong SECRET, STRIPE_KEY + STRIPE_WEBHOOK_SECRET, SMTP),
then:
gunicorn -c deploy/gunicorn.conf.py app:appThe deploy/ folder has a Dockerfile, a systemd unit, an nginx.conf, and a
gunicorn.conf.py. Point your Stripe webhook at /larz/webhook/stripe. See the
Larz deployment docs.
python3 tests/test_app.py # 9 checks — signup, free-tier cap, upgrade, adminThe free Larz course walks through building this from scratch. Full docs: larzos.com/larz/docs.
MIT — fork it, ship it, charge money.