#How to create a starter template
4 messages · Page 1 of 1 (latest)
Hi @hasty knoll. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The knowledge sources don't contain detailed documentation specifically about creating a custom starter template from scratch. However, based on what is available, here's what I can tell you:
Using a GitHub Repository as a Template
You can use any existing GitHub repository as a template when creating a new Astro project. This means you can:
- Set up your scaffolding in a GitHub repository (your custom template).
- Start new projects from it using the
--templateflag with thecreate astrocommand:
# npm
npm create astro@latest -- --template <github-username>/<github-repo>
# pnpm
pnpm create astro@latest --template <github-username>/<github-repo>
# yarn
yarn create astro --template <github-username>/<github-repo>
By default, this uses the repository's main branch. To use a different branch, append it like this: <github-username>/<github-repo>#<branch>. [CLI installation flags]
For Publishing a Reusable Component/Integration
If you want to publish a reusable Astro component template to npm, there is a community-supported component template you can bootstrap with:
npm create astro@latest my-new-component-directory -- --template component