Open-Source Wikis

/

Astro

/

Packages

/

create-astro

withastro/astro

create-astro

The scaffolding CLI invoked by npm create astro@latest. It walks the user through choosing a template, optional integrations, and TypeScript strictness level.

Purpose

create-astro is the entry point for new Astro projects. It clones a template from the examples/ directory of the latest branch (Astro's create-astro reads from latest, not main), installs dependencies, optionally initialises Git, and prints a "happy hacking" splash.

Directory layout

packages/create-astro/
├── create-astro.mjs    # Bin entrypoint
├── src/                # Wizard implementation (clack prompts)
└── test/               # Snapshot/E2E tests

create-astro uses @clack/prompts for its interactive wizard and ships its own copies of the templates it offers (a subset of examples/ curated for first-run UX).

How it works

graph LR
    A[npx create astro@latest] --> B[Parse CLI flags]
    B --> C{Has template flag?}
    C -- Yes --> D[Validate template name]
    C -- No --> E[Show clack prompt list]
    E --> F[Resolve template URL]
    D --> F
    F --> G[degit / tarball download into target dir]
    G --> H[Install deps via detected pkg manager]
    H --> I[Optional: git init, set up tsconfig]
    I --> J[Print next-steps banner]

The package prefers the package manager invoked at run time (npm/pnpm/yarn/bun) by sniffing npm_config_user_agent.

Templates

Most templates are mirrors of the examples in examples/:

  • basics, blog, minimal, portfolio, starlog
  • Framework starters: framework-react, framework-preact, framework-vue, framework-svelte, framework-solid, framework-alpine, framework-multiple
  • Specialty: ssr, hackernews, with-markdoc, with-mdx, with-nanostores, with-tailwindcss, with-vitest, container-with-vitest, toolbar-app, integration, component

Tests

packages/create-astro/test/ exercises the wizard with synthetic prompt input, asserts the produced project structure, and runs against the examples/ checkout to ensure templates remain valid.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

create-astro – Astro wiki | Factory