Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/nuke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ on:
description: "Eas"
type: boolean
default: false
hostinger:
description: "Hostinger"
type: boolean
default: false

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
typesense: ${{ steps.force.outputs.all || steps.changes.outputs.typesense }}
workos: ${{ steps.force.outputs.all || steps.changes.outputs.workos }}
expo-eas: ${{ steps.force.outputs.all || steps.changes.outputs.expo-eas }}
hostinger: ${{ steps.force.outputs.all || steps.changes.outputs.hostinger }}
steps:
- id: force
if: contains(github.event.pull_request.labels.*.name, 'force-ci')
Expand Down Expand Up @@ -110,6 +111,9 @@ jobs:
expo-eas:
- 'packages/expo-eas/**'
- 'packages/core/**'
hostinger:
- 'packages/hostinger/**'
- 'packages/core/**'

ci-core:
needs: detect-changes
Expand Down Expand Up @@ -494,3 +498,22 @@ jobs:
working-directory: packages/expo-eas
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}

ci-hostinger:
needs: detect-changes
if: needs.detect-changes.outputs.hostinger == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run build
working-directory: packages/core
- run: bun run check
working-directory: packages/hostinger
- run: bun run test
working-directory: packages/hostinger
env:
HOSTINGER_API_TOKEN: ${{ secrets.HOSTINGER_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@
shallow = true
ignore = dirty
fetchRecurseSubmodules = false
[submodule "packages/hostinger/specs/api"]
path = packages/hostinger/specs/api
url = https://github.com/hostinger/api.git
59 changes: 39 additions & 20 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions packages/hostinger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# @distilled.cloud/hostinger

Effect-native SDK for the [Hostinger API](https://developers.hostinger.com), generated from the official [OpenAPI specification](https://github.com/hostinger/api). Covers VPS, DNS, Domains, Hosting, Billing and Reach with exhaustive error typing.

## Installation

```bash
npm install @distilled.cloud/hostinger effect
```

## Quick Start

```typescript
import { Effect, Layer } from "effect";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import { CredentialsFromEnv } from "@distilled.cloud/hostinger/credentials";
import { VPSGetDataCenterListV1 } from "@distilled.cloud/hostinger/operations";

const MainLayer = Layer.merge(CredentialsFromEnv, FetchHttpClient.layer);

const program = Effect.gen(function* () {
const dataCenters = yield* VPSGetDataCenterListV1({});
for (const dc of dataCenters) {
console.log(`${dc.id}: ${dc.name} (${dc.city})`);
}
});

await Effect.runPromise(program.pipe(Effect.provide(MainLayer)));
```

## Configuration

| Environment variable | Description |
|---|---|
| `HOSTINGER_API_TOKEN` | API token — create one at [hpanel.hostinger.com/profile/api](https://hpanel.hostinger.com/profile/api) |
| `HOSTINGER_API_BASE_URL` | Optional override of the API base URL (default `https://developers.hostinger.com`) |

## Error Handling

Every operation returns typed errors in the Effect error channel:

```typescript
import { Effect } from "effect";
import { VPSGetVirtualMachineV1 } from "@distilled.cloud/hostinger/operations";
import { NotFound, UnknownHostingerError, HostingerValidationError } from "@distilled.cloud/hostinger/errors";

const vm = yield* VPSGetVirtualMachineV1({ virtualMachineId: 123 }).pipe(
Effect.catchTags({
NotFound: () => Effect.succeed(undefined),
HostingerValidationError: (e) =>
Effect.dieMessage(`Invalid input: ${JSON.stringify(e.errors)}`),
UnknownHostingerError: (e) => Effect.dieMessage(e.message ?? "unknown"),
}),
);
```

Validation errors (HTTP 422) are surfaced as `HostingerValidationError` with per-field details in `errors`.

## Services

- **VPS: Virtual machines** — purchase, list, get, setup, start, stop, restart, recreate, hostname, root/panel password, nameservers, metrics
- **VPS: Firewall** — create, list, delete firewalls; create/update/delete rules; activate/deactivate/sync per VM
- **VPS: Docker Manager** — compose projects: create, update, start, stop, restart, down, containers, logs
- **VPS: Snapshots** — create, get, delete, restore (one snapshot per VM)
- **VPS: Public keys / Post-install scripts / PTR records / Backups / Recovery / Malware scanner / OS templates / Data centers / Actions**
- **DNS** — get/update/delete zone records (bulk), reset, validate; snapshots: list, get, restore
- **Domains** — portfolio (purchase, nameservers, privacy, lock), forwarding, WHOIS, availability
- **Hosting** — websites, subdomains, databases, WordPress, Node.js builds, datacenters, orders
- **Billing** — catalog, subscriptions, auto-renewal, payment methods
- **Reach** — contacts, segments, profiles

## License

MIT
Loading