System requirements
Before installing, ensure your system meets these requirements:- Node.js - version
18.17.1or20.3.0or higher (runnode -vto check) - A package manager - npm (included with Node.js), yarn, or pnpm
- Terminal/Command line access
- Text editor or IDE (VS Code recommended)
Installation methods
You can install the template in two ways:Method 1: Using the Astro CLI (Recommended)
The easiest way to get started is using Astro’s official CLI:- Download the latest minimal Astro template
- Prompt you for project configuration
- Set up the project structure
- Optionally install dependencies and initialize git
Method 2: Manual setup
If you prefer manual control, you can set up the project yourself:Project structure
After installation, your project will have this structure:Understanding the files
package.json
package.json
Defines your project dependencies and npm scripts:
- type: “module” - Enables ES modules
- scripts - Command shortcuts for development and building
- dependencies - Only Astro core is required
astro.config.mjs
astro.config.mjs
The main configuration file for Astro. The minimal template starts with an empty config:You can add integrations, configure build options, and more here.
tsconfig.json
tsconfig.json
TypeScript configuration with strict type checking enabled:This extends Astro’s strict TypeScript config for better type safety.
src/pages/index.astro
src/pages/index.astro
The main landing page template:The
--- markers define the component script (frontmatter), and below is the HTML template.Available commands
Once installed, you have access to these npm scripts:| Command | Action |
|---|---|
npm install | Installs dependencies |
npm run dev | Starts local dev server at localhost:4321 |
npm run build | Build your production site to ./dist/ |
npm run preview | Preview your build locally, before deploying |
npm run astro ... | Run CLI commands like astro add, astro check |
npm run astro -- --help | Get help using the Astro CLI |
Replace
npm with yarn or pnpm if you’re using a different package manager.Starting the development server
To start building your landing page, run the development server:http://localhost:4321 with hot module reloading enabled.
Building for production
When you’re ready to deploy, create a production build:./dist/ directory.
Previewing the build
Test your production build locally before deploying:VS Code setup (Optional)
For the best development experience with VS Code:Install the Astro extension
Install the official Astro VS Code extension for syntax highlighting, IntelliSense, and more.You can install it directly from VS Code:
- Open the Extensions panel (Ctrl+Shift+X / Cmd+Shift+X)
- Search for “Astro”
- Click Install on the official Astro extension
Troubleshooting
Port 4321 is already in use
If port 4321 is already in use, Astro will automatically try the next available port. You can also specify a custom port:Module not found errors
If you see module not found errors, try deletingnode_modules and reinstalling:
TypeScript errors
If you see TypeScript errors, make sure your dependencies are installed and run:Next steps
Now that you have everything installed, you’re ready to start building:Quick start guide
Follow the quickstart to build your first landing page
Astro documentation
Learn more about Astro’s features and capabilities