Installation
Get started with Astro by installing it in your project. This guide covers both automatic setup withcreate-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.- Text editor: We recommend VS Code with the Astro extension
- Terminal: Astro is accessed through its command-line interface (CLI)
Automatic installation (recommended)
The fastest way to set up a new Astro project is withcreate-astro. This automated CLI tool will scaffold a new project with everything you need to get started.
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.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
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:Create your first page
Create a
src/pages directory and add an index.astro file:src/pages/index.astro
Create the public directory
Create a
public/ directory at the root of your project for static assets like images and fonts.Create astro.config.mjs
Create an Astro configuration file at the root of your project:
astro.config.mjs
Create tsconfig.json
Create a TypeScript configuration file (even if you’re not using TypeScript):
tsconfig.json
CLI flags
Customize your installation with these flags:Specify a template to use (e.g.,
minimal, blog, portfolio)Automatically install dependencies
Skip dependency installation
Initialize a git repository
Skip git initialization
Add integrations (e.g.,
--add react,tailwind)Skip all prompts by accepting defaults
Skip all prompts by declining defaults
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
.astrofiles - TypeScript type information
- VS Code IntelliSense for code completion and hints
Other editors
- JetBrains IDEs: Install the Astro plugin
- Vim/Neovim: Install astro-vim
- Sublime Text: Install Astro syntax highlighting
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