good first issueintegrationnew-featurenew-integration
Métriques du dépôt
- Stars
- (1 930 étoiles)
- Métriques de merge PR
- (Métriques PR en attente)
Description
Description
Add Supabase integration to sync project activity, database changes, edge function deployments, and platform events into CORE using the Supabase Management API.
Reference Implementations
Existing Integrations (use as templates)
integrations/github/- Similar developer platform integrationintegrations/linear/- Project management integrationintegrations/notion/- For database/content sync patterns
Required Files Structure
integrations/supabase/
├── src/
│ ├── index.ts # Main entry, OAuth spec
│ ├── schedule.ts # Sync logic
│ ├── utils.ts # Supabase Management API utilities
│ ├── account-create.ts # OAuth setup
│ └── create-activity.ts # Activity formatting
├── package.json
├── tsup.config.ts
└── README.md
Supabase Management API Integration
OAuth Setup
- Use OAuth 2.1 Authorization Code flow (PKCE)
- Authorization URL:
https://api.supabase.com/v1/oauth/authorize - Token URL:
https://api.supabase.com/v1/oauth/token - Required scopes (format:
<resource>:<action>):projects:read- Read project details and configurationprojects:write- Create and modify projectsdatabases:read- Read database configuration and migrationsdatabases:write- Run migrations, manage databaseauth:read- Read auth configuration and usersauth:write- Manage auth settingsstorage:read- Read storage buckets and objectsstorage:write- Manage storageedge_functions:read- Read edge functionsedge_functions:write- Deploy edge functionssecrets:read- Read project secretssecrets:write- Manage project secretsorganizations:read- Read organization detailsorganizations:write- Manage organizations
- Alternative: Personal Access Token (PAT) for automation workflows
Key Endpoints
Base URL: https://api.supabase.com/v1
Projects
GET /projects- List all projectsPOST /projects- Create a new projectGET /projects/{ref}- Get project detailsDELETE /projects/{ref}- Delete a projectGET /projects/{ref}/health- Check project service healthGET /projects/{ref}/api-keys- Get project API keysPOST /projects/{ref}/api-keys- Create new API keys
Database
GET /projects/{ref}/database/migrations- List database migrationsPOST /projects/{ref}/database/migrations- Create a migration (create tables)GET /projects/{ref}/database/context- Get database contextPOST /projects/{ref}/database/query- Run a SQL queryPOST /projects/{ref}/branches- Create a development branchGET /projects/{ref}/branches- List branchesDELETE /branches/{branch_id}- Delete a branch
Edge Functions
GET /projects/{ref}/functions- List edge functionsPOST /projects/{ref}/functions- Create an edge functionGET /projects/{ref}/functions/{slug}- Get function detailsPATCH /projects/{ref}/functions/{slug}- Update a functionDELETE /projects/{ref}/functions/{slug}- Delete a function
Auth
GET /projects/{ref}/config/auth- Get auth configurationPATCH /projects/{ref}/config/auth- Update auth configuration
Storage
GET /projects/{ref}/config/storage- Get storage configuration
Secrets
GET /projects/{ref}/secrets- List project secretsPOST /projects/{ref}/secrets- Create secretsDELETE /projects/{ref}/secrets- Delete secrets
Organizations
GET /organizations- List organizationsGET /organizations/{slug}- Get organization detailsGET /organizations/{slug}/members- List organization members
Billing
PATCH /projects/{ref}/billing/addons- Upgrade/downgrade compute size
Events to Track
-
Projects
- Project created / deleted / paused / restored
- Project health status changes
- API keys rotated
-
Database
- Migration created / applied
- Branch created / merged / deleted
- Schema changes
-
Edge Functions
- Function deployed / updated / deleted
- Function invocation errors
-
Auth
- Auth configuration changed
- Auth provider enabled / disabled
-
Storage
- Storage configuration updated
- Bucket created / deleted
-
Organization
- Member added / removed
- Billing changes
Implementation Tasks
- Set up basic integration structure following
integrations/github/src/index.tspattern - Implement OAuth 2.1 (PKCE) flow in
account-create.ts - Create Supabase Management API utilities in
utils.ts - Implement sync logic in
schedule.tsfor projects, functions, and database activity - Convert Supabase platform events to CORE activity format
- Add polling-based change detection for project health and function deployments
- Add error handling and rate limiting
- Create integration documentation
- Add to
integrations/README.md
Technical Notes
- Supabase Management API uses OAuth 2.1 with PKCE (more secure than standard OAuth 2.0)
- Authentication via Bearer token:
Authorization: Bearer <access_token> - Personal Access Tokens (PATs) are long-lived and useful for CI/CD automation
- Scopes restrict OAuth token access to specific Management API endpoints; all scopes support
readand/orwrite - OAuth App ID is used for tracking and rate limiting per integration
- Project references (
ref) are used as unique identifiers for projects - Database branching is available for development workflows
- The Management API is separate from the project-level REST/GraphQL APIs (PostgREST, Realtime)
- For real-time database changes within a project, use Supabase Realtime (separate from Management API)
- Consider using
supabase-management-jscommunity SDK
Resources
- Supabase Management API Reference
- Build a Supabase OAuth Integration
- OAuth Scopes Documentation
- OAuth 2.1 Server Guide
- Supabase for Platforms
- Management API OpenAPI Spec
- supabase-management-js SDK
- Access Control
Labels
enhancement, good first issue, integration, new-feature, new-integration