Crate supabase_management_rs

Source
Expand description

§Supabase Management API Client

⚠️ Note: This crate is still a work in progress and not all API endpoints are implemented yet.

This crate provides a client for interacting with the Supabase Management API.

It allows management of Supabase projects, including:

  • Organization management: View and manage organizations
  • Project operations: Create, list, retrieve, update, delete, pause, and restore projects
  • Project configuration: Manage database settings, API keys, and network restrictions
  • Database management: Execute queries, manage database branches, and view usage metrics
  • Storage management: Configure buckets, policies, and other storage settings
  • Functions management: Deploy, list and configure edge functions
  • Project monitoring: Check health status and view logs
  • SSL enforcement: Configure custom domains and SSL settings
  • Postgres extensions: Manage available and enabled extensions

§Example

use supabase_management_rs::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a client with your Supabase management API key
    let client = Client::new("your-api-key".to_string());

    // List all projects
    let projects = client.list_projects().await?;

    // Get the first project
    if let Some(project) = projects.first() {
        println!("Project name: {}", project.name);

        // Check project health
        let health = client.get_project_health(&project.id).await?;
        println!("Project health: {:?}", health);

        // Execute a query
        let results: serde_json::Value = client
            .query(&project.id, "SELECT now()")
            .await?;
        println!("Query result: {:?}", results);

        // Pause a project
        client.pause_project(&project.id).await?;
    }

    Ok(())
}

Modules§

postgres_configs
Module for managing Postgres configuration settings of a Supabase project.
project
Module for managing Supabase projects, including creation, deletion, and configuration.
storage
Module for listing and managing storage settings in Supabase projects.

Structs§

Client
A client to interact with the Supabase Management API.