Deploy Edge Functions from CLI without needing Docker + import files outside of supabase directory

Feb 14, 2025

We've introduced an experimental flag to the Supabase CLI, which allows you to deploy Edge Functions without running Docker.

How to use#


_10
npx supabase@beta functions deploy --use-api

This also simplifies importing files outside the supabase/ directory within Edge Functions. Useful for monorepo setups where you want to share code between your frontend and Edge Functions.

For example, Given the directory layout below, you can import my-lib from either index.ts or deno.json.


_11
my-repo/
_11
├─ my-app/
_11
│ ├─ supabase/
_11
│ │ │ functions/
_11
│ │ │ │ slug/
_11
│ │ │ │ ├─ index.ts
_11
│ │ │ │ ├─ deno.json
_11
├─ my-lib/
_11
│ ├─ src/
_11
│ │ ├─ index.ts
_11
├─ README.md

The new flag is available from the Supabase CLI beta releases 2.13.3. Please check CLI upgrade guide on how to use the beta releases on your machine.

CI#

We also recommend using the --use-api flag if you deploy Edge Functions via CI. This should speed up the deploys as it no longer requires Docker and also solves a race condition previously occurred when deploying multiple functions in parallel.

Here's an example GitHub Action config:


_24
name: Deploy Function
_24
_24
on:
_24
push:
_24
branches:
_24
- main
_24
workflow_dispatch:
_24
_24
jobs:
_24
deploy:
_24
runs-on: ubuntu-latest
_24
_24
env:
_24
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
_24
PROJECT_ID: your-project-id
_24
_24
steps:
_24
- uses: actions/checkout@v3
_24
_24
- uses: supabase/setup-cli@v1
_24
with:
_24
version: 2.13.3
_24
_24
- run: supabase functions deploy --use-api --project-ref $PROJECT_ID

Note: If you run into any issues with the --use-api, you can drop the flag to use the default Docker-based deploy mechanism.

Note 2: To run/ test Edge Functions locally (supabase functions serve), you will still need Docker. This only modifies deploy behavior.

Build in a weekend, scale to millions