- What it is: the source of tinydeskai.io, a live shipwords site for the "Outstanding" Tiny Desk AI trend (put anyone into the band and get a 9:16 clip). Open-sourced as a complete example: fork it and launch your own version of the keyword.
- Not deployed from here. tinydeskai.io is deployed from its own private config. The domain, emails and analytics IDs in this copy are placeholders, and
"example": trueinpackage.jsonletspnpm checkpass with them (see Launch your own).
- Product: a fixed four-shot template (band, lead close-up, sax solo, band). The stage starts with five dogs; visitors tap a seat and upload a photo (at least one of their own). × on a photo puts the dog back, × on a dog keeps the original coach. Price is per video, 1 to 5 people.
- Generation (
site.models.tsfor the name, price and slots;src/models.server.tsfor the rest): an effect model.- Prep: each person's photo becomes two images (GPT Image): a two-panel reference (face, and outfit from the neck down) for the video model, and a front chest-up portrait for repairs and the likeness check. A vision model writes a short description of each person for the prompt (
effect.describe: GPT 6.2 Sol on the Vercel AI Gateway, Workers AI as the fallback). - Video: Kling 4.0 in edit mode takes the whole 17.7-second clip plus one reference image per person and replaces those people in one pass (about $3.06 at 720p). Seats still showing a dog are sent as dog photos; cleared seats keep the original coaches.
- Checks and repair: the compose service (
packages/jobs/compose, ffmpeg and face models) checks that no original face is left in a swapped seat and that the lead and the keyboard player look like their photos. A missed seat is re-rendered by Prunap-video-replace, one person per pass over the shots they are in, up to 5 passes. Once Kling has charged, the job delivers the best version instead of refunding, andREVIEW_EMAILgets a note. - Compose: the output is re-aligned to the original cut points and the song is mixed back in, delivering a version with the song and a silent one.
- Cost cap: Kling 3.40 + repairs 5 × 0.40 + prep 0.15 stays under the job cap of $5.60, below the net price per video of the cheapest pack.
- Prep: each person's photo becomes two images (GPT Image): a two-panel reference (face, and outfit from the neck down) for the video model, and a front chest-up portrait for repairs and the likeness check. A vision model writes a short description of each person for the prompt (
- Tests:
test/generation-contract.test.tsruns the site's real configuration through the engine's planner, request builder and runner with a fake upstream and compose service, and validates every request with the installed Yir SDK, for all 31 seat combinations. No paid generation runs. - Pages: tool home page, tutorial, template page, meme explainer, free page, pricing, policies; FAQ and structured data on each. Phone upload by QR code keeps its pairing codes in two site tables (
src/site/schema.ts). - Flow: sign in (Google or email code), buy credits, generate. No guest trial and no signup bonus. Order photos get a private copy (
keepUploads), which the privacy policy states.
The reference clip, song and sample videos are cut from third-party footage and music, so they are not committed:
public/media/(stage photos, sample clips including the dog version) is git-ignored.- The storage objects under
assets/tinydesk/(full-17s.mp4, the clip used as reference, base and check original, andsong.m4a) are keyed insrc/models.server.ts.
Use footage and music you have the rights to, or AI-generated base clips, and keep the DMCA page and contact email (both included).
Set up as in local development, then:
- Copy
.env.exampleto~/.config/shipwords/tinydeskai-example.env, setDATABASE_URLand the two secrets, and runpnpm setup:worktreefrom the repo root, which prints the port. - Put your media in
public/media/and your clips underSTORAGE_DIRatassets/tinydesk/<file>(or in your bucket withS3_*). - In this directory:
pnpm db:migrate && pnpm dev;node ../../tools/stripe-listen.mjsforwards Stripe test webhooks.
UPSTREAM_MOCK=1 (the default in .env.example) runs the whole flow without calling the paid upstream or the compose service: outputs are the reference clips. Set UPSTREAM_MOCK_RESULT / UPSTREAM_MOCK_RESULT_SILENT to storage keys of a finished video to return that instead. Real generations need YIR_API_KEY and the compose service (COMPOSE_URL).
pnpm check runs the typecheck, the tests, the build and the launch checks. docker compose up --build runs the production image with its own Postgres and the compose service.
- Pick a domain; set
urlinsite.config.ts,EMAIL_FROMin your.env,SUPPORT_EMAILinsrc/site/legal.tsx, your analytics IDs, and the names incompose.yamlandpackage.json. - Remove
"example": truefrompackage.json:pnpm checkthen blocks until the placeholders above are replaced. - Create the database and bucket, upload the assets, and add a lifecycle rule deleting
uploads/after 2 days. Settings:YIR_API_KEY, Stripe keys and webhook secret,BETTER_AUTH_SECRET,GUEST_COOKIE_SECRET, Google OAuth,APP_URL,COMPOSE_URL, email credentials. NoUPSTREAM_MOCKin production. - Follow the launch handbook: build the image, run
migrate.mjs, start the containers.