Astro cheatsheet

Astro: CLI

6 common Astro tasks.

Create a project

Scaffold a new Astro site interactively.

npm create astro@latest

Start the dev server

Run the site at http://localhost:4321 with hot reload.

npm run dev

Build for production

Generate the site into dist. Static sites become plain HTML files.

npm run build

Preview the build

Serve the production build locally.

npm run preview

Add an integration

Install and configure a framework or tool such as React, Tailwind or MDX.

npx astro add react

Type-check the project

Check .astro files and TypeScript for errors.

npx astro check

Was this page helpful?