Skip to content

Patrick0308/statichub

Repository files navigation

StaticHub

StaticHub is a static hosting platform for front-end projects. It supports fast anonymous deploys, named project deploys with auth, deployment history, and rollback.

Quick Start

Install CLI:

curl -sSL https://raw.githubusercontent.com/Patrick0308/statichub/main/scripts/install.sh | sh

Deploy a directory:

statichub deploy ./dist

Deploy a single HTML file:

statichub deploy ~/Downloads/page.html

Output:

📦 Collecting files from /Users/patrick/Downloads/page.html...
   Found 1 files
🚀 Deploying to https://statichub.dev...
✅ Deploy successful!
   URL: http://b7kr7b.statichub.dev
   Subdomain: b7kr7b

Login and deploy to a named project:

statichub login
statichub deploy ./dist --name my-app

CLI Commands

statichub deploy <path> [--name <project>] [--config statichub.yaml]
statichub login
statichub logout
statichub list
statichub info <project>
statichub rollback <project> <version>
statichub apikey create <name>
statichub apikey list
statichub apikey revoke <id>

STATICHUB_API_KEY:

  • If set, deploy --name, list, info, and rollback use it as auth and do not require statichub login.
  • apikey management commands still require statichub login.

statichub Skill (for AI Agents)

This repository includes a reusable skill at skills/statichub for agents that need to deploy AI-generated static output safely.

Install with npx skills:

npx skills add Patrick0308/statichub --skill statichub

Global install:

npx skills add Patrick0308/statichub --skill statichub -g

Check installed skills:

npx skills ls

Skill behavior summary:

  1. Requires explicit deploy path: statichub deploy <path>
  2. Accepts only a non-empty directory or non-empty .html file
  3. Stops on validation failure and returns repair commands
  4. Uses named deploy when --name is present, anonymous otherwise

Real output example:

✅ Deploy successful!
   URL: http://b7kr7b.statichub.dev
   Subdomain: b7kr7b

The URL value is the live page URL.

Optional Config (statichub.yaml)

clean_urls: true
spa: true
redirects:
  - from: /old-path
    to: /new-path
    status: 301
headers:
  - path: /*
    headers:
      X-Frame-Options: DENY
directory_index:
  - index.html

Run Server Locally

Create .env values and start server:

cp .env.example .env
statichub-server db init
statichub-server serve

Important env vars:

  • STATICHUB_PORT
  • STATICHUB_ALLOWED_DOMAINS
  • STATICHUB_DATABASE_URL
  • STATICHUB_STORAGE_PATH

Optional auth env vars (required only when auth is enabled):

  • STATICHUB_JWT_SECRET
  • STATICHUB_GOOGLE_CLIENT_ID
  • STATICHUB_GOOGLE_CLIENT_SECRET
  • STATICHUB_GOOGLE_REDIRECT_URL

Quick local startup behavior:

  • If STATICHUB_GOOGLE_CLIENT_ID and STATICHUB_GOOGLE_CLIENT_SECRET are both set, auth is enabled (existing behavior).
  • If either one is missing, server starts in auth-disabled local mode.
  • In auth-disabled local mode:
  • /auth/* returns 503
  • authenticated management APIs return 503
  • anonymous deploy and static serving remain available

Routing Behavior

  • Base domain (for example statichub.io) serves the built-in product homepage.
  • Subdomains serve deployed static files for projects (for example my-app.statichub.io).
  • Built-in homepage assets are reserved under /__home/*.

Development

Run tests:

cargo test --workspace

Project layout:

cli/      # CLI binary
server/   # API server and static serving
shared/   # shared types
skills/   # reusable agent skills
docs/     # docs and plans

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors