Skip to content

feat(hetzner): add Effect-based Cloud and DNS API clients#309

Open
codeagencybe wants to merge 1 commit into
alchemy-run:mainfrom
codeagencybe:agent/backend-developer/7b023332
Open

feat(hetzner): add Effect-based Cloud and DNS API clients#309
codeagencybe wants to merge 1 commit into
alchemy-run:mainfrom
codeagencybe:agent/backend-developer/7b023332

Conversation

@codeagencybe
Copy link
Copy Markdown

Implements the Hetzner Cloud and DNS HTTP client infrastructure for the v2 (alchemy-effect) codebase, following the Neon/api.ts Effect pattern.

Files added

  • packages/alchemy/src/Hetzner/Cloud/Credentials.tsContext.Service-based credential service that reads HCLOUD_TOKEN from env; exposes fromToken and fromEnv layers
  • packages/alchemy/src/Hetzner/Cloud/Client.ts — typed get/post/put/patch/del helpers wrapping HttpClient; base URL https://api.hetzner.cloud/v1; HetznerApiError with Data.TaggedError; auto-retry 429/5xx with Schedule.exponential
  • packages/alchemy/src/Hetzner/Cloud/DnsCredentials.ts — same pattern for DNS; reads HETZNER_DNS_API_TOKEN
  • packages/alchemy/src/Hetzner/Cloud/DnsClient.ts — DNS client; base URL https://dns.hetzner.com/api/v1; uses Auth-API-Token header; HetznerDnsApiError

Usage

// Cloud API
const servers = yield* CloudClient.get<{ servers: Server[] }>("/servers").pipe(
  Effect.provide(CloudCredentials.fromEnv()),
  Effect.provide(FetchHttpClient.layer),
);

// DNS API
const zones = yield* DnsClient.get<{ zones: Zone[] }>("/zones").pipe(
  Effect.provide(DnsCredentials.fromEnv()),
  Effect.provide(FetchHttpClient.layer),
);

Adds typed HTTP client infrastructure for the Hetzner Cloud and DNS APIs following the Neon api.ts pattern.

Code Agency AI review agent
@sam-goodwin
Copy link
Copy Markdown
Contributor

Did you mean to create resources? This looks like an API client, not an alchemy resource provider. Did you mean to create the sdk over here https://github.com/alchemy-run/distilled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants