Skip to content

Astro CLI Commands

Use these commands from the root of an Astro project.

Start the local development server.

Terminal window
npm run dev

Build the production site.

Terminal window
npm run build

Preview the production build locally.

Terminal window
npm run preview

Run Astro CLI commands through the project script.

Terminal window
npm run astro -- --help

Check the project for type, content, and config issues.

Terminal window
npm run astro -- check

Add an integration.

Terminal window
npm run astro -- add starlight

Create a new Astro app.

Terminal window
npm create astro@latest APP_NAME

Create a new Starlight docs site.

Terminal window
npm create astro@latest APP_NAME -- --template starlight

Install dependencies.

Terminal window
npm install

Install a package.

Terminal window
npm install PACKAGE_NAME