npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@modexvpn/hcloud

v1.4.2

Published

SDK for Hetzner Cloud API

Readme

@modexvpn/hcloud

A clean, type-safe SDK for the Hetzner Cloud API using Node.js, TypeScript, and Zod.

Features

  • 🔐 Zod-powered runtime validation — fully JavaScript-safe
  • 🧠 Fully type-safe using TypeScript with z.infer<> and enums
  • 📆 Modular structure: hcloud.servers.list(), hcloud.locations.getById()
  • ⚠️ Centralized error handling with formatHcloudError()
  • ⚙️ Axios-based HTTP client with auto-authentication
  • 🔁 ESM and CommonJS compatible
  • 🗂️ Clean folder structure for scalability and maintainability

SDK Status

This SDK is stable, but not yet feature-complete.
We're already on v1.x and will maintain backward compatibility.
Any breaking changes will be released as v2.0.0.


🚀 What's New in v1.4

  • createSSHKey(options) — Create a new SSH key
  • getSSHKeys() — List all SSH keys
  • getSSHKey(id) — Get a single SSH key by ID
  • updateSSHKey(id, options) — Update an existing SSH key
  • deleteSSHKey(id) — Delete an SSH key

✍️ Usage Examples

Create SSH Key

const sshKey = await hcloud.security.createSSHKey({
  name: "modex-prod-key",
  public_key: "ssh-ed25519 AAAAC3N...",
  labels: { environment: "prod" }
})

List SSH Keys

const allKeys = await hcloud.security.listSSHKeys()

Get SSH Key by ID

const key = await hcloud.security.getSSHKey(12345)

Update SSH Key

const updated = await hcloud.security.updateSSHKey(12345, {
  name: "modex-updated-key",
  labels: { updated: "true" }
})

Delete SSH Key

await hcloud.security.deleteSSHKey(12345)

📆 Installation

npm install @modexvpn/hcloud

🧠 Usage

List all servers

import { hcloud } from '@modexvpn/hcloud'

const servers = await hcloud.servers.list()

Get a single server by ID

const server = await hcloud.servers.getById(123456)

Fetch server metrics

const metrics = await hcloud.servers.getMetrics(123456)

Power control

await hcloud.servers.powerControl.off(123456)
await hcloud.servers.powerControl.reboot(123456)
await hcloud.servers.powerControl.on(123456)
await hcloud.servers.powerControl.reset(123456)
await hcloud.servers.powerControl.shutdown(123456)

Create a server

await hcloud.servers.create({
  name: 'test-server',
  server_type: 'cx21',
  image: 'ubuntu-22.04',
  location: 'nbg1',
  ssh_keys: ['ssh-key-id'],
})

Delete a server

await hcloud.servers.delete(123456)

SSH Into Server

const { stdout } = await sshIntoServer("192.168.1.100", "apt update && apt upgrade -y", "root")
console.log(stdout)

💡 Requires SSH_PRIVATE_KEY in your environment


🔢 Environment Setup

Create a .env file and add your Hetzner API token:

HCLOUD_API_TOKEN=your-token-here

📁 Project Structure

@modexvpn/hcloud
├── client.ts
├── index.ts
├── sdk/
│   ├── servers/
│   │   ├── actions/
│   │   │   └── sshIntoServer.ts
│   │   ├── createServer.ts
│   │   └── server-type/
│   │       ├── getServerTypes.ts
│   │       ├── getServerType.ts
│   │       └── index.ts
│   └── locations/
│       └── datacenters/
│           ├── getDatacenters.ts
│           └── getDatacenter.ts
├── types/
│   ├── common/
│   ├── enums/
│   ├── errors/
│   ├── ...
├── utils/
│   └── formatError.ts
├── tsconfig.json
├── tsup.config.ts
├── README.md

🔫 API Coverage

Core Resources

Security

Storage & Networking

Firewalls & IPs

Load Balancers

Billing


📝 Contributing

PRs welcome! Please follow the existing structure and run:

npm run lint
npm run build

📄 Resources

👉 License

MIT © 2025 MODEX