flyio-sdk-patterns
/flyio-sdk-patterns
Build a typed local adapter for the Fly.io Machines REST API with scoped auth, state waits, limits, reconciliation, and contract tests. Use when code must manage Machines or volumes. Trigger with: "wrap Machines API", "build Fly API client", "type Fly Machine states".
- Author
- jeremylongshore ↗
- Repository
- tons-of-skills-marketplace ↗
- Licence
- MIT
- Last repository change
- 26.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 6
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Build a typed local adapter for the Fly.io Machines REST API with scoped auth, state waits, limits, reconciliation, and contract tests. Use when code must manage Machines or volumes. Trigger with: "wrap Machines API", "build Fly API client", "type Fly Machine states".
Triggers from the description
Arguments
/flyio-sdk-patterns [language-app-and-operation-set]
Original author description
Build a typed local adapter for the Fly.io Machines REST API with scoped auth, state waits, limits, reconciliation, and contract tests. Use when code must manage Machines or volumes. Trigger with: "wrap Machines API", "build Fly API client", "type Fly Machine states".
How it works
- Overview
- Prerequisites
- Instructions
- Authentication
- Tool Discipline
- Output
- Examples
- Error Handling
- Resources
SKILL.md preview
--- name: flyio-sdk-patterns description: >- Build a typed local adapter for the Fly.io Machines REST API with scoped auth, state waits, limits, reconciliation, and contract tests. Use when code must manage Machines or volumes. Trigger with: "wrap Machines API", "build Fly API client", "type Fly Machine states". allowed-tools: Read, Grep, Write, Edit version: 2.0.0 argument-hint: '[language-app-and-operation-set]' model: inherit effort: high license: MIT author: Jeremy Longshore <jeremy@intentsolutions.io> tags: - saas - flyio - machines-api - typed-client - contract-testing compatibility: 'Requires the current Machines OpenAPI contract, a supported runtime, a scoped test identity, fixtures, and a non-production integration boundary.' --- # Typed Fly.io Machines API Adapter ## Overview Fly.io publishes a REST API and OpenAPI reference; this workflow does not claim a provider-maintained JavaScript SDK. Generate or handwrite only a thin local adapter, keep provider fields visible, and centralize authentication, timeouts, limits, state waits, and redaction. ## Prerequisites - Chosen operations and current OpenAPI or endpoint documentation - Runtime and HTTP client policy, schema generator decision, and error model - Synthetic fixtures plus an authorized non-production app for contract verification ## Instructions ### Step 1: Freeze the contract Record base URL, operation paths, request and response schemas, state enums, response codes, and retrieval fingerprint. Preserve unknown fields for forward compatibility. ### Step 2: Define a thin transport Centralize bearer auth, content type, request ID, timeout, retry eligibility, response parsing, and error redaction. Do not hide target app or Machine identifiers. ### Step 3: Model desired and observed state Represent Machine ID, instance version, configuration, lifecycle state, and target state separately. Require callers to reconcile before replay. ### Step 4: Use the provider wait operation After a mutation, wait for `started`, `stopped`, `suspended`, or `destroyed` with a bounded timeout and the required instance version where applicable. ### Step 5: Apply rate and conflict policy Serialize conflicting actions per identifier, use documented per-action limits, retry only eligible failures, and refresh after 409, 408, or ambiguous transport results. ### Step 6: Test the adapter Use fixture tests for every response and error class, then run an authorized read and one reversible non-production lifecycle operation with cleanup. ## Authentication Inject `FLY_API_TOKEN` from a secret manager and send it only as the bearer header to the documented Machines API host. Keep token scope outside the client configuration file and scrub headers and Machine config secrets from exceptions. ## Tool Discipline Use Read and Grep to inspect application configuration, deployment evidence, provider documentation, fixtures, logs, schemas, and existing tests before proposing a change. Use Write or Edit only for an approved plan, configuration, implementation, test, or redacted receipt. Do not create, deploy, scale, restart, stop, suspend, destroy, rotate, revoke, expose, or migrate live Fly.io resources without explicit operator approval. ## Output - Contract fingerprint and supported-operation matrix - Typed adapter with transport, state, rate, conflict, and redaction policies - Fixture and non-production contract-test receipt with cleanup state Return the target organization, app, environment, region set, Machine or database identifiers, source-contract fingerprint, evidence, unresolved risks, rollback state, and final decision without exposing tokens, secrets, connection strings, or customer data. ## Examples A TypeScript service wraps get, update, start, stop, and wait without inventing an official SDK. It records the active instance version, waits for the documented target states, serializes actions per Machine, and preserves unknown response properties. ## Error Handling | Failure | Response | | --- | --- | | Response schema changes | Quarantine the unknown shape, preserve raw redacted evidence, update fixtures and types, and re-run contract tests. | | Wait returns 408 | Read current Machine and instance state; do not assume the preceding mutation failed. | | Adapter receives 401 | Stop, verify the secret reference and token scope, and never print the bearer value. | ## Resources - [First-party source notes](references/official-docs.md) - [Machines API setup](https://fly.io/docs/machines/api/working-with-machines-api/) - [Automation and tokens](https://fly.io/docs/flyctl/integrating/) - [App configuration](https://fly.io/docs/reference/configuration/) - [Machines resource](https://fly.io/docs/machines/api/machines-resource/) - [Machines API OpenAPI](https://docs.machines.dev/+external) - [Machine states](https://fly.io/docs/machines/machine-states/)
Files in this package (2)
- SKILL.md 5 KB
- references/official-docs.md 2 KB
Versions
The database has no other skills named flyio-sdk-patterns.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version 670dd28b7bd1 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100flyio-rate-limits
Implement Fly.io Machines API pacing, per-resource serialization, retry, and reconciliation from the documented action limits. Use when automating Machine or app operations. Trigger with: "handle Fly 429", "throttle Machines API", "batch Fly Machine updates". - 100flyio-local-dev-loop
Build a repeatable local Fly.io development loop with containers, config validation, private-service access, and disposable remote verification. Use when aligning local behavior with Fly Machines. Trigger with: "develop Fly app locally", "proxy Fly database", "test fly.toml before deploy". - 100fly
Manage Fly.io machines, apps, volumes and app secrets through the Machines API. Use when the user asks what is running on Fly.io, or to start, stop, resize, move, redeploy or destroy a Fly machine. - 100fly-io
Expert Fly.io assistance covering fly.toml, global app distribution, persistent volumes, Machines API, and scaling. Use when deploying full-stack apps and databases close to users globally. - 100fly-io
Deploy, configure, review, troubleshoot, and design Fly.io apps, Machines, networking, and storage, or operate and integrate Sprites persistent execution environments. Use for Fly infrastructure, flyctl/fly.toml, and Sprites CLI/API tasks. - 100fly-io
Use when deploying or operating an app on Fly.io — writing fly.toml, placing Machines in regions near users, attaching Volumes, managing secrets, or picking a scaling lever (autostop/autostart, scale count, fly-replay). NOT choosing which host to deploy on (that is…