Integrations
How do I add a new integration provider?
How do I add a new integration provider?
Follow the guide in
docs/adding-new-integration.md in the repository. The high-level steps:- Insert a provider row in
integration_providersandintegration_provider_display - Create a new Edge Function at
supabase/functions/sync-{slug}/index.ts - Implement entity sync and finding detection logic
- Register the provider’s OAuth client credentials (scopes, redirect URI)
- Add the provider to the
trigger-syncdispatcher switch statement - Map findings to unified controls for evidence materialization
How do I debug a failing sync?
How do I debug a failing sync?
Check these in order:
- Sync job status: Query
integration_sync_jobsfor the connection - Sync logs: Check
integration_sync_logfor detailed error messages - Edge Function logs:
- Token validity: Check if the OAuth token has expired and the refresh failed
- Provider API: Verify the provider API is not rate-limited or down
Risk and Scoring
How does the risk score work?
How does the risk score work?
The risk score is a composite 0-100 value (100 = best) computed from four weighted components:
- Control Maturity (35%): Average maturity across enabled controls
- Evidence Coverage (25%): Percentage of controls with accepted evidence
- Framework Compliance (25%): Weighted framework readiness scores
- Integration Findings (15%): Severity-weighted open findings
Billing
How do I run the billing setup?
How do I run the billing setup?
- Set Stripe environment variables in
.env.local: - Create products and prices in the Stripe Dashboard (or via Stripe CLI)
- Configure the webhook endpoint in Stripe to point to
{APP_URL}/api/billing/webhook - For local testing, use the Stripe CLI to forward webhooks:
- The webhook handler processes
checkout.session.completed,customer.subscription.updated,customer.subscription.deleted, andinvoice.payment_failedevents.
Frameworks
How do I add a new compliance framework?
How do I add a new compliance framework?
- Insert the framework in
compliance_frameworks: - Add requirements to
framework_requirementswith the framework ID - Map requirements to unified controls in
control_framework_map - The framework will automatically appear in the tenant framework selection UI and readiness dashboards
AI Features
Where are the AI features?
Where are the AI features?
AI is powered by Anthropic Claude and used in two places:
-
Evidence Classification (
evidence_classifyEdge Function): Automatically categorizes uploaded evidence and suggests control mappings based on content analysis. - Assessment Analysis: Processes assessment responses to generate recommendations and risk insights.
ANTHROPIC_API_KEY is stored as a Supabase Edge Function secret and is never exposed to the client.To extend AI capabilities, add new Edge Functions or Server Actions that call the Anthropic API.Assessments
How does an assessment convert to a client?
How does an assessment convert to a client?
When a prospect completes an assessment:
rpc_complete_assessmentcalculates scores and generates recommendations- A partner or admin calls
rpc_convert_assessment_to_tenantto create a tenant - The conversion function:
- Creates a
tenantsrecord from the company info - Sets up
tenant_membershipsfor the owner - Pre-populates
tenant_controlsbased on assessment answers - Selects recommended frameworks
- Updates the assessment status to
'converted'
- Creates a
Development
How do I regenerate TypeScript types from the database?
How do I regenerate TypeScript types from the database?
How do I test RLS policies locally?
How do I test RLS policies locally?
- Start Supabase locally:
supabase start - Create a test user via the Auth dashboard at
localhost:54323 - Use the authenticated client to make queries
- Verify that queries only return data for the user’s tenant
getSupabaseServerClient() (RLS enforced) and getSupabaseServerAdminClient() (RLS bypassed).