Seed & Bootstrap
Star-Lite Docs automatically creates the database schema and default content the first time your site receives a request.
How bootstrap works
On every request, Star-Lite's middleware calls ensurePagesCollection(). This function:
- Checks a module-level flag — if the seed has already been applied, it returns immediately
- Loads any user seed via emdash's virtual seed module and merges it with the default seed
- Calls
applySeed()to create thepagescollection and its fields - Creates the
docs-sidebarmenu only if it doesn't already exist
The bootstrap is idempotent — existing collections, fields, and menus are never overwritten. Only missing pieces are added.
Default seed
The built-in seed (src/seed.ts) creates:
- A pages collection with
title(string, required, searchable) andcontent(portableText) fields - A docs-sidebar menu (empty items array)
- A welcome page at slug
indexwith adocs.heroblock
Custom seed
The create-star-lite-docs CLI writes a .emdash/seed.json file with starter content and sidebar links. emdash exposes this via virtual:emdash/seed, and the bootstrap merges it with the default seed:
contentfrom the user seed replaces the default contentmenusfrom the user seed replaces the default menus- Collections and fields always come from the default seed
Programmatic access
defaultSeed— theSeedFileobject shipped by the plugin (fromsrc/seed.ts)ensurePagesCollection(db)— the file-based bootstrap function (fromsrc/bootstrap.ts). Note: the runtime middleware uses an inline version in the virtual module, not this export.