Docs

@fyio/buildfyio-sdk

Typed TypeScript client for the Buildfyio API.

Install

npm i @fyio/buildfyio-sdk

10-line quickstart

import { Buildfyio } from '@fyio/buildfyio-sdk';

const client = new Buildfyio({
  token: process.env.BUILDFYIO_TOKEN!,
  orgId: 'org_xxx',
});

const dep = await client.deployments.trigger('org_xxx', 'prj_yyy', {
  env: 'production',
  branch: 'main',
});
for await (const line of client.logs.stream('org_xxx', dep.id, 'build')) {
  process.stdout.write(line + '\n');
}

// When it fails, ask what went wrong instead of reading the log.
const report = await client.deployments.errors('org_xxx', dep.id);
console.log(report.failureReason, report.diagnoses[0]?.fix);

Resources

  • projects — list / get / create
  • deployments — trigger / get / rollback
  • envVars — list / create / delete
  • logs.stream — async iterator over SSE

Types come from the live spec at /v1/openapi.json — regenerate with pnpm codegen.