Skip to content

Install Astro with the Automatic CLI

Ready to install Astro? Follow this guide to using the create astro CLI to get started.

  • Node.js - v18.17.1 or higher, not v19, and v20.3.0 or higher.
  • Text editor - We recommend VS Code with our Official Astro extension.
  • Terminal - Astro is accessed through its command-line interface (CLI).

create astro is the fastest way to start a new Astro project from scratch. It will walk you through every step of setting up your new Astro project. It allows you to choose from a few different official starter templates or you can use any existing project on GitHub with the --template argument.

Run the following command in your terminal to start our handy install wizard:

Terminal window
# create a new project with npm
npm create astro@latest

You can run create astro anywhere on your machine, so there’s no need to create a new empty directory for your project before you begin. If you don’t have an empty directory yet for your new project, the wizard will help create one for you automatically.

If all goes well, you should see a “Liftoff confirmed. Explore your project!” message followed by some recommended next steps. cd into your new project directory to begin using Astro.

If you skipped the npm install step during the CLI wizard, then be sure to install your dependencies before continuing.

Astro comes with a built-in development server that has everything you need for project development. The astro dev command will start the local development server so that you can see your new website in action for the very first time.

Every starter template comes with a pre-configured script that will run astro dev for you. Use your favorite package manager to run this command and start the Astro development server.

Terminal window
npm run dev

If all goes well, Astro should now be serving your project on http://localhost:4321/!

Astro will listen for live file changes in your src/ directory, so you will not need to restart the server as you make changes during development.

When viewing your site in the browser, you’ll have access to the Astro dev toolbar. As you build, it will help you inspect your islands, spot accessibility issues, and more.

If you aren’t able to open your project in the browser, go back to the terminal where you ran the dev command and look to see if an error occurred, or if your project is being served at a different URL than the one linked to above.

You can also start a new astro project based on an official example or the main branch of any GitHub repository by passing a --template argument to the create astro command.

Terminal window
# create a new project with an official example
npm create astro@latest -- --template <example-name>
# create a new project based on a GitHub repository’s main branch
npm create astro@latest -- --template <github-username>/<github-repo>

By default, this command will use the template repository’s main branch. To use a different branch name, pass it as part of the --template argument: <github-username>/<github-repo>#<branch>.

Explore our themes and starters showcase where you can browse themes for blogs, portfolios, documentation, landing pages, and more! Or, search on GitHub for even more starter projects.

Success! You are now ready to start building with Astro! 🥳

Here are a few topics that we recommend exploring next. You can read them in any order. You can even leave our documentation for a bit and go play in your new Astro project codebase, coming back here whenever you run into trouble or have a question.