Skip to content
BurnerByte

architecture

Database Schema

PostgreSQL schema overview — tables, indexes, and triggers.

Overview

BurnerByte uses PostgreSQL 16 with 50 migrations managing 36 tables, 74 indexes, and 8 triggers.

Core Tables

Users & Auth

TablePurpose
usersUser accounts with email, password hash and display name
sessionsActive JWT refresh sessions with IP, user agent, expiry
password_reset_tokensTime-limited password reset tokens
email_verification_tokensTime-limited email verification tokens

Organization Hierarchy

TablePurpose
organizationsOrgs with name, slug, settings JSON
org_membershipsUser ↔ org relationship with role (owner, admin, member)
teamsTeams within an org
team_membershipsUser ↔ team relationship with role
domainsRegistered domains with MX/TXT verification status
domain_assignmentsDomain ↔ team mapping with access level and settings
domain_verification_historyPer-check MX/TXT/SPF verification results over time

Email

TablePurpose
inboxesTemporary inboxes with address, TTL, domain assignment
emailsReceived emails with from, to, subject, body, headers
attachmentsEmail attachments with S3 path, content type, size

Integrations

TablePurpose
webhooksWebhook subscriptions with URL, events, HMAC secret
webhook_delivery_logsDelivery attempts with event, payload, response status/body, response time, success flag, attempt number, and idempotency key
api_keysScoped API keys with hashed key, prefix, scopes

System

TablePurpose
audit_logsActivity log with actor, action, resource, IP
invitesOrg invitations with token, email, role, expiry
invite_team_assignmentsTeam + role assignments attached to a pending invite
notificationsUser notifications with type, inbox_id, read status
setup_stateOne-time setup wizard completion state
system_configsRuntime config overrides (mailer, storage, sso, platform); the first three are encrypted at rest

RBAC

TablePurpose
rolesNamed roles with label, description, rank and scope (org or team)
permissionsIndividual permission definitions (e.g., inboxes.create)
role_permissionsRole ↔ permission mapping

SSO

TablePurpose
sso_providersConfigured OIDC providers (name, client ID/secret, endpoints)
sso_domain_mappingsEmail-domain → provider auto-routing rules
user_sso_identitiesLinks a user to an external provider identity (subject)

Analytics

TablePurpose
org_analytics_countersRunning org-level counters
team_analytics_countersRunning team-level counters
daily_email_statsPer-day org email totals
daily_team_email_statsPer-day, per-team email totals
daily_domain_email_statsPer-day, per-domain email totals
daily_sender_domain_statsPer-day sender-domain breakdown
hourly_email_statsPer-hour totals for peak-hour charts

Migrations

Managed with golang-migrate. Run with:

bash
make migrate-up    # Apply all pendingmake migrate-down  # Rollback last migrationmake migrate-test  # Test up/down for each migration