CX
CodeXDocumentation

Connect Supabase to CodeX

Complete guide to integrating your Supabase project with the CodeX desktop app. Get up and running in 5 minutes with our quick start guide.

Prerequisites
Make sure you have these ready before starting
Supabase account
Supabase project (Organization β†’ New project)
Region: nearest to your users
Database password: store securely
πŸš€ Quick Start (5 minutes)
Get connected fast with these essential steps
1Create a project in Supabase.
2

Go to Project Settings β†’ API, copy:

  • β€’ Project URL (REST URL)
  • β€’ anon public key
  • β€’ service_role key (store securely; NEVER ship to the client)
3

Go to Authentication β†’ URL Configuration β†’ Add redirect URL(s):

codex://supabase-oauth-return
(Optional dev) codex://supabase-oauth-return?env=dev
4

In CodeX, open Settings β†’ Integrations/Providers β†’ Supabase and paste:

  • β€’ SUPABASE_URL = <Project URL>
  • β€’ SUPABASE_ANON_KEY = <anon key>
  • β€’ (Optional) SUPABASE_SERVICE_ROLE_KEY for server-side jobs
5Click "Test Connection" β†’ expect "Connected".
πŸ”— Deep Link Specification
Technical details for the CodeX Electron app integration

Protocol Details

  • β€’ Protocol: codex
  • β€’ Hostname: supabase-oauth-return
  • β€’ Required params: token, refreshToken, expiresIn

Example URL

codex://supabase-oauth-return?token=eyJhbGciOi...&refreshToken=eyJhbGciOi...&expiresIn=3600
πŸ”§ Environment Variables Mapping
VariableWhere to find in SupabaseNotes
SUPABASE_URLProject Settings β†’ API β†’ Project URLREST base URL
SUPABASE_ANON_KEYProject Settings β†’ API β†’ anon public keySafe for client use with RLS
SUPABASE_SERVICE_ROLE_KEYProject Settings β†’ API β†’ service_roleServer-side only, never in CodeX
πŸ—„οΈ Database Setup Example
Sample SQL to get you started with CodeX tables
create table if not exists codex_apps (
  id uuid primary key default gen_random_uuid(),
  name text not null,
  created_at timestamp with time zone default now()
);

alter table codex_apps enable row level security;
create policy "Authenticated can read" on codex_apps
  for select
  using (auth.uid() is not null);
πŸ§ͺ Testing the Connection

From CodeX:

Click "Test Connection" in the Supabase integration settings.

From terminal (sanity check):

curl -H "Authorization: Bearer <anon_key>" \
"<SUPABASE_URL>/rest/v1/codex_apps?select=*"
Expect 200 OK and an array (possibly empty).
πŸ”§ Troubleshooting
❓ Frequently Asked Questions

Do I need a backend?

Not for basic read flows with RLS; anon key is sufficient. Use server-side functions for privileged operations.

Multiple environments?

Use separate Supabase projects/keys and keep per‑env profiles in CodeX.

Key rotation?

You can rotate anon/service_role in Supabase and update CodeX settings.

Ready-to-Copy .env
.env
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=eyJhbGciOi...
# server-side only
SUPABASE_SERVICE_ROLE_KEY=...
Quick Actions