Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bc5c5af
feat: add supabase module for CLI installation and auth
DevelopmentCats Aug 19, 2026
e887729
fix: improve version resolution regex for GitHub API response
DevelopmentCats Aug 19, 2026
f9af204
chore(supabase): rename auto to detect, align with claude-code patterns
DevelopmentCats Aug 19, 2026
1e1dd6a
feat(supabase): add coder_app dashboard link and project_ref variable
DevelopmentCats Aug 19, 2026
ae35308
chore(supabase): use proper SVG format for icon
DevelopmentCats Aug 19, 2026
149697c
feat(supabase): add dashboard_app toggle to disable workspace app
DevelopmentCats Aug 19, 2026
5ac6ef0
feat(supabase): auto-link CLI when project_ref is provided
DevelopmentCats Aug 19, 2026
05d0d7a
chore(supabase): clean up script comments
DevelopmentCats Aug 19, 2026
5ef6acd
fix(supabase): link project in home directory instead of module direc…
DevelopmentCats Aug 19, 2026
67245d5
feat(supabase): add project_dir variable to control link directory
DevelopmentCats Aug 19, 2026
3030695
fix: correct test regex and remove double-logging
DevelopmentCats Aug 19, 2026
a1fd47d
style: fix README formatting
DevelopmentCats Aug 19, 2026
c86733b
fix: README structure and test fixes for supabase module
DevelopmentCats Aug 19, 2026
b718009
feat(supabase): improve scorecard with air-gap and egress support
DevelopmentCats Aug 19, 2026
28d6124
fix: pin supabase version in container tests to avoid GitHub API rate…
DevelopmentCats Aug 19, 2026
ad81633
docs: add workflow diagram and clarify token handling in README
DevelopmentCats Aug 19, 2026
593ce11
docs: simplify intro - remove ASCII diagram, keep it concise
DevelopmentCats Aug 19, 2026
1cdabd7
supabase: use supabase login --token instead of env var
DevelopmentCats Aug 19, 2026
a82699e
supabase: remove redundant note
DevelopmentCats Aug 19, 2026
a0c4000
supabase: use GFM alert for token note
DevelopmentCats Aug 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .icons/supabase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 200 additions & 0 deletions registry/coder/modules/supabase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
---
display_name: Supabase CLI
description: Install Supabase CLI and configure authentication via Coder external auth or access token
icon: ../../../../.icons/supabase.svg
verified: false
tags: [supabase, database, cli, helper]
---

# Supabase CLI

This module adds the [Supabase CLI](https://supabase.com/docs/guides/cli) to your Coder workspace with pre-configured authentication. Instead of manually installing the CLI and running `supabase login` in each workspace session, the module handles installation and injects credentials via environment variables—so `supabase projects list` and other commands work immediately.

It integrates with Coder's external auth for OAuth-based login, or accepts a personal access token for simpler setups. When a `project_ref` is provided, the module also links the workspace to your Supabase project and adds a dashboard shortcut to the Coder workspace UI.

**What this module does:** Installs the Supabase CLI in your workspace and wires up authentication through Coder's [external auth](https://coder.com/docs/admin/external-auth) (OAuth) or a personal access token. Once configured, users get a ready-to-use `supabase` command—no manual login required—plus a dashboard button in the workspace UI.

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
}
```

## Authentication

Choose **one** of the following authentication methods:

### Option 1: Personal Access Token

Generate a token at [supabase.com/dashboard/account/tokens](https://supabase.com/dashboard/account/tokens) and pass it to the module via the `access_token` variable with `use_external_auth = false`.

### Option 2: Coder External Auth (OAuth)

Configure Supabase as an [external auth provider](https://coder.com/docs/admin/external-auth) in your Coder deployment. Users authenticate via OAuth when launching a workspace.

Required Coder environment variables:

```bash
CODER_EXTERNAL_AUTH_0_ID=supabase
CODER_EXTERNAL_AUTH_0_TYPE=custom
CODER_EXTERNAL_AUTH_0_CLIENT_ID=<your-client-id>
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=<your-client-secret>
CODER_EXTERNAL_AUTH_0_AUTH_URL=https://api.supabase.com/v1/oauth/authorize
CODER_EXTERNAL_AUTH_0_TOKEN_URL=https://api.supabase.com/v1/oauth/token
CODER_EXTERNAL_AUTH_0_SCOPES=all
CODER_EXTERNAL_AUTH_0_DISPLAY_NAME=Supabase
CODER_EXTERNAL_AUTH_0_DISPLAY_ICON=/icon/supabase.svg
```

Create your OAuth app in the [Supabase Dashboard](https://supabase.com/dashboard/account/oauth-apps) under "OAuth Apps" → "Published apps". Set the redirect URI to `https://<your-coder-url>/external-auth/supabase/callback`.

