Teach a word

Some words an entity uses are yours to define: a string format (format: 'slug'), an id generator (generate: 'ulid'), a verb that reads (total). A frond teaches them in its vocabulary/ directory, which the scan reads first:

// fronds/blog/vocabulary/ulid.ts
import { Generators } from '@fougere/schema';

export const ulid = Generators.term('ulid', () => …);

// fronds/blog/entities/Post.ts
id: primary({ generate: 'ulid' }),
RegistryA word forExample
StringFormatsa string's formatStringFormats.term('slug', …)
Generatorshow an id is generatedGenerators.term('ulid', …)
Verbswhether an operation readsVerbs.term('total', 'query')

A word answers every entity of the process, whichever frond teaches it, and the statement lists it beside the fronds (export const vocabulary = [ulid] in fronds.ts). An entity that names a word nothing answers refuses the boot (term-missing).

Built with Fougere and Nuxt, hosted on GitHub Pages.