Getting Started
Surge publishes static web projects—HTML, CSS, and JavaScript—straight from the command line. This walkthrough takes you from nothing to a live site in about a minute.
1. Install the CLI
Surge runs on Node.js. With Node installed, grab the CLI from npm:
npm install --global surge
(If npm complains about permissions, fix npm's global prefix or use a Node version manager rather than reaching for sudo.)
2. Publish something
Go to any directory with an index.html in it—or make one:
mkdir hello-surge && cd hello-surge
echo '<h1>Hello, Surge</h1>' > index.html
surge
The first run asks you to create an account—just an email and password, right in the terminal. Then:
Running as you@example.com (Standard)
project: ./
domain: shiny-example.surge.sh
upload: [====================] 100%
plan: Standard
Success! - Published to shiny-example.surge.sh
That's the entire deploy. Your site is live on Surge's CDN, over HTTPS, with clean URLs—at the domain you accepted or typed at the prompt.
3. Ship an update
Change a file and run surge again. Each publish creates a new revision, and production cuts over atomically when the upload completes. Shipped a mistake? Undo it:
surge rollback shiny-example.surge.sh
Where to go from here
Stop typing the domain. Drop it in a CNAME file and surge deploys there without asking:
echo shiny-example.surge.sh > CNAME
Use your own domain. Point it at Surge and publish—custom domains are free, and a managed SSL certificate is one command. → Custom Domains
Preview before you ship. surge --preview publishes a revision with its own URL, without touching production. → Preview Deploys
Deploy from CI. Mint a token with surge token, set SURGE_TOKEN in your pipeline, done. → CI & Automation
Publishing a single-page app? Name your shell 200.html so deep links work. → Client-Side Routing
Or head to the CLI docs for the full tour of what surge can do.