Static.app Deployment Skill
Deploy static websites and applications to Static.app hosting directly from OpenClaw.
Workspace Structure
All Static.app operations in your workspace use a dedicated folder structure:
CODEBLOCK0
- - New sites: Created in
staticapp/ subfolders before deployment - Downloaded sites: Extracted to
staticapp/{pid}/ for editing
How Static.app Handles Files
Static.app automatically creates clean URLs from your filenames:
| File | URL |
|---|
| INLINECODE2 | INLINECODE3 (homepage) |
| INLINECODE4 |
/about |
|
portfolio.html |
/portfolio |
|
contact.html |
/contact |
No subdirectories needed! Just create .html files in the root folder.
Project Structure
Simple Multi-Page Site
CODEBLOCK1
JavaScript App (React, Vue, etc.)
For JS apps, build first, then deploy the dist (or build) folder:
CODEBLOCK2
Prerequisites
- 1. Get API Key: Go to https://static.app/account/api and create an API key (starts with
sk_) - Set Environment Variable: Store the API key in
STATIC_APP_API_KEY env var
Usage
Deploy Multi-Page Site
CODEBLOCK3
Deploy Specific Directory
CODEBLOCK4
Update Existing Site
CODEBLOCK5
List All Sites
CODEBLOCK6
List Site Files
CODEBLOCK7
Options:
- -
--raw — Output raw JSON - INLINECODE16 — Specify API key
Delete Site
CODEBLOCK8
Options:
- -
-f, --force — Skip confirmation prompt - INLINECODE18 — Specify API key
Download Site
Download an existing site to your workspace for editing:
CODEBLOCK9
This will:
- 1. Fetch the download URL from Static.app API
- Download the site archive
- Extract it to INLINECODE19
Options:
- -
-p, --pid — Site PID to download - INLINECODE21 — Custom output directory (default:
./staticapp/{pid}) - INLINECODE23 — Specify API key
- INLINECODE24 — Output raw JSON response
Example:
CODEBLOCK10
Script Options
CODEBLOCK11
Default Exclusions
The following are automatically excluded from deployment:
- - INLINECODE25
- INLINECODE26 , INLINECODE27
- INLINECODE28
- INLINECODE29
- INLINECODE30
- INLINECODE31
Important Notes
✅ What Works
- - Static HTML sites — Any number of
.html pages - CSS & JavaScript — Frontend frameworks, vanilla JS
- Images & Assets — Place in
images/ folder or root - JavaScript files — Place in
js/ folder or root - Built JS Apps — Deploy
dist/ or build/ folder after INLINECODE37
❌ What Doesn't Work
- - Node.js Server Apps — No server-side rendering, no Express.js, no API routes
- PHP, Python, Ruby — Static.app only serves static files
- Databases — Use client-side storage or external APIs
JavaScript Apps Workflow
CODEBLOCK12
API Reference
Deploy Site
- - Endpoint: INLINECODE38
- Auth: Bearer token (API key)
- Body: Multipart form with
archive (zip file) and optional INLINECODE40
List Sites
- - Endpoint: INLINECODE41
- Auth: Bearer token (API key)
- Headers: INLINECODE42
List Site Files
- - Endpoint: INLINECODE43
- Auth: Bearer token (API key)
- Headers: INLINECODE44
Delete Site
- - Endpoint: INLINECODE45
- Auth: Bearer token (API key)
- Headers: INLINECODE46
Download Site
- - Endpoint: INLINECODE47
- Auth: Bearer token (API key)
- Headers: INLINECODE48
- Response: Returns download URL for the site archive
Dependencies
- -
archiver — Zip archive creation - INLINECODE50 — Multipart form encoding
- INLINECODE51 — HTTP requests
- INLINECODE52 — Zip extraction
Install with: INLINECODE53
Response
On success, the script outputs:
CODEBLOCK13
Workflow
- 1. Check for
STATIC_APP_API_KEY env var or INLINECODE55 - Create zip archive from source directory (with exclusions)
- Upload to Static.app API
- Parse response and output URLs
- Clean up temporary zip file
Error Handling
- - Missing API key → Clear error with instructions
- Network issues → HTTP error details
- Invalid PID → API error message
Static.app 部署技能
直接从 OpenClaw 将静态网站和应用部署到 Static.app 托管平台。
工作区结构
工作区中所有 Static.app 操作均使用专用文件夹结构:
workspace/
└── staticapp/ # 所有 Static.app 操作的主文件夹
├── new-site/ # 本地创建的新站点
└── {pid}/ # 下载的现有站点(按 PID 命名)
- - 新站点:部署前在 staticapp/ 子文件夹中创建
- 下载的站点:解压到 staticapp/{pid}/ 进行编辑
Static.app 文件处理方式
Static.app 会根据文件名自动生成简洁 URL:
| 文件 | URL |
|---|
| index.html | /(首页) |
| about.html |
/about |
| portfolio.html | /portfolio |
| contact.html | /contact |
无需子目录! 只需在根文件夹中创建 .html 文件即可。
项目结构
简单多页面站点
my-site/
├── index.html # 首页 → /
├── about.html # 关于页面 → /about
├── portfolio.html # 作品集 → /portfolio
├── contact.html # 联系方式 → /contact
├── style.css # 样式表
├── js/ # JavaScript 文件
│ ├── main.js
│ └── utils.js
└── images/ # 图片文件夹
├── logo.png
└── photo.jpg
JavaScript 应用(React、Vue 等)
对于 JS 应用,先构建,然后部署 dist(或 build)文件夹:
bash
构建应用
npm run build
部署 dist 文件夹
node scripts/deploy.js ./dist
前置条件
- 1. 获取 API 密钥:访问 https://static.app/account/api 创建 API 密钥(以 sk 开头)
- 设置环境变量:将 API 密钥存储在 STATICAPPAPIKEY 环境变量中
使用方法
部署多页面站点
bash
创建页面
echo
首页
> index.html
echo
关于
> about.html
echo
作品集
> portfolio.html
部署
node scripts/deploy.js
部署指定目录
bash
node scripts/deploy.js ./my-site
更新现有站点
bash
node scripts/deploy.js . --pid olhdscieyr
列出所有站点
bash
node scripts/list.js
列出站点文件
bash
node scripts/files.js YOUR_PID
选项:
- - --raw — 输出原始 JSON
- -k — 指定 API 密钥
删除站点
bash
node scripts/delete.js YOUR_PID
选项:
- - -f, --force — 跳过确认提示
- -k — 指定 API 密钥
下载站点
将现有站点下载到工作区进行编辑:
bash
node scripts/download.js YOUR_PID
此操作将:
- 1. 从 Static.app API 获取下载 URL
- 下载站点归档文件
- 解压到 staticapp/{pid}/
选项:
- - -p, --pid — 要下载的站点 PID
- -o, --output — 自定义输出目录(默认:./staticapp/{pid})
- -k — 指定 API 密钥
- --raw — 输出原始 JSON 响应
示例:
bash
下载站点到默认位置
node scripts/download.js abc123
下载到自定义文件夹
node scripts/download.js abc123 -o ./my-site
脚本选项
node scripts/deploy.js [SOURCE_DIR] [OPTIONS]
参数:
SOURCE_DIR 要部署的目录(默认:当前目录)
选项:
-k, --api-key API 密钥(或设置 STATICAPPAPI_KEY 环境变量)
-p, --pid 更新现有站点的项目 PID
-e, --exclude 逗号分隔的排除模式
--keep-zip 部署后保留 zip 归档文件
默认排除项
以下内容自动排除在部署之外:
- - node_modules
- .git、.github
- .md
- package.json
- .env
- .openclaw
重要说明
✅ 支持的功能
- - 静态 HTML 站点 — 任意数量的 .html 页面
- CSS 和 JavaScript — 前端框架、原生 JS
- 图片和资源 — 放置在 images/ 文件夹或根目录
- JavaScript 文件 — 放置在 js/ 文件夹或根目录
- 构建后的 JS 应用 — 在 npm run build 后部署 dist/ 或 build/ 文件夹
❌ 不支持的功能
- - Node.js 服务器应用 — 不支持服务端渲染、Express.js、API 路由
- PHP、Python、Ruby — Static.app 仅提供静态文件服务
- 数据库 — 使用客户端存储或外部 API
JavaScript 应用工作流程
bash
1. 构建 React/Vue/Angular 应用
npm run build
2. 部署构建输出
node scripts/deploy.js ./dist --pid YOUR_PID
API 参考
部署站点
- - 端点:POST https://api.static.app/v1/sites/zip
- 认证:Bearer 令牌(API 密钥)
- 请求体:包含 archive(zip 文件)和可选 pid 的多部分表单
列出站点
- - 端点:GET https://api.static.app/v1/sites
- 认证:Bearer 令牌(API 密钥)
- 请求头:Accept: application/json
列出站点文件
- - 端点:GET https://api.static.app/v1/sites/files/{pid}
- 认证:Bearer 令牌(API 密钥)
- 请求头:Accept: application/json
删除站点
- - 端点:DELETE https://api.static.app/v1/sites/{pid}
- 认证:Bearer 令牌(API 密钥)
- 请求头:Accept: application/json
下载站点
- - 端点:GET https://api.static.app/v1/sites/download/{pid}
- 认证:Bearer 令牌(API 密钥)
- 请求头:Accept: application/json
- 响应:返回站点归档文件的下载 URL
依赖项
- - archiver — 创建 zip 归档
- form-data — 多部分表单编码
- node-fetch — HTTP 请求
- adm-zip — 解压 zip 文件
安装方式:cd scripts && npm install
响应
成功时,脚本输出:
✅ 部署成功!
🌐 站点 URL:https://xyz.static.app
📋 PID:abc123
STATICAPPURL=https://xyz.static.app
STATICAPPPID=abc123
工作流程
- 1. 检查 STATICAPPAPI_KEY 环境变量或 --api-key 参数
- 从源目录创建 zip 归档(含排除项)
- 上传到 Static.app API
- 解析响应并输出 URL
- 清理临时 zip 文件
错误处理
- - 缺少 API 密钥 → 显示带说明的清晰错误信息
- 网络问题 → HTTP 错误详情
- 无效 PID → API 错误消息