Skip to main content

Use advanced APIs

Once the basics are in place, extend templates with the hooks below. Every API is fully typed through @timonteutelink/template-types-lib.

APIUse it for
mapFinalSettingsDerive values after validation. Ideal for generating slugs, composing booleans, or backfilling defaults.
redirectsMove rendered files to dynamic destinations (for example, namespaced feature folders).
allowedOverwritesExplicitly permit overwriting existing files. Use sparingly—prefer targeted side effects when possible.
sideEffectsProgrammatically edit files that already exist. Supply { filePath, apply } entries that return updated contents. Keep functions idempotent.
autoInstantiatedSubtemplatesAdd child templates automatically based on parent settings. Supports async callbacks for lookup logic.
commandsSurface helpful commands (test, lint, launch) in the CLI and web UI after generation.
migrationsUpgrade stored settings when schemas change. Each migration has a UUID and can depend on a predecessor.
aiAutoGenerate / aiUserConversationSettingsOptional helpers for LLM-assisted scaffolding. Always provide manual fallbacks for accessibility.

Check the TemplateConfig reference for full signatures and additional helpers.