Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Generate Website Previews for a Directory Built with Astro

Use Astro’s development server for active edits, astro preview for the latest built output, and a hosting provider’s preview workflow for shareable review URLs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To preview an Astro directory site locally, build it and serve the finished output with astro preview. For a URL teammates or clients can open, deploy the repository with a host that provides branch or deploy previews. These are different workflows: the local preview shows your latest completed build, while a hosted preview gives reviewers a shareable URL.

Preview the built site on your computer

Astro writes static build output to dist/ by default. The preview server serves that generated output; it does not rebuild the site every time you edit a source file.

As an Amazon Associate I earn from qualifying purchases.

  1. From the Astro project directory, install dependencies if the project has not been set up yet, then start the development server using the project’s package script, commonly npm run dev. Use this while actively editing: the development server reflects source changes.
  2. Stop the development server, then run the build script, commonly npm run build. This generates the production-style output, usually in dist/.
  3. Run the project’s preview script if it has one, or invoke Astro’s CLI with npx astro preview. Open the local address printed in the terminal to inspect the built site.
  4. After changing source files, run the build again before checking the preview. Otherwise, you are still looking at the last completed build.

Use astro preview to check a build before deployment, not as production hosting. Confirm the project’s scripts in package.json; package-manager commands and custom scripts can vary. Astro documents the CLI and the distinction between development and build previews in its CLI reference and development guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Share a preview URL with reviewers

A local preview is reachable on your computer, but it does not by itself give a teammate or client a shareable deployment URL. For that, connect the repository to a hosting provider and use its preview deployment workflow.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Vercel

Astro’s Vercel guide describes a Git-based workflow in which branch pushes create Preview Deployments after the repository is imported. Changes to the configured production branch generate production deployments. See Astro on Vercel for setup details.

Netlify

Astro’s Netlify guide describes repository changes triggering preview and production deploys according to the site’s deployment configuration. For a basic static build, the documented build command is astro build (or npm run build) and the publish directory is dist. See Astro on Netlify.

These workflows are not interchangeable with the local astro preview command: a hosted preview is a deployed build intended to be opened remotely. The official guidance does not establish one provider as a universal winner; choose based on how you want repository changes and review deployments configured.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the build and output settings

For a typical static Astro site, astro build or npm run build produces output in dist/. Astro’s deployment guide describes these as common defaults. Before setting up a hosted preview, check whether your project changes the output directory, lives in a monorepo, or needs a provider-specific adapter; configure the host to use the project’s actual build command and output location.

Astro prerenders the entire site by default. A directory whose pages can be generated at build time can use static output. If pages need to render on demand, Astro requires server output configuration and the appropriate adapter for the target host. Consult Astro’s on-demand rendering guide and the deployment guide before choosing a deployment configuration.

Choose the preview workflow that fits the review

Need Use What to keep in mind
Check source changes while developing Astro development server It follows current source edits.
Inspect the generated site locally Build, then astro preview It serves the most recent completed build; rebuild after edits. It is not production hosting.
Give reviewers a remote URL for a branch or change Host-provided Preview Deployments or deploy previews Connect the repository and configure the host’s build and output settings.

Troubleshoot a preview that looks wrong

The preview does not show my latest edits

astro preview serves generated output rather than live source files. Run the build script again, then reload the preview.

The host cannot find the built site

Check that the host is building from the correct project directory and using the right command and publish directory. For the common static defaults, these are astro build (or npm run build) and dist; a custom outDir, monorepo, or adapter may require different settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pages need server-side or on-demand rendering

Static output alone is not the right configuration for pages that must render on demand. Set up Astro’s server output mode and the adapter required by the chosen host, following Astro’s on-demand rendering guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you already have a reachable local or hosted preview URL, ScreenshotNeo can return a screenshot of that page through one API request. For a hosted Astro branch preview, replace the example URL with its accessible preview URL. A remote screenshot API cannot open a directory on your computer by its local filesystem path.

See the ScreenshotNeo API documentation for request options. Example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each of these cleanup steps can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers identify the page verdict and billing status.
  • An MCP server provides screenshot, page-info, and PDF tools for AI agents and MCP clients.
  • The Free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does `astro preview` make my site public?

No. It serves the built output locally for inspection; use a hosting provider’s preview deployment workflow when reviewers need a remote URL.

Can I use ScreenshotNeo to capture an Astro preview before deployment?

Only if the preview has a URL the ScreenshotNeo API can reach. A local filesystem path is not a remotely accessible page.

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$14.94
SaleBestseller No. 2
SaleBestseller No. 4

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.