supabase-testcontainers-modules
Note: This project was created with assistance from AI tools.
Testcontainers modules for Supabase services in Rust. Run real Supabase containers in your integration tests.
Installation
[]
= { = "1.0.0", = ["auth"] }
[]
= "0.23"
= { = "0.11", = ["postgres"] }
= { = "1", = ["full"] }
Quick Start
use ;
use ;
use Postgres;
async
Auth Configuration
default
.with_db_url // PostgreSQL connection (required)
.with_jwt_secret // JWT signing secret
.with_jwt_expiry // Token expiry in seconds
.with_site_url // Frontend URL
.with_signup_disabled // Allow user signups
.with_anonymous_users // Enable anonymous auth
.with_mailer_autoconfirm // Skip email verification
.with_sms_autoconfirm // Skip SMS verification
.with_log_level // Log verbosity
.with_tag // Image version
.with_env // Custom environment variable
PostgREST Configuration
default
.with_postgres_connection // PostgreSQL connection (required)
.with_db_schemas // Exposed schemas
.with_db_anon_role // Anonymous role
.with_jwt_secret // JWT validation secret
.with_jwt_role_claim_key // JWT role claim path
.with_openapi_mode // OpenAPI generation mode
.with_max_rows // Max rows per response
.with_pre_request // Pre-request function
.with_log_level // Log verbosity
.with_tag // Image version
.with_env // Custom environment variable
Storage Configuration
default
.with_database_url // PostgreSQL connection (required)
.with_anon_key // Anonymous JWT for public access
.with_service_key // Service role JWT (bypasses RLS)
.with_jwt_secret // JWT validation secret
.with_postgrest_url // PostgREST server URL
.with_storage_backend // Backend type ("file" or "s3")
.with_file_storage_path // Local storage path
.with_file_size_limit // Max file size (50MB)
.with_region // S3 region
.with_global_s3_bucket // S3 bucket name
.with_tenant_id // Tenant identifier
.with_multitenant // Multi-tenant mode
.with_tag // Image version
.with_env // Custom environment variable
Realtime Configuration
default
.with_postgres_connection // PostgreSQL connection (required)
.with_jwt_secret // JWT signing secret
.with_slot_name // Replication slot name
.with_temporary_slot // Use temporary slot (recommended for tests)
.with_secure_channels // Require JWT for channel subscriptions
.with_region // AWS region
.with_tenant_id // Tenant identifier
.with_secret_key_base // Phoenix secret key
.with_db_host // Individual DB config (alternative to connection string)
.with_db_port
.with_db_name
.with_db_user
.with_db_password
.with_db_ssl // SSL for DB connection
.with_tag // Image version
.with_env // Custom environment variable
Functions Configuration
default
.with_jwt_secret // JWT signing secret
.with_supabase_url // Supabase API URL
.with_anon_key // Anonymous JWT key
.with_service_role_key // Service role JWT (bypasses RLS)
.with_db_url // PostgreSQL connection string
.with_verify_jwt // Disable JWT verification (for testing)
.with_main_service_path // Functions directory path
.with_worker_timeout_ms // Worker timeout in ms
.with_max_parallelism // Max concurrent workers
.with_port // Server port
.with_tag // Image version
.with_env // Custom environment variable
GraphQL Configuration
GraphQL is provided via the pg_graphql PostgreSQL extension (pre-installed in supabase/postgres).
To query GraphQL over HTTP, use PostgREST alongside this container.
// 1. Start PostgreSQL with pg_graphql
default
.with_database // Database name
.with_user // PostgreSQL user
.with_password // PostgreSQL password
.with_host // Bind address
.with_port // PostgreSQL port
.with_jwt_secret // JWT secret for pg_graphql
.with_tag // Image version
.with_env // Custom environment variable
// 2. Start PostgREST pointing to this database with graphql_public schema
// 3. Query via: POST /rpc/graphql with { "query": "{ ... }" }
Analytics Configuration
Analytics is powered by Logflare, a centralized logging and analytics platform. It requires a PostgreSQL database for storing analytics data.
default
.with_postgres_backend_url // PostgreSQL backend URL (required)
.with_postgres_backend_schema // Backend schema
.with_db_hostname // Database hostname
.with_db_port // Database port
.with_db_username // Database username
.with_db_password // Database password
.with_db_database // Database name
.with_public_access_token // Public API token
.with_private_access_token // Private API token
.with_encryption_key // Encryption key for sensitive data
.with_single_tenant // Single-tenant mode
.with_supabase_mode // Supabase integration mode
.with_log_level // Log verbosity
.with_tag // Image version
.with_env // Custom environment variable
Features
| Feature | Description |
|---|---|
auth |
Supabase Auth (GoTrue) container |
postgrest |
PostgREST container |
storage |
Supabase Storage container |
realtime |
Realtime container |
functions |
Edge Functions container |
graphql |
PostgreSQL with pg_graphql extension |
analytics |
Analytics container |
Requirements
- Docker
- PostgreSQL 12+ (for Auth migrations)
Implementation Status
| Service | Status |
|---|---|
| Auth | Complete |
| PostgREST | Complete |
| Storage | Complete |
| Realtime | Complete |
| Functions | Complete |
| GraphQL | Complete |
| Analytics | Complete |
License
MIT