Sources
Learn where templates can be loaded from.
The use command resolves templates from several source types. The source format determines how the CLI locates and fetches the template file.
Local file
A path to a template on disk, either relative or absolute:
npx croct@latest use template.json5This is the simplest option for testing templates during development.
URL
A publicly accessible URL pointing to the template file:
npx croct@latest use https://example.com/template.json5If the URL does not end with a filename, the CLI looks for template.json or template.json5 at that location automatically.
GitHub
A blob URL pointing to a template in a GitHub repository:
npx croct@latest use https://github.com/org/repo/blob/master/template.json5The CLI extracts the repository, branch, and file path from the URL and fetches the template directly from GitHub.
npm
The npm:// scheme resolves a template from an npm package's linked repository. The CLI reads the package metadata from the npm registry, finds the associated GitHub repository, and fetches the template from its root directory:
npx croct@latest use npm://package-nameThis is useful for libraries that ship a companion template alongside their package. For details on setting this up, see the publishing templates tutorial.
Registry
Registries map custom URL schemes to template locations. The built-in registry maps schemes like croct://, shadcn-ui://, magic-ui://, and others to their corresponding template repositories:
npx croct@latest use croct://starter/nextjsFor details on the registry format, built-in schemes, and custom registries, see Registries.
You can specify a custom registry using the --registry global option.