Seeds

A seed is a file in a Frond's seeds/ directory, named after its entity, run at startup once the schema check passed. It is the frond's own code, not a client: its rows are written by the storage, the way a handler writes — so a field closed to callers (readOnly) and a chosen id are its to set.

// fronds/blog/seeds/Author.seed.ts
export default [
  { id: 'alice', name: 'Alice Martin', email: 'alice@example.com' },
];

// fronds/blog/seeds/Post.seed.ts
export default [
  { title: 'Hello', body: '…', authorId: 'alice', status: 'published', publishedAt: new Date() },
  { title: 'Still a draft', body: '…', authorId: 'alice' },
];

The contract

  • Export: the rows, or async (resolve) => rows when they must be computed.
  • Order: a ref() target is planted before its referrer — Author before Post here.
  • Where: a seed runs in the process that hosts its entity's storage, and is skipped elsewhere. The same seed is planted once, in process or split, with no code of its own deciding it.
  • Idempotence: a seed is skipped when its entity already holds rows.
  • What is still judged: the storage refuses a row whose shape or reference does not hold. A seed has no caller and no identity — it does not call operations as a user.

Next: Facts — announcing what happened, to whoever listens.

Built with Fougere and Nuxt, hosted on GitHub Pages.