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

Step 1 — Build Production Mode
Access your Astro project from the terminal and run:
npm run buildAstro creates a dist folder containing the production build of your site.
Step 2 — Install Surge CLI
Install Surge globally on your machine:
npm install --global surgeVerify the installation:
surge --versionStep 3 — Deploy to Surge
Run the Surge command from inside your dist folder:
cd distsurgeFirst-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.shOpen it in your browser. Your Blacks site is now live.
Updating Your Site
To update the live site:
npm run buildcd distsurgeSurge uploads the new files and replaces the old ones.
Custom Domain
Surge supports custom domains.
Steps:
- Deploy to Surge and note your
*.surge.shURL - Add a CNAME record at your domain registrar pointing to your Surge URL
- Run
surgeagain and enter your custom domain when prompted
For example:
docs.yourdomain.com → your-project.surge.shBuild Settings Summary
| Setting | Value |
|---|---|
| Build command | npm run build |
| Output directory | dist |
| Deploy command | surge (from inside dist) |
Troubleshooting
| Problem | Solution |
|---|---|
surge: command not found | Reinstall with npm install --global surge |
| Login fails | Check your email and password, or reset your password |
| Domain already taken | Choose a different domain name |
| Changes not showing | Hard refresh in your browser (Ctrl + Shift + R) |
| Deployment stuck | Check 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