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 dev

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:4321
Preview Production Buildhttp://localhost:4321 (npm run preview)

The port can be modified in astro.config under server.port.

Common Commands

CommandDescription
npm run devDevelopment mode with hot reloading
npm run buildGenerates static site in dist/
npm run previewLocal 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.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run