Run the Metaflow metadata service on serverless Postgres — no always-on servers
Project description
metaflow-serverless
Serverless Metaflow metadata service — free-tier Postgres, zero setup.
The problem
Running Metaflow beyond your laptop means standing up a metadata service, a database, and object storage — typically on AWS, with always-on costs and hours of infra setup. For indie developers and small teams, that overhead kills momentum before the first experiment runs.
Existing alternatives either require a paid Outerbounds subscription or leave you managing servers that cost money even when idle.
Quick start
pip install metaflow-serverless
mf-setup
python flow.py run
mf-setup provisions everything on free-tier serverless infrastructure and writes Metaflow config to ~/.metaflowconfig/config.json. Authenticate first with supabase login.
Install
pip install metaflow-serverless
Requires Python 3.10+. Metaflow must be installed separately:
pip install metaflow
Usage
Provision a new service
mf-setup
Walks you through choosing a provider stack, installs any needed CLIs, and provisions the database, storage, and compute layer. Writes credentials to ~/.metaflowconfig/config.json.
Supabase auth and config (important)
Authenticate the Supabase CLI before running setup:
supabase login
supabase projects list --output json
Then run:
mf-setup
The wizard writes Metaflow global config to:
~/.metaflowconfig/config.json
Supabase quota guardrails
For compute=supabase, the deployed metadata-router edge function enforces a monthly quota budget before forwarding requests. By default it uses:
MF_MONTHLY_REQUEST_LIMIT=500000MF_MONTHLY_EGRESS_LIMIT_BYTES=5368709120(5 GiB)
These defaults are intended to keep a single project within the current Supabase Free plan quotas for Edge Function invocations and uncached egress. Override them at deploy time by exporting:
export MF_MONTHLY_REQUEST_LIMIT=250000
export MF_MONTHLY_EGRESS_LIMIT_BYTES=$((2 * 1024 * 1024 * 1024))
export MF_QUOTA_SCOPE=my-project
mf-setup
When the quota is exhausted, the edge function returns HTTP 429 instead of continuing to forward requests.
Note: Supabase applies usage quotas at the organization level. This guardrail is enforced per deployed metadata service, so it is a conservative approximation rather than a replacement for checking the Supabase usage page.
Supabase CLI v2 notes
- The setup flow is compatible with recent Supabase CLI versions where:
supabase db url --project-ref ...is removed.supabase storage create ... --project-ref ...is removed.
- Migrations are applied directly via
asyncpgand trigger a PostgREST schema reload. - Edge function deploy uses a temporary
supabase/functions/<name>/staging layout required by current CLI packaging.
Supabase S3 credentials
mf-setup automatically provisions HMAC S3 credentials for your project and registers them in the database. No manual key management is needed. Credentials are written to ~/.metaflowconfig/config.json and used for all artifact reads/writes.
Run a flow
# flow.py
from metaflow import FlowSpec, step
class MyFlow(FlowSpec):
@step
def start(self):
self.data = [1, 2, 3]
self.next(self.end)
@step
def end(self):
print(self.data)
if __name__ == "__main__":
MyFlow()
python flow.py run
Metadata and artifacts are recorded in your provisioned service automatically.
Open the UI
mf-ui
Starts a local proxy on localhost:8083 that downloads and serves the Metaflow UI, backed by your remote service. Supports flows list, run detail, DAG view, timeline view, task detail (attempt history, duration, status), and log streaming.
How it works
metaflow-serverless replaces the Metaflow metadata service with a serverless stack — no persistent server required:
Metaflow client
→ Supabase Edge Function (URL router, ~40 lines TypeScript)
→ PostgREST (managed by Supabase)
→ PL/pgSQL stored procedures (heartbeat, tag mutation, artifact queries)
→ Postgres tables
All business logic lives in the database as stored procedures. The compute layer scales to zero and wakes in milliseconds. Artifacts are stored in S3-compatible object storage.
Compute mode details
- With
compute=supabase,mf-setupdeploys a Supabase Edge Function namedmetadata-router(not thenetflixoss/metaflow-metadata-servicecontainer image). - The Edge Function handles HTTP routing and request shaping; metadata behavior lives in SQL procedures in Postgres.
- With
compute=cloud-runorcompute=render,mf-setupdeploys thenetflixoss/metaflow-metadata-servicecontainer image.
Comparison: metaflow-serverless vs metaflow-local-service
| Dimension | metaflow-serverless |
metaflow-local-service |
|---|---|---|
| Backend | Remote service (Supabase/Cloud Run/Render + Postgres) | Local daemon on 127.0.0.1 backed by .metaflow/ |
| Cross-machine visibility | Yes | No (single machine by default) |
| Heartbeat tracking | Persisted in remote DB | In-memory daemon liveness only |
| Best use case | Shared/dev-prod-like metadata backend | Fast local iteration and CI |
| Remote Daytona/E2B observability | Recommended for end-to-end validation | Not equivalent to a shared remote backend |
Provider stacks
| Stack | Accounts needed | Cold start | Storage |
|---|---|---|---|
| Supabase (default) | 1, email only, no CC | ~0ms | 1 GB free |
| Neon + Cloudflare R2 | 2, CC for R2 | ~1-4s | 10 GB free |
| CockroachDB + Backblaze B2 | 2, phone for B2 | ~1-4s | 10 GB free |
Development
git clone https://github.com/npow/metaflow-serverless
cd metaflow-serverless
pip install -e ".[dev]"
pre-commit install
Run tests with coverage:
pytest --cov --cov-report=term-missing
Lint and format:
ruff check .
ruff format .
Type-check:
mypy src/
License
Project details
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 metaflow_serverless-0.2.2.tar.gz.
File metadata
- Download URL: metaflow_serverless-0.2.2.tar.gz
- Upload date:
- Size: 76.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab2b85ddb9baad5fe957cec42967668347f3e61fe7c275ed266ee2c002c79e42
|
|
| MD5 |
bf81f40a98e9040b410cccb4dc446019
|
|
| BLAKE2b-256 |
29f49cf7a096214c5f853aed6c94cb59cb974477c280a69f97e4a922c26a1e0f
|
Provenance
The following attestation bundles were made for metaflow_serverless-0.2.2.tar.gz:
Publisher:
publish.yml on npow/metaflow-serverless
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metaflow_serverless-0.2.2.tar.gz -
Subject digest:
ab2b85ddb9baad5fe957cec42967668347f3e61fe7c275ed266ee2c002c79e42 - Sigstore transparency entry: 1152844520
- Sigstore integration time:
-
Permalink:
npow/metaflow-serverless@082d865144e39b8a1dacd4182323d3d89aad66fe -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/npow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@082d865144e39b8a1dacd4182323d3d89aad66fe -
Trigger Event:
release
-
Statement type:
File details
Details for the file metaflow_serverless-0.2.2-py3-none-any.whl.
File metadata
- Download URL: metaflow_serverless-0.2.2-py3-none-any.whl
- Upload date:
- Size: 71.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ce808106bf05a6adc31e5d053ea6325e097621b6ef9372862a02251fc860ff
|
|
| MD5 |
3762e18d4441e9876e5db76fc770670e
|
|
| BLAKE2b-256 |
ac616119a83608463b46efea06079e0758baa74e806f611f15c2f07a3638d8ed
|
Provenance
The following attestation bundles were made for metaflow_serverless-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on npow/metaflow-serverless
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metaflow_serverless-0.2.2-py3-none-any.whl -
Subject digest:
34ce808106bf05a6adc31e5d053ea6325e097621b6ef9372862a02251fc860ff - Sigstore transparency entry: 1152844592
- Sigstore integration time:
-
Permalink:
npow/metaflow-serverless@082d865144e39b8a1dacd4182323d3d89aad66fe -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/npow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@082d865144e39b8a1dacd4182323d3d89aad66fe -
Trigger Event:
release
-
Statement type: