Skip to main content

Platforms quickstart

Create a token, then publish an app to Easel from your own backend with the SDK.

In this tutorial you create a token, then write the publish flow for your own backend in about 20 lines: one Easel project per app, its environment variables, an upload from the sandbox that built it, and the live URL.

We also share a reference app builder, with a fake AI and sandbox and real calls to Easel, when we set up your integration. Talk to us to get it.

Before you begin

You need:

  • An Easel workspace where you're an Owner or Admin
  • Node.js 20 or later

Create a token

Your backend calls Easel with a workspace token.

  1. In the dashboard, open your workspace's Settings → Access Tokens.
  2. Create a token and copy it. It's shown once.

Keep the token on your server. For what each kind of token can do, see Tokens.

Publish from your own backend

With the SDK:

import { createClient, sandboxUploadScript } from "@easel-sh/sdk";

const easel = createClient({ token: process.env.EASEL_TOKEN! });

export async function publishApp(appId: string, sandbox: Sandbox) {
  // 1. One project per app. Safe to call on every publish.
  const project = await easel.projects.ensure(`app-${appId}`);

  // 2. Environment variables for the app's functions.
  await easel.env.upsert(project.id, [
    { key: "APP_NAME", value: "Guestbook", target: ["production", "preview"] },
  ]);

  // 3. The sandbox uploads its files. No Easel token enters it.
  const upload = await easel.deployments.createUpload({
    project: project.id,
    target: "production",
    meta: { appId },
  });
  await sandbox.run(sandboxUploadScript(upload.uploadUrl));

  // 4. Follow the build.
  const { deploymentId } = await easel.deployments.getUpload(upload.uploadId);
  const deployment = await easel.deployments.wait(deploymentId!);
  return deployment.primaryUrl;
}

Sandbox stands for your sandbox provider's client. If your sandbox can't reach the internet, or you hold the files yourself, see Deploy source for the other two ways.

Next steps