Configuration Files and Environment Variables

Working with configuration files and environment variables is a common task in web applications. Astro has its own ways of handling configurations and environment variables. In this lesson, we’ll take a look at the basic structure of an Astro configuration file, as well as how to work with environment variables.

Astro configuration file

Just like other frameworks, Astro also comes with its own configuration file. The configuration file will always need to be at the root of the project directory, called astro.config.mjs. At the very basics, this file needs to export an empty defineConfig function call.

Get hands-on with 1200+ tech skills courses.