Skip to content

EveToolsHQ/cloudmotion

Repository files navigation

cloudmotion npm version

Node.js client and CLI for Cloudmotion. Upload Remotion bundles and start renders from Node scripts and CI.

API docs: cloudmotion.dev/docs.

Install

npm i cloudmotion

CLI

export CLOUDMOTION_TOKEN=cm_...

Upload a Remotion bundle directory (after npx remotion bundle), then start a render:

npx cloudmotion bundles upload dist/bundle --bundle-id my-project

npx cloudmotion render \
  --bundle-id my-project \
  --composition-id MyComp

Re-uploading under the same bundle ID replaces the latest bundle used for renders. The render command prints progress to stderr and the output URL on stdout when finished.

SDK

Pass token in the client constructor (the SDK does not read environment variables).

import { createClient } from 'cloudmotion'

const client = createClient({ token: 'cm_...' })

const bundle = await client.uploadBundle({
  bundleDir: 'dist/bundle',
  bundleId: 'my-project',
})

const { renderId } = await client.renderMedia({
  bundleId: bundle.bundleId,
  compositionId: 'MyComp',
  inputProps: { title: 'Hello' },
})

let status = await client.getRenderProgress(renderId)
while (status.status !== 'completed' && status.status !== 'failed') {
  await new Promise(r => setTimeout(r, 2000))
  status = await client.getRenderProgress(renderId)
}

console.log(status.outputUrl)

API surface

  • createClient({ token, fetch? }): optional custom fetch (e.g. for timeouts or logging)
  • client.uploadBundle({ bundleDir, bundleId, onUploadProgress? }): returns { bundleId, uploadId, remotionVersion, runtimeReady }
  • client.renderMedia(input) / client.renderStill(input): returns { renderId }
  • client.getRenderProgress(renderId): poll { status, progress, error?, outputUrl? }

curl (no SDK)

See cloudmotion.dev/docs.

# Start render
curl "https://api.cloudmotion.dev/v1/renders" \
  -H "Authorization: Bearer cm_..." \
  --json '{"bundleId":"my-project","compositionId":"MyComp","kind":"media"}'

# Poll status
curl "https://api.cloudmotion.dev/v1/renders/$RENDER_ID" \
  -H "Authorization: Bearer cm_..."

About

Cloudmotion Node.js SDK and CLI

Resources

Stars

Watchers

Forks

Contributors