Architecture

IronLayer is built as a dual-engine system where determinism and AI advisory are cleanly separated.

Dual-Engine Design

Layer A (Core Engine) is purely deterministic. Given the same git diff and current state, it produces byte-for-byte identical plan JSON. This is enforced by:

  • Content-based plan IDs (SHA-256 of the canonical plan JSON)
  • Sorted keys in all JSON output
  • No timestamps in plan content
  • Versioned canonicalization (v1) for hash stability

Layer B (AI Engine) provides advisory-only intelligence. AI analysis is attached as metadata annotations — it never modifies the execution plan. If the AI engine is unavailable, the plan executes normally without advisory data.

Multi-Tenant Isolation

Every table in the PostgreSQL database includes a tenant_id column. Row-level security (RLS) policies are enforced at the database level, not just the application layer. Tenant context is set per-session.

Data Flow

  1. Git diff — IronLayer detects changed SQL files between two commits
  2. Model discovery — SQL files are parsed with SQLGlot (Databricks dialect) to extract table references
  3. DAG construction — NetworkX builds a dependency graph from the discovered models
  4. Plan generation — The planner determines execution order, incremental strategy, and watermark ranges
  5. AI augmentation (optional) — Cost prediction, risk scoring, and SQL optimization suggestions are attached
  6. Approval gate — Plans require explicit approval (or auto-approve in dev mode)
  7. Execution — SQL is executed on the target Databricks workspace via the Databricks SQL API
  8. Telemetry — Runtime metrics are captured (PII-scrubbed) and stored for cost prediction training

Security Model

  • JWT authentication with short-lived tokens (1 hour) and refresh tokens (24 hours)
  • RBAC with admin, engineer, and viewer roles
  • Credential encryption using Fernet (AES-128-CBC + HMAC-SHA256, PBKDF2 key derivation)
  • SQL safety guard blocks dangerous statements (DROP, TRUNCATE, DELETE, ALTER)
  • Hash-chained audit log for tamper-evident compliance
  • Rate limiting per-user and per-endpoint
  • Token revocation via JTI blacklist

Tech Stack

LayerTechnology
LanguagePython 3.11+ (Poetry)
SQL ParsingSQLGlot (Databricks dialect)
DAGNetworkX
APIFastAPI + Pydantic v2
ORMSQLAlchemy 2.0 async + Alembic migrations
DatabasePostgreSQL 16 (production) / SQLite (local dev)
Local SQLDuckDB
FrontendReact 18 + TypeScript + Tailwind + ReactFlow
InfrastructureAzure Container Apps + Terraform
BillingStripe (subscriptions + metered usage)