CommandsSection titled Commands
Section titled astro dev
dev server. It starts an HTTP server which responds to requests for routes or pages that are specified within
src/pages directory (unless overridden by your
pages option set in the project configuration).
Section titled --port
Specifies which port to run on. Defaults to
Section titled --host [optional host address]
--host [optional host address]
Sets which network IP addresses the dev server should listen on (i.e. non-localhost IPs).
--host- listen on all addresses, including LAN and public addresses
--host [custom-address]- expose on a network IP address at
Section titled astro build
Builds your site for production.
Section titled astro preview
Starts a local static file server to serve your built
dist/ directory. Useful for previewing your static build locally, before deploying it.
This command is meant for local testing only, and is not designed to be run in production. For help with production hosting, check out our guide on Deploying an Astro Website.
Section titled astro check
Runs diagnostics (such as type-checking within
.astro files) against your project and reports errors to the console. If any errors are found the process will exit with a code of 1.
This command is intended to be used in CI workflows.
Note that this command only checks types within
📚 Read more about TypeScript support in Astro.
Section titled astro add
Adds an integration to your configuration.
Section titled astro docs
Launches the Astro Docs website directly from the terminal.
Section titled astro telemetry
Sets telemetry configuration for the current user. Telemetry is anonymous data that provides insights into which features are most often used.
Telemetry can be disabled with this CLI command:
astro telemetry disable
Telemetry can later be re-enabled with:
astro telemetry enable
clear command resets the telemetry data:
astro telemetry clear
Want to disable telemetry in CI environments? Make sure you add the
astro telemetry disablecommand to your CI scripts.
Global FlagsSection titled Global Flags
Section titled --config path
Specifies the path to the config file. Defaults to
astro.config.mjs. Use this if you use a different name for your configuration file or have your config file in another folder.
astro --config config/astro.config.mjs dev
Section titled --root path
Specifies the path to the project root. If not specified the current working directory is assumed to be the root.
The root is used for finding the Astro configuration file.
astro --root myRootFolder/myProjectFolder dev
Section titled --reload
Clears the cache (dependencies are built within Astro apps).
Section titled --verbose
Enables verbose logging, which is helpful when debugging an issue.
Section titled --silent
Enables silent logging, which is helpful when you don’t want to see Astro logs.
Section titled --version
Prints the Astro version number and exits.
Section titled --drafts
Includes Markdown draft pages in the build.
Section titled --help
Prints the help message and exits.