origami
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v34View latest version
origami.now is a Val Town project that serves a React UI and an API for generated origami SVGs.
- Serves a minimal UI at
/with theorigami.nowheading and the latest generated origami. - Generates a new origami artifact on an hourly cadence (UTC hour window).
- Stores only the latest artifact in Blob storage.
- Supports manual regeneration with a query parameter (
?force=1).
backend/ auth.ts index.http.ts origami.ts storage.ts frontend/ index.html app.js jobs/ generate-origami.cron.ts shared/ types.ts
-
GET /- Returns the React UI.
- Bootstraps the latest origami payload into the page.
- Supports
?force=1(or?regen=1) to force regeneration.
-
GET /api/origami/latest- Returns the latest stored origami artifact.
- Supports
?force=1(or?regen=1) to force regeneration.
-
POST /api/origami/generate- Protected by
x-origami-token. - Optional body:
{ "force": true }.
- Protected by
{
id: string;
createdAt: string; // ISO timestamp
svg: string;
seed: number;
generatedBy: "cron" | "manual" | "bootstrap";
}
- Uses Rabbit Ear to build and fold crease patterns.
- Uses 3–10 generated fold instructions per artifact.
- Limits rendered crease segments to a max of 30.
- Linework is always black.
- Faces use two generated colors (front/back) per artifact.
- Cron entrypoint:
jobs/generate-origami.cron.ts - Intended schedule: every hour at minute 0 (UTC-style cadence).
- Generation stores only the latest artifact at blob key
origami_latest_v1.
ORIGAMI_GENERATE_TOKEN- Required for
POST /api/origami/generate.
- Required for
forceregeneration is intentionally unprotected forGETroutes in this project.- UI polling interval is 5 minutes.