Framework

Seed Flutter + Supabase Apps with MockHero

Approach

Don't seed from the Flutter client — it can't hold a service-role key safely. Run a Node or Python seed script locally or in CI that writes directly to Supabase.

// scripts/seed.mjs
import { createClient } from "@supabase/supabase-js";

const supabase = createClient(
  process.env.SUPABASE_URL,
  process.env.SUPABASE_SERVICE_ROLE_KEY
);

const data = await fetch("https://api.mockhero.dev/api/v1/generate", {
  method: "POST",
  headers: { "x-api-key": process.env.MOCKHERO_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    tables: [
      { name: "trips", count: 30, fields: [
        { name: "id", type: "uuid" },
        { name: "destination", type: "city" },
        { name: "start_date", type: "date" },
        { name: "end_date", type: "date" }
      ]}
    ]
  })
}).then(r => r.json());

await supabase.from("trips").insert(data.trips);

Get Started

Free API key.

M

MockHero Team

Guides and tutorials for generating realistic test data with the MockHero API.

Start generating test data for free

1,000 rows/month on the free tier. No credit card required.

Get Your API Key

Related Articles