Supabase Edge Functions are a good product and a very specific one: Deno, running close to your users, invoked per request, with your Supabase project's context conveniently at hand. For webhooks, auth hooks, small API endpoints, and glue code between services, they are close to ideal and there is no reason to look elsewhere.
People start looking elsewhere for reasons that cluster into four groups, and each group points at a different alternative. Working out which one you are in is most of the decision, so this guide is organised by reason rather than by vendor. I build PandaStack, which is a fit for exactly one of the four and I will say which.
Reason 1: the edge is further from your database than you are
This is the most common and the most counter-intuitive. Edge deployment means your code runs in the region nearest the user. Your Postgres database lives in one region. If the function makes several sequential queries, each one crosses that distance, and a function running 200 milliseconds from the database can easily be slower end-to-end than a function running in the same building as it.
The tell is a function whose own execution time is a couple of milliseconds and whose total duration is hundreds. Every one of those milliseconds is network. Adding a connection pooler helps with connection setup but does nothing about the round-trip distance, and no amount of query optimisation will either.
There are three real fixes. Pin the function to the database's region, which most platforms allow and which converts "edge" back into "a server somewhere sensible". Collapse the sequential queries into one — a single stored procedure or one query with joins instead of five — so distance is paid once. Or move the compute next to the data entirely.
-- The highest-leverage fix for edge-to-database latency is usually not
-- a platform change. It is removing round trips.
--
-- Before: 4 sequential queries from the function = 4x the network
-- distance, and the function spends 99% of its life waiting.
--
-- const user = await db.from('users').select().eq('id', id).single()
-- const org = await db.from('orgs').select().eq('id', user.org_id).single()
-- const plan = await db.from('plans').select().eq('id', org.plan_id).single()
-- const usage = await db.from('usage').select().eq('org_id', org.id)
--
-- After: one round trip. Same data, one crossing of the distance.
create or replace function public.user_context(p_user_id uuid)
returns jsonb
language sql
stable
security invoker -- keep RLS in play; definer bypasses it
as $$
select jsonb_build_object(
'user', to_jsonb(u.*),
'org', to_jsonb(o.*),
'plan', to_jsonb(pl.*),
'usage', coalesce(jsonb_agg(us.*) filter (where us.id is not null), '[]'::jsonb)
)
from users u
join orgs o on o.id = u.org_id
join plans pl on pl.id = o.plan_id
left join usage us on us.org_id = o.id
where u.id = p_user_id
group by u.id, o.id, pl.id;
$$;
-- Then the function is one call: await db.rpc('user_context', { p_user_id })Reason 2: the work takes longer than a function may live
Every function platform has a wall-clock limit, and the workloads that hit it are predictable: generating a report, processing an upload, calling a language model that streams for a while, running a migration, transcoding anything. Once you are near the limit you enter the phase where the function is chopped into pieces that call each other, which works and is miserable to operate.
The honest reframe is that this work is a job, not a request. A job wants a queue, a worker, a status you can poll, and the ability to retry a failure without re-running the successful half. Whichever platform you pick, that architecture change is the actual fix — a function platform with a longer timeout only postpones the conversation.
void doWorkLater() in a function handler, you do not have a background job — you have a race.Reason 3: you need a runtime the edge does not give you
Deno's Node compatibility is good and gets better, but edge runtimes are not full Linux, and a whole class of dependency simply does not fit: native modules, headless Chromium, ffmpeg, ImageMagick, a Python data stack, a compiler. If your function's job is "resize this image", "render this PDF", "run pandas over this CSV", or "execute this code the model wrote", you need a process on a real operating system.
This is also the group where isolation starts to matter. Executing code you did not write — a user's transformation script, a model's generated snippet, a third-party plugin — inside a shared runtime is a much weaker boundary than most people assume. That workload wants a machine, not a function.
Reason 4: you want to leave the platform, not the pattern
Sometimes the functions are fine and the reason is elsewhere: consolidating vendors, self-hosting for compliance, or moving off a managed Postgres. Here you want the closest possible equivalent so the migration is mechanical, and the good news is that Supabase Edge Functions are Deno with Web-standard APIs — which is the most portable thing they could be.
The alternatives
- Deno Deploy — The most direct swap. Same runtime, same Web APIs, same import style, so a function often moves with the import map and nothing else. Choose it when Deno is what you wanted and Supabase was incidental.
- Cloudflare Workers — The strongest edge story and the most opinionated runtime. V8 isolates start in single-digit milliseconds, and the surrounding primitives — KV, D1, R2, Durable Objects, Queues — are genuinely good. Reason 1 becomes less painful if your data moves into that ecosystem too; more painful if your Postgres stays put and you need a TCP connection through a proxy.
- Vercel Functions — Both a Node runtime and an edge runtime, with a well-trodden path from one to the other when you discover you need the fuller one. Natural if your frontend is already there.
- Netlify Functions — Similar shape, with Deno-based edge functions alongside Node functions. Comfortable if the site is already on Netlify.
- AWS Lambda — Not edge, and that is often the point: put it in your database's region, give it a longer timeout, and use Step Functions or SQS for work that is really a job. The least fashionable and most flexible option on the list.
- Fastly Compute — WebAssembly-based edge compute with very tight startup and strong request-path performance. Good when the function is genuinely request-shaped and latency is the product.
- Cloudflare Queues, Inngest, Trigger.dev, or Temporal — Not function-runtime replacements but the correct answer to reason 2. If your problem is duration and retries rather than latency, a durable-execution or queue product solves it properly instead of extending a timeout.
- Self-hosted Supabase — The whole stack, functions included, on your own infrastructure. The right move when the driver is compliance or data residency rather than any technical limit.
- PandaStack Functions — Each invocation runs in a fresh Firecracker microVM: Python or Node, a full Ubuntu userland, real system packages, and cron schedules on the same object. That buys you the things reason 3 needs — native binaries, a headless browser, a real filesystem, and a hypervisor boundary around code you did not write — and it costs you edge latency: a fresh-VM invocation is around 0.8 seconds, which is fine for a webhook or a scheduled job and wrong for anything on a page-load path. It is the answer to reason 3, and a bad answer to reason 1.
# A Supabase-shaped function moved to a microVM runtime, for the case
# where the blocker was "Deno can't do this". Same idea, full Linux.
# 1. Create the function. Runtime is python or nodejs; the entrypoint is
# a file in the bundle you upload next.
curl -sS -X POST https://api.pandastack.ai/v1/functions \
-H "Authorization: Bearer $PANDASTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "render-invoice-pdf",
"runtime": "python",
"entrypoint": "handler.py",
"env": {"S3_BUCKET": "invoices"}
}'
# 2. Ship the code as a bundle. Vendor your dependencies in, or install
# them in the handler on first run -- there is a real filesystem here,
# which is the whole reason you moved.
tar czf bundle.tgz handler.py requirements.txt templates/
curl -sS -X POST https://api.pandastack.ai/v1/functions/$FN_ID/deploy \
-H "Authorization: Bearer $PANDASTACK_API_KEY" \
--data-binary @bundle.tgz
# 3. Invoke it, or attach a cron schedule and stop invoking it yourself.
curl -sS -X POST https://api.pandastack.ai/v1/functions/$FN_ID/invoke \
-H "Authorization: Bearer $PANDASTACK_API_KEY" \
-d '{"invoice_id": "inv_8812"}'
curl -sS -X POST https://api.pandastack.ai/v1/schedules \
-H "Authorization: Bearer $PANDASTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "nightly-invoices",
"function_id": "'$FN_ID'",
"cron": "0 3 * * *"}'
# The trade-off, stated plainly: a fresh microVM per invocation is ~0.8s.
# Excellent for webhooks and cron. Wrong for a hot request path.You can usually keep Supabase and fix the function
Worth saying explicitly, because the framing of "alternatives" hides it: in most of these cases the database is not the problem. A very common and very sane end state is Supabase Postgres, Supabase Auth, Supabase Storage — and the functions moved to whatever suits the workload, which might be three different places for three different workloads.
- Fast, request-shaped, database-adjacent → keep them where they are, pinned to the database's region.
- Long-running or retryable → a queue plus a worker, on any long-running compute.
- Needs a real Linux userland or executes untrusted code → a microVM function or a container job.
- Purely computational at the edge, no database → an edge runtime, and Cloudflare Workers is very hard to beat.
The short version
Diagnose before you migrate, because three of the four reasons have fixes that do not involve changing platform. If it is latency, measure how much of the duration is network and collapse your round trips before blaming the runtime. If it is duration, the fix is a queue and a worker regardless of vendor. If it is the runtime, that one is real and you need a machine.
And do not assume you must move everything. Supabase's database and auth are the sticky, valuable parts; the functions are the portable part, which is exactly why moving only them is usually the cheapest correct answer.