Overview
What to deploy when you self-host Miraiclip, and where it can run.
Miraiclip runs in the browser. Preview and browser export happen on the user's machine, so an editor built on the SDK is a static site: no render servers and no per-render cost.
You deploy servers only for exports that have to happen without a browser tab:
| You need | Deploy |
|---|---|
| An editor in your product | Static files only: your app's build on any static host or CDN |
| Exports from your backend (an API, a queue, scheduled jobs) | One render worker container |
| Long videos rendered fast | Several render workers, driven by renderDistributed |
| Many videos from one template | Render workers, or batch rendering on one machine |
The render worker
The render worker is a small Node server around createRenderJobHandler from @miraiclip/server-export. It runs headless Google Chrome and renders with the same exportProject the browser uses, so server output matches the preview.
| Property | Details |
|---|---|
| Input | POST / with a JSON render job: a project document plus export options |
| Output | The encoded MP4 or WebM file in the response body |
| Health check | GET /healthz answers ok |
| State | None. The job carries the whole document, so instances can scale to zero |
| Auth | A bearer token from RENDER_TOKEN |
| Concurrency | One job at a time per container. Add containers to render more at once |
Assets must be reachable from the worker: put media in object storage (S3, Cloud Storage) and use https: URLs in the document. Signed URLs work.
Where to run it
The same Docker image runs everywhere:
Docker
Build the image, run it locally, and call it from Node.
AWS
ECS on Fargate, Lambda, or an EC2 instance.
Google Cloud
Cloud Run, or a Compute Engine VM.
| Platform | Scales to zero | Longest job | Good for |
|---|---|---|---|
| Cloud Run | Yes | 60 minutes | The simplest setup. One job per instance, built in |
| ECS on Fargate | No (scale to a minimum of 1) | No limit (set the load balancer timeout) | Steady traffic, full control of networking |
| AWS Lambda | Yes | 15 minutes | Bursts of short distributed chunks |
| A VM (EC2, Compute Engine) | No | No limit | GPUs, fixed cost, long single-pass exports |
Sizing
Rendering is CPU-bound. On a 2-vCPU Xeon with software rendering, 1080p30 costs about 930 CPU-seconds per minute of output, and 4K about 4,400 (see Render cost). Start with:
| Output | vCPU | Memory |
|---|---|---|
| Up to 1080p | 2 | 4 GB |
| 4K | 4 | 8 GB |
Measure on your own hardware with bench:cost before sizing a fleet. A GPU or a hardware encoder changes these numbers a lot.
Security
- Set
RENDER_TOKENon every deployment with a public URL. Without it, anyone who finds the URL can render on your bill. - The worker fetches the
https:URLs in the documents it receives. Only send it documents your own backend built or checked. - Server export never runs a document's plugins unless you allow them in the handler's
pluginsoption.