npm i fly-machines-sdk
Get Fly.io API Token
export FLY_TOKEN=$(fly auth token)
import { FlyMachinesSDK } from 'fly-machines-sdk';
const apiKey = process.env.FLY_TOKEN;
const orgSlug = 'personal';
const sdk = new FlyMachinesSDK(apikey, orgSlug);
Since fly.io migrated to app v2 each application should have a machine But two requests will be executed.
- Create application
- Assign machine with the application
await sdk.createApplicationOnMachine({ name: 'app_name', config: {} });