NorthStar’s entire backend runs on Supabase: a private Postgres schema holds all trace data, a Deno/TypeScript Edge Function handles authenticated ingest, and Row Level Security enforces multi-tenant isolation. There are no third-party services to configure. All you need is a Supabase account and the Supabase CLI.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sidmanale643/northstar/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Supabase account
- The Supabase CLI installed and authenticated (
supabase login)
Setup steps
Log in to supabase.com and create a new project. Take note of the project reference (the short lowercase alphanumeric string visible in your project URL and dashboard settings — it looks like
abcdefghijklmnopqrst). You will use this as NORTHSTAR_PROJECT_ID.NorthStar ships 26 migration files in the
migrations/ directory. Apply them all in order using supabase db push:The CLI applies every file in
migrations/ that has not yet been applied, in lexicographic order. Here is what each batch provisions:001_initial_schema.sqlprivate schema, private.projects, private.api_keys002–005private.sessions, private.runs, private.spans, private.events006_ingest_rpc.sqlprivate.ingest_batch() RPC, private.resolve_api_key(), Row Level Security policies007_ingest_hardening.sql008_one_api_key_per_project.sql009_fix_request_project_id_search_path.sql010–011public.create_or_rotate_project_api_key() RPC for key management012–016017–020021_project_provider_keys.sql022_trace_spans_read_model.sql023_session_errored_count.sql024_alert_rules_and_webhooks.sqlpublic.alert_rules and public.webhooks tables and RPCs025_prompts.sql026_scores_feedback.sqlprivate.scores table and bulk score ingestionNorthStar authenticates ingest requests by hashing the bearer token with SHA-256 and looking up the hash in
private.api_keys. Only the hash is stored — the plaintext key is never persisted.Use the
create_or_rotate_project_api_key RPC (callable via the Supabase dashboard SQL editor with service_role permissions) to create your first project and API key:-- 1. Generate a key on your local machine (keep the plaintext — you won't see it again)
-- e.g. ns_$(openssl rand -hex 24)
-- 2. Hash it
-- echo -n "ns_<your-raw-key>" | sha256sum
-- 3. Call the RPC (replace all placeholders)
SELECT public.create_or_rotate_project_api_key(
gen_random_uuid(), -- p_project_id: your project UUID
'My Agent', -- p_project_name
gen_random_uuid(), -- p_key_id: UUID for this key record
'<sha256-hex-of-your-key>' -- p_key_hash
);
The function upserts the project by
id, so you can call it again to rotate the key. The old key is immediately revoked (its revoked_at is set) and replaced with the new hash.The ingest Edge Function lives in
supabase/functions/ingest-traces/. Deploy it with JWT verification disabled — NorthStar uses its own Bearer token authentication via SHA-256 hash lookup, not Supabase JWTs:NorthStar also ships a prompts Edge Function that the SDK and dashboard use to resolve versioned prompt templates. Deploy it as well:
import northstar
northstar.init(
api_key=os.environ["NORTHSTAR_API_KEY"],
project_id=os.environ["NORTHSTAR_PROJECT_ID"],
project="My Agent",
environment="production",
)
Architecture
Edge Function validation
The Edge Function (supabase/functions/ingest-traces/index.ts) validates every field in the ingest payload before touching the database:
- UUIDs — all
id,session_id,run_id,span_id, andproject_idfields must match the standard UUID format. - ISO timestamps — all
created_at,started_at, andended_atfields must be valid ISO 8601 timestamps with timezone. - Enums —
span.kindmust be one ofagent,workflow,model,tool,custom;run.statusandspan.statusmust berunning,ok, orerror;event.typemust be one of the defined event type literals. - Unknown keys — any unrecognized field in a session, run, span, event, score, or prompt link object is rejected with a
400error.
Row Level Security
All sixprivate schema tables have RLS enabled. The ingest RPC functions are SECURITY DEFINER — they run as the schema owner and bypass RLS for writes, but validate project_id programmatically to prevent cross-tenant writes. The anon and authenticated Supabase roles are explicitly denied access to the private schema, so trace data is never reachable through the public Supabase Data API.
The dashboard connects using the service_role key, which has explicit SELECT, INSERT, and UPDATE grants on the private tables.
Idempotent ingestion
Every entity is written withON CONFLICT (id) DO UPDATE. If the SDK retries a batch (on 408, 429, 500, 502, 503, or 504 status codes), duplicate records are safely merged rather than duplicated. This means re-sending a batch is always safe.
Provider keys for dashboard evals
Dashboard rubric evals can use project-scoped API keys for OpenAI, Anthropic, OpenRouter, and other LiteLLM-compatible providers. These keys are stored encrypted in the database using a symmetric encryption key you control. Before saving any provider keys through the dashboard, set thePROVIDER_KEYS_ENCRYPTION_KEY environment variable on the dashboard server. Generate a 32-byte base64 key with: