Skip to content

Surge

Deploy an Astro Website to Surge

Surge is a simple CLI-based static hosting platform. It’s one of the fastest ways to get a static site online — no dashboard, no Git integration, just a command.

This guide walks you through deploying your Blacks project to Surge.


Surge Deploy

Surge astro js themes template


Step 1 — Build Production Mode

Access your Astro project from the terminal and run:

Terminal window
npm run build

Astro creates a dist folder containing the production build of your site.


Step 2 — Install Surge CLI

Install Surge globally on your machine:

Terminal window
npm install --global surge

Verify the installation:

Terminal window
surge --version

Step 3 — Deploy to Surge

Run the Surge command from inside your dist folder:

Terminal window
cd dist
surge

First-time users: Surge prompts you to create an account. Enter your email and a password — this takes about 30 seconds.

After registration, Surge asks for a domain name. You can accept the suggested one (like random-name.surge.sh) or enter your own.

Surge uploads your files and publishes them.


Step 4 — Your Site Is Live

After deployment, Surge outputs your live URL:

https://your-project.surge.sh

Open it in your browser. Your Blacks site is now live.


Updating Your Site

To update the live site:

Terminal window
npm run build
cd dist
surge

Surge uploads the new files and replaces the old ones.


Custom Domain

Surge supports custom domains.

Steps:

  1. Deploy to Surge and note your *.surge.sh URL
  2. Add a CNAME record at your domain registrar pointing to your Surge URL
  3. Run surge again and enter your custom domain when prompted

For example:

docs.yourdomain.com → your-project.surge.sh

Build Settings Summary

SettingValue
Build commandnpm run build
Output directorydist
Deploy commandsurge (from inside dist)

Troubleshooting

ProblemSolution
surge: command not foundReinstall with npm install --global surge
Login failsCheck your email and password, or reset your password
Domain already takenChoose a different domain name
Changes not showingHard refresh in your browser (Ctrl + Shift + R)
Deployment stuckCheck your internet connection and retry

Why Use Surge?

Surge is great for:

  • Quick previews — deploy a folder in seconds
  • Personal projects — no dashboard, no Git required
  • Testing — spin up a URL to share with clients
  • Simple sites — no configuration needed

Limitations:

  • No Git integration — you deploy manually each time
  • No automatic rebuilds on push
  • Limited features compared to Cloudflare, Netlify, or Vercel

For production sites with frequent updates, Cloudflare Pages or Netlify are better choices. Surge is best for one-off deployments or quick previews.


Next Step

Explore other hosting options:

👉 Cloudflare — free hosting with automatic Git deploys