TypeScript demo
A runnable TypeScript example that deploys a folder to a live URL with the flypod library. Download it and run, or check it inline. Zero auth.
A complete, runnable example of deploying with the flypod library from
TypeScript. It reads a folder with collectDist() and ships it with
deploySite() (two calls) and prints a live URL.
The deploy is anonymous and ephemeral (no account, expires in ~14 days), so you can run this right now with nothing to set up.
Download and run
Download the example (.zip), or grab and run it from the terminal:
curl -L https://docs.flypod.dev/examples/library-demo.zip -o flypod-demo.zip
unzip flypod-demo.zip && cd flypod-library-demo
bun install
bun run deploycurl -L https://docs.flypod.dev/examples/library-demo.zip -o flypod-demo.zip
unzip flypod-demo.zip && cd flypod-library-demo
npm install
npm run deployIt prints the live URL:
Deploying "./site" with flypod…
✓ Live at https://ab12cd34.flypod.dev
1 files · expires in ~14 days
Save this manage token to update or roll back the site later:
fk_…Open the URL. That's the site/ folder, live. Swap in your own build output,
or pass a path: bun run deploy ./my-dist.
The deploy is public and ephemeral. Don't upload anything secret. The zip is a
self-contained project: deploy.ts, a site/ folder, and a package.json.
The code
The whole program is deploy.ts:
import { collectDist, deploySite, type DeployResult } from "flypod";
const dir = process.argv[2] ?? "./site";
// 1. Read the directory into a map of { path -> bytes }.
const files = await collectDist(dir);
// 2. Ship it. With no apiKey this is an anonymous, ephemeral deploy.
const result: DeployResult = await deploySite({ files });
console.log(result.url); // https://ab12cd34.flypod.dev
console.log(result.manage_token); // save to update / roll back laterSee the library reference for every field on
DeployResult and the full deploySite options.
Check it in one file
No project? The smallest possible deploy needs no files on disk: build the map inline:
import { deploySite } from "flypod";
const files = {
"index.html": new TextEncoder().encode(
"<!doctype html><meta charset=utf-8><title>flypod</title><h1>Hello from flypod</h1>",
),
};
const { url } = await deploySite({ files });
console.log(url);Run it:
npm install flypod tsx
npx tsx demo.ts # or, with Bun: bun demo.tsVerify it's live
The URL on stdout is a real, live site. Confirm it end to end:
URL=$(npx tsx demo.ts)
curl -s -o /dev/null -w "%{http_code}\n" "$URL" # → 200Make it permanent
Anonymous deploys expire after ~14 days. Pass an account session token obtained
through flypod login to make the deploy owned and permanent:
const result = await deploySite({
files,
apiKey: process.env.FLYPOD_TOKEN,
});See Accounts & claiming for more on ownership.
Library
The flypod npm package deploys a folder of static files to a live URL from Node or Bun. Reference for deploySite, collectDist, resolveDeployDir, and the DeployOptions / DeployResult types.
HTTP API
The flypod REST API at https://flypod.dev deploys sites from a zip, redeploys new versions, rolls back, and manages accounts with bearer-token auth.