flyio-sdk-patterns

Featured

Apply production-ready Fly.io Machines API patterns for TypeScript with typed clients, machine lifecycle management, and multi-region orchestration. Trigger: "fly.io Machines API", "fly.io SDK patterns", "fly.io API client".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Fly.io SDK Patterns ## Overview Production-ready patterns for the Fly.io Machines REST API at `https://api.machines.dev`. Fly.io exposes both GraphQL (organization queries) and REST (machine lifecycle) APIs. The Machines REST API is the primary integration surface for creating, starting, stopping, and destroying VMs across 30+ global regions. A structured client ensures consistent auth, typed machine states, and reliable wait-for-state polling. ## Singleton Client ```typescript const FLY_API = 'https://api.machines.dev'; let _client: FlyClient | null = null; export function getClient(appName: string): FlyClient { if (!_client) { const token = process.env.FLY_API_TOKEN; if (!token) throw new Error('FLY_API_TOKEN must be set'); _client = new FlyClient(appName, token); } return _client; } class FlyClient { private h: Record<string, string>; constructor(private app: string, token: string) { this.h = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; } async listMachines(): Promise<FlyMachine[]> { const r = await fetch(`${FLY_API}/v1/apps/${this.app}/machines`, { headers: this.h }); if (!r.ok) throw new FlyError(r.status, await r.text()); return r.json(); } async createMachine(config: MachineConfig, region: string): Promise<FlyMachine> { const r = await fetch(`${FLY_API}/v1/apps/${this.app}/machines`, { method: 'POST', headers: this.h, body: JSON.stringify({ region, config }) }); if (!r.ok) throw ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category