Expand description
ยงSurge SDK for Rust
A type-safe Rust interface for the Surge.sh API, enabling programmatic management of static site deployments, domains, SSL certificates, and DNS records.
ยงKey Features
- ๐ Zero-config publishing to
.surge.sh
domains - ๐ SSL certificate management (requires Pro account)
- ๐ DNS and domain zone configuration
- ๐ Real-time deployment event streaming
- ๐ ๏ธ Async-first design using
reqwest
andtokio
ยงQuick Start
use surge_sdk::{Config, SurgeSdk, Auth, SURGE_API};
use std::path::Path;
#[tokio::main]
async fn main() -> Result<(), surge_sdk::SurgeError> {
let config = Config::new(SURGE_API, "0.1.0")?;
let sdk = SurgeSdk::new(config)?;
let auth = Auth::Token("your-api-token".into());
sdk.publish(Path::new("./dist"), "your-domain.surge.sh", &auth, None, None).await?;
Ok(())
}
Re-exportsยง
pub use config::Config;
pub use error::SurgeError;
pub use sdk::SurgeSdk;
pub use stream::calculate_metadata;
pub use stream::publish;
pub use types::Auth;
pub use types::Event;
pub use utils::generate_domain;
pub use utils::json_to_argv;
pub use responses::*;
Modulesยง
- config
- Configuration module for the Surge SDK.
- error
- Error handling module for the Surge SDK.
- responses
- Response Types for Surge API
- sdk
- Surge SDK for interacting with the Surge API.
- stream
- Module for streaming project publishing functionality in the Surge SDK.
- types
- Module defining core data types for the Surge SDK.
- utils
- Module for utility functions in the Surge SDK.
Constantsยง
- SURGE_
API - The default Surge.sh API endpoint