## Usage

### With Personal Access Token

```tf
variable "supabase_token" {
type = string
sensitive = true
}

module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
use_external_auth = false
access_token = var.supabase_token
}
```

> [!NOTE]
> Never hardcode tokens in your template.

### With External Auth (OAuth)

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
use_external_auth = true
# external_auth_id = "supabase" # Default; change if your provider has a different ID
}
```

### With Project Dashboard Link

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
use_external_auth = false
access_token = var.supabase_token
project_ref = "abcdefghijklmnop" # Links dashboard button directly to this project
}
```

### With Custom Install Method

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
install_method = "binary" # Force binary install instead of detect
}
```

### Pre-installed Binary (Air-gapped / Golden Image)

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
skip_install = true # CLI is already in the image
access_token = var.supabase_token
}
```

### With Internal Mirror

```tf
module "supabase" {
source = "registry.coder.com/coder/supabase/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
download_base_url = "https://artifacts.internal.corp/supabase-cli/releases/download"
}
```

## Installation Methods

The module supports multiple installation methods to work across different workspace environments:

| Method | Description | Platforms |
| ------------------ | ---------------------------- | -------------- |
| `detect` (default) | Detect best available method | All |
| `brew` | Homebrew | macOS, Linux |
| `scoop` | Scoop package manager | Windows |
| `binary` | Direct binary download | All (fallback) |

Detection priority: Homebrew → Scoop → Native packages (deb/rpm/apk) → Binary

## Dashboard App

The module adds a **Supabase** button to your workspace that links to the Supabase dashboard:

- **Without `project_ref`**: Links to [supabase.com/dashboard](https://supabase.com/dashboard) (project list)
- **With `project_ref`**: Links directly to your project's dashboard

Find your project reference in the Supabase dashboard URL: `https://supabase.com/dashboard/project/<project_ref>`

## Common CLI Commands

After workspace start, you can use the Supabase CLI:

```bash
# List your projects
supabase projects list

# Link to a project
supabase link --project-ref <project-id>

# Database operations
supabase db pull # Pull remote schema
supabase db push # Push migrations
supabase migration new # Create migration

# Local development (requires Docker)
supabase start # Start local stack
supabase stop # Stop local stack

# Generate TypeScript types
supabase gen types typescript --project-id <id> > types.ts
```

## Network Egress

During installation and operation, the module and CLI may connect to these external endpoints:

| Endpoint | Purpose | When |
| -------------------- | ---------------------------------------- | --------------------------------- |
| `api.github.com` | Resolve latest CLI version | Install (when version = "latest") |
| `github.com` | Download CLI binary/package | Install |
| `api.supabase.com` | OAuth authentication, project operations | Runtime (CLI commands) |
| `supabase.com` | Dashboard links | Workspace app (external link) |
| Homebrew/Scoop repos | Package installation | Install (brew/scoop methods) |

To use in restricted environments, set `download_base_url` to an internal mirror or use `skip_install = true` with a pre-baked image.

## Logs

Installation logs are stored at:

```
$HOME/.coder-modules/coder/supabase/logs/install.log
```
Loading