Database Overview

All 15 tables are prefixed supplysafe_ and live in the same Supabase project used for all ANR projects (kgqykbezkjbbhtttwcai). Row Level Security is enabled on all tables.

RLS Policy: Anon key = SELECT only on all tables. Service role = bypass RLS (backend only). Authenticated users = SELECT + INSERT/UPDATE on operational tables.


Layer 1 — Supplier Tables

Table Purpose
supplysafe_suppliers Master supplier records: name, country, city, contact, reliability_score, risk_flag, risk_notes
supplysafe_purchase_orders POs from NovaBrew to each supplier: po_number, supplier_id, material_id, quantity, total_cost, expected_delivery, status, delay_days

Layer 2 — Inventory Tables

Table Purpose
supplysafe_raw_materials All raw materials: name, supplier_id, unit_cost, lead_time_days
supplysafe_inventory Current stock levels: material_id, quantity_on_hand, reorder_point, safety_stock_level, warehouse_location
supplysafe_inventory_transactions Stock movement history: material_id, transaction_type, quantity, reference_id
supplysafe_products Finished product catalogue: name, sku, unit_price, production_time_days
supplysafe_bill_of_materials Product-to-material mapping: product_id, material_id, quantity_required

Layer 3 — Order Tables

Table Purpose
supplysafe_customers Customer master: company_name, contact_name, contact_email, country
supplysafe_orders Customer orders: order_number, customer_id, status, total_value, required_ship_date, delay_days
supplysafe_order_items Line items: order_id, product_id, quantity, unit_price
supplysafe_order_damage_log Damage and issue records per order

Layer 4 — Agent Tables

Table Purpose
supplysafe_supplier_alerts Alerts created by Agent 1: supplier_id, severity, title, description, source_url, resolved
supplysafe_risk_assessments Assessments created by Agent 3: severity, cascade_summary, revenue_at_risk, affected_order_ids
supplysafe_agent_actions Draft communications created by Agent 4: action_type, recipient, subject, draft_content, status
supplysafe_agent_logs Pipeline run logs: agent_name, run_at, duration_ms, status, tokens_used, output_summary

Demo Company: NovaBrew Equipment Co.

The seed data represents a fictional but fully realistic commercial coffee equipment manufacturer based in Austin, Texas.

Dimension Detail
Revenue $3.2M annual
Employees 28
Products ProBrew X1, ProBrew X2, GrindMaster Pro, BrewStation Elite, plus 4 others
Suppliers 6 international: China, South Korea, Germany, Vietnam, Mexico, USA
Raw Materials 12 materials including Boiler Chambers, Heating Elements, Pressure Sensors
Open Orders 35 customer orders across 18 customers
Purchase Orders 10 active POs