🥳 New module release: Hetzner Cloud OpenAPI Client
https://codeberg.org/small-tech/hetzner-cloud-openapi-client
This is an OpenAPI client for Node.js generated from the official Hetzner Cloud OpenAPI specification using Massimo.
Recently, while reviewing the code for Catalyst¹, I realised that the Hetzner library I was using was deprecated. The only other client library listed on Awesome Hetzner Cloud for JavaScript was updated seven years ago². So I did a bit of research and discovered that Hetzner has an official OpenAPI specification (useful little things that you can generate documentation as well as working client code from). I also discovered Massimo³, a lightweight and easy to use OpenAPI client generator.
So, anyway, a few minutes later, I had a working Node.js client generated but I thought I’d take a little more time to make it into a module in case anyone else wanted to use it.
In the process, I also created a simple web app example with Kitten⁴ where you can enter your Hetzner API key in a web interface, have it persisted to the default Kitten database⁴ and then carry out a simple call to list your servers. It’s 99 lines of code, including comments, in a single file. (Because Kitten loves you.)
The example uses the new/advanced class and event-based way of working with Kitten so you might find it interesting for that reason too (I haven’t had the chance to document this workflow properly yet). It also showcases Kitten’s Streaming HTML⁵ workflow, as well as its built-in support for semantic default styles and its first-class Markdown support.
You can see the source code for the Kitten example here:
https://codeberg.org/small-tech/hetzner-cloud-openapi-client/src/branch/main/example/index.page.js
The cool thing is that because the client is generated from the official Hetzner OpenAPI specification, it’s one command to update it should the specification change and you can be sure it matches exactly what’s in the API documentation.
Enjoy!
💕
¹ https://catalyst.small-web.org
² https://github.com/hetznercloud/awesome-hcloud#javascript
³ https://massimohttp.dev/
⁴ https://kitten.small-web.org/tutorials/persistence/
⁵ https://kitten.small-web.org/tutorials/streaming-html/
#Hetzner #HetznerCloud #API #OpenAPI #Massimo #NodeJS #JavaScript #servers #hosting #VPS #Kitten #SmallWeb #SmallTech


