Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/cazala/party.git",
"directory": "packages/core"
},
"homepage": "https://github.com/cazala/party#readme",
"homepage": "https://caza.la/party/",
"bugs": {
"url": "https://github.com/cazala/party/issues"
},
Expand All @@ -64,4 +64,4 @@
"engines": {
"node": ">=16.0.0"
}
}
}
21 changes: 11 additions & 10 deletions packages/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,39 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" sizes="any" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>Party - Particle system and physics engine</title>
<title>Party — WebGPU particle system and physics engine</title>
<meta
name="description"
content="A high-performance particle physics simulation system with interactive playground, built with TypeScript and WebGPU/CPU dual runtime support."
content="Party is a high-performance WebGPU particle system and physics engine for TypeScript, with a CPU fallback and an interactive playground."
/>
<meta name="keywords" content="party, particles, physics, engine, webgpu, canvas, creative coding, simulation" />
<meta name="author" content="Party contributors" />
<meta name="theme-color" content="#0b0f19" />
<link rel="canonical" href="https://caza.la/party/" />

<meta property="og:site_name" content="Party" />
<meta property="og:title" content="Party — Particle system and physics engine" />
<meta property="og:title" content="Party — WebGPU particle system and physics engine" />
<meta
property="og:description"
content="A high-performance particle physics simulation system with interactive playground, built with TypeScript and WebGPU/CPU dual runtime support."
content="Party is a high-performance WebGPU particle system and physics engine for TypeScript, with a CPU fallback and an interactive playground."
/>
<meta property="og:image" content="/logo.png" />
<meta property="og:url" content="https://caza.la/party/" />
<meta property="og:image" content="https://caza.la/party/logo.png" />
<meta property="og:image:width" content="512" />
<meta property="og:image:height" content="512" />
<meta property="og:image:alt" content="Party logo" />
<meta property="og:type" content="website" />

<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Party — Particle system and physics engine" />
<meta name="twitter:title" content="Party — WebGPU particle system and physics engine" />
<meta
name="twitter:description"
content="A high-performance particle physics simulation system with interactive playground, built with TypeScript and WebGPU/CPU dual runtime support."
content="Party is a high-performance WebGPU particle system and physics engine for TypeScript, with a CPU fallback and an interactive playground."
/>
<meta name="twitter:image" content="/logo.png" />
<meta name="twitter:image" content="https://caza.la/party/logo.png" />
<meta name="twitter:image:alt" content="Party logo" />
</head>
<body>
<div id="root"></div>
<script type="module" src="src/main.tsx"></script>
</body>
</html>
</html>
2 changes: 2 additions & 0 deletions packages/playground/public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
X-Robots-Tag: noindex
6 changes: 6 additions & 0 deletions packages/playground/public/app-sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://caza.la/party/</loc>
</url>
</urlset>
9 changes: 9 additions & 0 deletions packages/playground/public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://caza.la/party/app-sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://caza.la/party/docs/sitemap.xml</loc>
</sitemap>
</sitemapindex>
18 changes: 10 additions & 8 deletions packages/worker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
### `worker` (Cloudflare Worker)

This package deploys a **route-scoped Cloudflare Worker** that serves the Party playground at:
This package deploys a **route-scoped Cloudflare Worker** that serves Party at its canonical URL:

- **`https://caza.la/party`**
- **`https://caza.la/party/`**

It does this by **reverse-proxying** to the upstream origin:
It reverse-proxies canonical requests to the Cloudflare Pages origin:

- **`https://party.caza.la`**
- **`https://party-playground.pages.dev`**

The browser URL stays on **`caza.la/party...`** (no redirects to `*.pages.dev`, `party.caza.la`, or the upstream domain).
The browser URL stays on **`caza.la/party...`**. Requests to the old public origin, **`https://party.caza.la/*`**, receive a permanent redirect to the equivalent canonical path. Existing `/party/...` paths are preserved, so shared playground sessions are not broken.

The Pages build sends `X-Robots-Tag: noindex` to prevent the raw origin from competing in search results. The Worker removes that header from responses served through the canonical URL.

### Configuration

Configured in `wrangler.toml`:

- **Worker name**: `cazala-party-worker`
- **Route**: `caza.la/party*`
- **Upstream**: `vars.UPSTREAM_ORIGIN` (default: `https://party.caza.la`)
- **Canonical route**: `caza.la/party*`
- **Redirect route**: `party.caza.la/*`
- **Upstream**: `vars.UPSTREAM_ORIGIN` (default: `https://party-playground.pages.dev`)
- **Response header**: `x-edge-proxy: cazala-party-worker`

### Scripts
Expand All @@ -32,4 +35,3 @@ pnpm --filter worker run typecheck
```bash
pnpm --filter worker run deploy
```

34 changes: 33 additions & 1 deletion packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ export interface Env {

const EDGE_PROXY_HEADER_VALUE = "cazala-party-worker";
const PARTY_PREFIX = "/party";
const CANONICAL_ORIGIN = "https://caza.la";
const ALTERNATE_HOST = "party.caza.la";

function canonicalPartyPath(pathname: string): string {
if (pathname === PARTY_PREFIX || pathname === "/") {
return `${PARTY_PREFIX}/`;
}

if (pathname.startsWith(`${PARTY_PREFIX}/`)) {
return pathname;
}

return `${PARTY_PREFIX}${pathname}`;
}

function canonicalPartyUrl(url: URL): URL {
const canonicalUrl = new URL(canonicalPartyPath(url.pathname), CANONICAL_ORIGIN);
canonicalUrl.search = url.search;
return canonicalUrl;
}

function isBodyAllowed(method: string): boolean {
// Cloudflare's fetch follows standard semantics: GET/HEAD should not include a body.
Expand Down Expand Up @@ -45,6 +65,17 @@ export default {
const url = new URL(request.url);

// 1) Routing rules
if (url.hostname === ALTERNATE_HOST) {
return new Response(null, {
status: 301,
headers: withEdgeHeader(
new Headers({
Location: canonicalPartyUrl(url).toString(),
}),
),
});
}

if (url.pathname === PARTY_PREFIX) {
// Trailing slash normalization (same-host, same-scheme).
return new Response(null, {
Expand Down Expand Up @@ -109,6 +140,8 @@ export default {
// 3) Caching (keep it simple)
// Only add long-lived caching if upstream didn't provide it.
const responseHeaders = withEdgeHeader(upstreamResponse.headers);
// The Pages origin is deliberately noindex. Only the canonical proxy is indexable.
responseHeaders.delete("x-robots-tag");
if (looksLikeAssetPath(upstreamPath) && !responseHeaders.has("cache-control")) {
responseHeaders.set("Cache-Control", "public, max-age=31536000, immutable");
}
Expand All @@ -120,4 +153,3 @@ export default {
});
},
};

6 changes: 3 additions & 3 deletions packages/worker/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ main = "src/index.ts"
compatibility_date = "2025-12-30"

routes = [
{ pattern = "caza.la/party*", zone_name = "caza.la" }
{ pattern = "caza.la/party*", zone_name = "caza.la" },
{ pattern = "party.caza.la/*", zone_name = "caza.la" }
]

[vars]
UPSTREAM_ORIGIN = "https://party.caza.la"

UPSTREAM_ORIGIN = "https://party-playground.pages.dev"
Loading