A template adds one framework to the CLI. You need Node.js 22 or later and Docker. The rules that a template meets are in the template contract.
-
Run the framework's generator once in a scratch directory, without the CLI. Install its dependencies and start it. Note the files that the starter makes, and any version conflict that
npm installreports. -
Create
templates/<id>/with atemplate.config.jsand afiles/directory. Use a lowercase kebab-case id. -
Write the manifest. Take the
scaffoldcommand from step 1, add the flag that skips the generator's install, and use{{dir}}for the directory. Replace@latestwith the generator's current version, and give every package indepsanddevDepsan exact version. Ifnpm installfailed in step 1, pin the fix indevDeps. -
Write the overlay. Start from the template whose framework is closest to yours. Read field names only from
typesense.config.json. -
List the starter files that the overlay replaces in
remove. -
Run the checks:
npm run check
npm run checkruns Biome, the typecheck, and the tests. Manifest validation is part of the tests. The test that lists the template ids fails until you add your id totest/templates.test.ts. -
Run the end-to-end check on both server paths:
npm run build npm run e2e -- <id> npm run e2e -- <id> --existing
The first run uses a local server with the books sample data. The page must open with "The Hunger Games", and
hary potrmust find Harry Potter. The second run starts its own Typesense with a movies collection fromtest/fixtures/movies.json, which has no field in common with books. The page must open with "Oppenheimer", andgodfathrmust find The Godfather. Both checks skip without Docker. -
Open the generated project in a browser, and type a misspelling. The automated checks do not judge the quality of the results.
-
Add a row for the template to the table in README.md, and add its id to the
-tlist in the main README.
git push runs npm run check first, through the Husky pre-push hook, and
stops the push if it fails.
GitHub Actions runs npm run check only, not the end-to-end check. The
maintainer runs step 7 for every template on a schedule.
Every generator and package is pinned to an exact version, and the manifest
check refuses @latest. To move a template to a newer version, change the
version in its template.config.js, then run step 7 for that template.