A par-baked starter for PoC apps: signup-with-approval auth, rate limiting, and (soon) deploy scaffolding for fly.io
Project description
parbaked
A par-baked starter for FastAPI PoCs. Signup with admin approval, rate limiting, and an admin dashboard — set up in one line.
If you ship PoCs on fly.io, two things eventually bite you: anyone on the internet can spin up accounts in a loop (and run up your bill), and you write the same auth boilerplate every time. parbaked is the slice between "I have an idea" and "this is safe to put online."
30-second quickstart
uvx parbaked new myapp
cd myapp
make dev
Open http://localhost:8000, sign up. Open http://localhost:8000/auth/admin and log in as admin with the password printed in your terminal. Approve yourself. Log in. Done.
You now have a working PoC with:
- Signup + login + JWT sessions
- Admin-approval gate (nobody gets in until you click approve)
- Built-in admin dashboard with pending/active/rejected queues
- Per-IP rate limiting (5/min signup, 10/min login by default)
- SQLite DB and secrets auto-created on first run
Add to an existing FastAPI app
from fastapi import FastAPI
from parbaked import Parbaked
app = FastAPI()
parbaked = Parbaked(app) # ← that's the whole setup
That gives you /auth/signup, /auth/login, /auth/me, /auth/admin, and approval magic links. On first boot you'll see:
╔════════════════════════════════════════════════════════════════╗
║ parbaked v0.2.0 is running ║
╠════════════════════════════════════════════════════════════════╣
║ Sign up at: http://localhost:8000/auth/signup ║
║ Admin panel: http://localhost:8000/auth/admin ║
║ Admin user: admin ║
║ Admin pass: z703EwDKmEKL9S6SaO39uuRq ║
║ Email out: Console (printed below) ║
║ Database: sqlite:///./parbaked.db ║
║ ║
║ ⚠ Auto-generated secrets stored in .parbaked.json ║
║ Add it to .gitignore. For prod, set env vars instead. ║
╚════════════════════════════════════════════════════════════════╝
Protect your own routes:
from fastapi import Depends
@app.get("/profile")
def profile(user = Depends(parbaked.current_user)):
return {"email": user.email, "name": user.name}
Why an approval gate?
Without one:
- Anyone on the internet can sign up to your PoC
- Even with rate limits, sustained traffic can autoscale you onto a bill
- You can't show it to a friend without also showing it to bots
With one:
- Pending accounts can't log in. Period.
- You see every signup. Click approve in your inbox or in the dashboard.
- Bots can fill the database with junk, but they can't do anything — and rate limits cap the junk.
The approval flow uses HMAC-signed magic links (no DB state) AND a built-in web dashboard (HTTP-basic-auth gated). Use whichever you prefer — email's nicer for low volume, the dashboard's nicer when you want to see the queue.
Configuration
Everything has sensible defaults. Override via env vars (prefix PARBAKED_) or by passing args to Parbaked():
| Env var | Default | What it does |
|---|---|---|
JWT_SECRET |
(auto-generated) | Session token signing key |
APPROVAL_TOKEN_SECRET |
(auto-generated) | Magic-link signing key |
ADMIN_PASSWORD |
(auto-generated) | Dashboard login password (user is always admin) |
ADMIN_EMAIL |
unset | Where signup-approval emails go (dashboard works without this) |
APP_NAME |
"My App" |
Used in email subjects |
APP_URL |
http://localhost:8000 |
Public URL for magic links |
RESEND_KEY |
— | Set this to send real email via Resend. Unset → emails print to stdout. Get a free key (no card) at https://resend.com/api-keys or run parbaked email setup. |
MAIL_FROM |
onboarding@resend.dev |
From address. Default is Resend's sandbox — no DNS setup, but only delivers to the email you signed up with. For real users, verify your domain at resend.com/domains and set this. |
RATELIMIT_SIGNUP |
5/minute |
Per-IP signup limit |
RATELIMIT_LOGIN |
10/minute |
Per-IP login limit |
DATABASE_URL |
sqlite:///./parbaked.db |
Standard SQLAlchemy URL |
Auto-generated secrets get persisted to .parbaked.json (chmod 600). In production, set them as env vars instead.
Security posture
What protects you from a bill:
- Per-IP rate limits on signup and login (slowapi)
- No email enumeration — signup with an existing email and login with a wrong password return generic errors
- Approval gate — even if someone gets past the rate limit, they can't do anything until you click approve
- bcrypt for passwords, HS256 JWT for sessions, audience-scoped JWT for magic links so a session token can never be replayed as approval (and vice versa)
What's on the roadmap (and isn't here yet):
- v0.3 — Deploy scaffolding: opinionated
Dockerfile,fly.tomlwithauto_stop_machines = "stop"+ hard max-machines cap,make tunnelrecipe usingcloudflared tunnel --url http://localhost:8000(no auth needed; ephemeral trycloudflare.com URL). - v0.4 — Pluggable CAPTCHA on signup (Cloudflare Turnstile / hCaptcha).
- v0.5 (this release) — Resend as the opinionated prod email path,
parbaked email setup/testCLI,/healthendpoint, admin/user CLI commands, "write your app here" starter polish, production-database guidance.
React/TypeScript components
Drop-in components for if you're building a React frontend. They ship as source in src/parbaked/frontend/ — copy them into your web/src/:
SignupForm.tsxLoginForm.tsxPendingScreen.tsx
Tailwind classes, no internal dependencies. See src/parbaked/frontend/README.md.
When you need more control
The one-call Parbaked(app) is the simple case. If you want to wire pieces yourself:
from parbaked import ParbakedConfig
from parbaked.auth import build_auth_router, make_current_user
from parbaked.email import ConsoleEmail
from parbaked.ratelimit import install_rate_limiting
config = ParbakedConfig(jwt_secret="...", admin_email="you@example.com")
limiter = install_rate_limiting(app, config)
app.include_router(
build_auth_router(config, get_session, ConsoleEmail(), limiter=limiter)
)
current_user = make_current_user(config, get_session)
Same building blocks, no smart defaults. Use this when you want a custom email transport, your own admin dashboard, or to wire parbaked into a non-trivial app structure.
Install
pip install parbaked
# or
uv add parbaked
Requires Python 3.11+.
Develop / contribute
git clone https://github.com/saml7n/parbaked
cd parbaked
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
pytest
Issues and PRs welcome.
License
MIT — see LICENSE.
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 parbaked-0.5.1.tar.gz.
File metadata
- Download URL: parbaked-0.5.1.tar.gz
- Upload date:
- Size: 33.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3aa852b059423c33ebc258494b2614674a3c61192fb7a0ecaa4fece75ac2a0
|
|
| MD5 |
a26e8f67fbba1e32093028dc1a0f7c7c
|
|
| BLAKE2b-256 |
0556a65f851abdc031b34fab58afe34a10736ff9900a9b9ef2e5922b86a3f2e2
|
Provenance
The following attestation bundles were made for parbaked-0.5.1.tar.gz:
Publisher:
release.yml on saml7n/parbaked
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parbaked-0.5.1.tar.gz -
Subject digest:
7b3aa852b059423c33ebc258494b2614674a3c61192fb7a0ecaa4fece75ac2a0 - Sigstore transparency entry: 1557049998
- Sigstore integration time:
-
Permalink:
saml7n/parbaked@cf3542d7bc9a76316e9df9fd3de239fa9a010686 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/saml7n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cf3542d7bc9a76316e9df9fd3de239fa9a010686 -
Trigger Event:
push
-
Statement type:
File details
Details for the file parbaked-0.5.1-py3-none-any.whl.
File metadata
- Download URL: parbaked-0.5.1-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a5cc2e03a577e26d1928c9404faea3fe022cb15e2d43878b7f862b692aa8f68
|
|
| MD5 |
f2b2f1dd2218633c5f8e2d3a3ef88d33
|
|
| BLAKE2b-256 |
50393a0bb33fed499910a2095b2680c5e27d640adbef345b6d9fcf74242f5e46
|
Provenance
The following attestation bundles were made for parbaked-0.5.1-py3-none-any.whl:
Publisher:
release.yml on saml7n/parbaked
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parbaked-0.5.1-py3-none-any.whl -
Subject digest:
9a5cc2e03a577e26d1928c9404faea3fe022cb15e2d43878b7f862b692aa8f68 - Sigstore transparency entry: 1557050167
- Sigstore integration time:
-
Permalink:
saml7n/parbaked@cf3542d7bc9a76316e9df9fd3de239fa9a010686 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/saml7n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cf3542d7bc9a76316e9df9fd3de239fa9a010686 -
Trigger Event:
push
-
Statement type: