Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

Landing page: deploy to threert.dev (Cloudflare Worker with static assets)

Evan (Yifeng) Wang69a0a8eb863a
diff --git a/site/README.md b/site/README.md
index 59e2f2e..e6eaf38 100644
--- a/site/README.md
+++ b/site/README.md
@@ -8,6 +8,16 @@ bun site/serve.ts # http://localhost:4173/
bun site/tools/build.ts # a static copy for any file host -> out/site/
```
+**Live at https://threert.dev** (www.threert.dev redirects there). Deploy after a change:
+
+```bash
+wrangler login # once, as a member of the Cloudflare account that holds threert.dev
+bun site/tools/deploy.ts # build out/site, then wrangler deploy (site/wrangler.jsonc)
+```
+
+It is a Cloudflare Worker, `threert-site`: static assets from `out/site` on the custom domains threert.dev and
+www.threert.dev; `site/worker.ts` only redirects www to the apex and hands everything else to the assets.
+
## What is on it
1. **Hero:** Bistro night, three.js | ThreeRT under one draggable divider. "Every light, traced. At 60 fps."
@@ -32,7 +42,8 @@ bun site/tools/build.ts # a static copy for any file host -> out/site/
| `js/devices.js` | The 3D device rows (three.js), with a still fallback when WebGL is off |
| `brand/` | The mark ("Orbit": a triangle and the one closed light path that bounces inside it) and its variants |
| `media/` | The renders, WebP. Generated; never retouched |
-| `serve.ts`, `tools/` | Local server, static build, media and device-still generators |
+| `serve.ts`, `tools/` | Local server, static build, deploy, media and device-still generators |
+| `worker.ts`, `wrangler.jsonc` | The Cloudflare Worker and its config (threert.dev) |
## Media
diff --git a/site/tools/deploy.ts b/site/tools/deploy.ts
new file mode 100644
index 0000000..d14af08
--- /dev/null
+++ b/site/tools/deploy.ts
@@ -0,0 +1,8 @@
+// Builds the landing page and deploys it to threert.dev (Cloudflare Workers, static assets + custom domains).
+// bun site/tools/deploy.ts needs `wrangler login` as a member of the account in site/wrangler.jsonc
+import { $ } from "bun";
+import { resolve } from "node:path";
+
+const site = resolve(import.meta.dir, "..");
+await $`bun ${resolve(site, "tools/build.ts")}`;
+await $`bunx wrangler@4 deploy --config ${resolve(site, "wrangler.jsonc")}`;
diff --git a/site/worker.ts b/site/worker.ts
new file mode 100644
index 0000000..5054fe3
--- /dev/null
+++ b/site/worker.ts
@@ -0,0 +1,16 @@
+// The landing page on Cloudflare Workers: static assets (out/site, built by site/tools/build.ts) on threert.dev.
+// www.threert.dev redirects to the apex; everything else is served from the assets as built.
+interface Env {
+ ASSETS: { fetch(request: Request): Promise<Response> };
+}
+
+export default {
+ async fetch(request: Request, env: Env): Promise<Response> {
+ const url = new URL(request.url);
+ if (url.hostname === "www.threert.dev") {
+ url.hostname = "threert.dev";
+ return Response.redirect(url.toString(), 301);
+ }
+ return env.ASSETS.fetch(request);
+ },
+};
diff --git a/site/wrangler.jsonc b/site/wrangler.jsonc
new file mode 100644
index 0000000..84dda05
--- /dev/null
+++ b/site/wrangler.jsonc
@@ -0,0 +1,19 @@
+// Deploy: bun site/tools/deploy.ts (builds out/site, then wrangler deploy with this file).
+{
+ "name": "threert-site",
+ // The Cloudflare account that holds the threert.dev zone.
+ "account_id": "5e97b4b91f8abaf2de54de9f866bfcae",
+ "main": "worker.ts",
+ "compatibility_date": "2026-11-01",
+ "assets": {
+ "directory": "../out/site",
+ "binding": "ASSETS",
+ // The worker runs first so www can redirect; it hands every other request to the assets.
+ "run_worker_first": true
+ },
+ "routes": [
+ { "pattern": "threert.dev", "custom_domain": true },
+ { "pattern": "www.threert.dev", "custom_domain": true }
+ ],
+ "workers_dev": false
+}