Skip to main content

Installation

Get started with Astro by installing it in your project. This guide covers both automatic setup with create-astro and manual installation.

Prerequisites

Before installing Astro, ensure you have the following installed on your system:

Node.js

Version 22.12.0 or higher (or version 20.19.1)

Package manager

npm (v9.6.5+), pnpm (v7.1.0+), or Yarn
You can check your Node.js version by running node -v in your terminal. If you need to install or update Node.js, visit nodejs.org.
Astro also supports:
  • Text editor: We recommend VS Code with the Astro extension
  • Terminal: Astro is accessed through its command-line interface (CLI)
The fastest way to set up a new Astro project is with create-astro. This automated CLI tool will scaffold a new project with everything you need to get started.
1

Run the create-astro command

Open your terminal and run the following command using your preferred package manager:
The create-astro wizard will guide you through the setup process.
2

Choose your project options

The CLI will ask you several questions:
  • Where would you like to create your new project? - Enter a directory name (e.g., my-astro-site)
  • How would you like to setup your new project? - Choose a template or start from scratch
  • Install dependencies? - Recommended: Yes
  • Initialize a git repository? - Recommended: Yes
  • Add integrations? - Optional: Select any you want to add now
You can skip all prompts and use defaults by adding the --yes flag:
3

Navigate to your project

Once the installation is complete, navigate to your new project directory:
4

Start the dev server

Start the local development server:
Astro will start a local development server at http://localhost:4321.

Using a template

You can start with a specific template by using the --template flag:
Browse all official templates at astro.new or view the examples directory on GitHub.

Using a GitHub repository

You can also use any public GitHub repository as a template:

Manual installation

If you prefer to set up Astro manually in an existing project, follow these steps:
1

Install Astro

Install the astro package using your package manager:
2

Create your first page

Create a src/pages directory and add an index.astro file:
src/pages/index.astro
3

Create the public directory

Create a public/ directory at the root of your project for static assets like images and fonts.
4

Create astro.config.mjs

Create an Astro configuration file at the root of your project:
astro.config.mjs
5

Create tsconfig.json

Create a TypeScript configuration file (even if you’re not using TypeScript):
tsconfig.json
6

Update package.json scripts

Add the following scripts to your package.json:
package.json

CLI flags

Customize your installation with these flags:
string
Specify a template to use (e.g., minimal, blog, portfolio)
boolean
Automatically install dependencies
boolean
Skip dependency installation
boolean
Initialize a git repository
boolean
Skip git initialization
string
Add integrations (e.g., --add react,tailwind)
boolean
Skip all prompts by accepting defaults
boolean
Skip all prompts by declining defaults
boolean
Walk through steps without executing

Example with flags

Editor setup

For the best development experience, we recommend:

VS Code

Install the official Astro VS Code extension for:
  • Syntax highlighting for .astro files
  • TypeScript type information
  • VS Code IntelliSense for code completion and hints

Other editors

Next steps

Now that you have Astro installed, you’re ready to start building!

Quick start tutorial

Follow our step-by-step tutorial to build your first Astro site

Core concepts

Learn about the Astro core concepts