Black FridayEnds inGet up to 50% off →
htmlhost.co
cligetting starteddeploytutorialweb hosting

Getting Started with the Htmlhost CLI

htmlhost.co·September 14, 2026·3 min read
Getting Started with the Htmlhost CLI

Why use a CLI for hosting?

You already have a code editor and a terminal open. Your HTML files live in a project folder. So why should you have to open a browser, find a hosting dashboard, and drag files around just to get a URL?

The htmlhost CLI lets you publish straight from your terminal. One command, and your project is live. No context-switching, no extra tabs, no upload forms.

Installing the CLI

The CLI is a single npm package with zero dependencies. If you have Node.js 18 or later, you're all set.

npm i -g htmlhost-cli

After installation, the htmlhost command is available globally in your terminal.

Authenticating

htmlhost login

The CLI opens a browser approval page. Sign in, check the displayed code against your terminal and approve the request you started. Return to the terminal when approval is complete. If the browser does not open, use the URL printed by the command.

For token-based automation, htmlhost login --token <token> remains available with a token created in Settings → API Keys. Keep tokens private. Normal interactive login does not require creating and pasting a token manually.

Your first deploy

Navigate to a folder that contains an index.html file and run:

htmlhost deploy

This deploys the current working directory. htmlhost deploy . does the same thing; the trailing dot is optional.

That's it. The CLI scans deployable files in the folder, respecting its exclusions and limits, uploads them, and gives you a live URL like https://bold-fern-x3k.htmlhost.co.

You'll see a summary of all the files being deployed, and a confirmation prompt before anything goes live. Every HTML file becomes a page, and all your CSS, JavaScript, images, and fonts come along for the ride.

Re-deploying

When you make changes and run htmlhost deploy again, the CLI remembers your site. It doesn't create a new URL each time. Instead, it updates the existing site in place. Your URL stays the same, but the content is fresh.

This is possible because the CLI stores a small .htmlhost file in your project folder. That file links your local project to the remote site. You never have to manage slugs or remember URLs.

Deploying a single file

If you only have one HTML file and don't want to deploy a whole directory, just point to it:

htmlhost deploy page.html

The single-file path processes supported local asset references, inlining or uploading assets as appropriate. Review its output and test the published page; runtime requests and external services can still need a network connection. Deploy a folder when you want to preserve a multi-file project.

What happens behind the scenes

When you deploy, the CLI:

  • Scans your folder for files (skipping node_modules, .git, and other junk)
  • Maps HTML files to clean URL paths (about.html becomes /about)
  • Uploads assets with content-based hashing, so unchanged files are skipped
  • Gives your site HTTPS and CDN delivery automatically

There's no build step and no configuration file. The folder you deploy is the site you get.

Useful options

OptionWhat it does
--ttl 30dChoose a site lifetime: 1d, 7d, 30d, or never (the default)
--title "My Site"Give the site a title visible on your dashboard
--newForce a brand-new site instead of updating the linked one
--jsonOutput the result as JSON (useful for CI/CD scripts)

Next steps

Once you're comfortable deploying, there's more you can do from the CLI. You can pull remote changes that were made through the web editor, clone an existing site into a local folder, or let the CLI automatically detect conflicts before you overwrite someone else's work.

Start with npm i -g htmlhost-cli and see how fast your next project goes live.

Use the CLI from your editor

You can also work through the VS Code extension, available on the Visual Studio Marketplace and Open VSX. It runs the CLI in your editor terminal. The Claude connector and local MCP provide another route for AI-assisted site work; creating a private draft and publishing it are separate actions.

Ready to try it yourself?

Import your HTML, check the preview, then publish a link you can share and update.

Start hosting