Astro Local Development Guide
Build content sites and hybrid framework pages with Astro, default localhost:4321 development, supporting React/Vue/Svelte island components.
Astro is a web framework designed for content websites, outputting static HTML by default and allowing on-demand loading of interactive components like React, Vue, and Svelte “islands.” The LocalHost Run main site is built on Astro.
Quick Start
npm create astro@latest my-site
cd my-site
npm install
npm run devDefault localhost Access
| Purpose | Address |
|---|---|
| Development Server | http://localhost:4321 |
| Preview Production Build | http://localhost:4321 (npm run preview) |
The port can be modified in astro.config under server.port.
Common Commands
| Command | Description |
|---|---|
npm run dev | Development mode with hot reloading |
npm run build | Generates static site in dist/ |
npm run preview | Local preview of build results |
Use Cases
- Documentation sites, blogs, marketing pages (default zero JS or minimal JS)
- Mixed use with React components (e.g., tool pages with external SPA)
- Deployment to static hosts like Cloudflare Pages, Netlify, etc.
Summary
Astro is suitable for content-focused, performance-oriented sites. Local development can be accessed at http://localhost:4321, and build artifacts can be directly uploaded to a CDN or Pages.