name = "every-channel-site"
main = "src/index.ts"
compatibility_date = "2026-02-08"
workers_dev = false
account_id = "9a54fd76c3d5d9abac437382a9027e9b"

# Bind this worker to the every.channel zone.
# This uses Workers Custom Domains (not "routes to an origin"), so it can serve the site without
# an application server behind it.
routes = [
  { pattern = "every.channel", custom_domain = true },
  { pattern = "www.every.channel", custom_domain = true },
]

# Static assets built by Trunk (apps/web -> apps/web/dist).
#
# Note: Wrangler v4 expects `assets = { ... }` (not a `[assets]` table). If misconfigured,
# `env.ASSETS` will be missing in production and the worker will 500 on SPA routes like `/watch`.
assets = { directory = "../../apps/web/dist", binding = "ASSETS", run_worker_first = ["/*"] }

[[durable_objects.bindings]]
name = "EC_API"
class_name = "EcApiContainer"

[[durable_objects.bindings]]
name = "EC_STREAM"
class_name = "StreamRelayDO"

[[migrations]]
tag = "v2"
new_sqlite_classes = ["DirectoryDO"] # historical; safe to keep (namespace already created)

[[migrations]]
tag = "v3"
new_sqlite_classes = ["EcApiContainer"]

[[migrations]]
tag = "v4"
new_sqlite_classes = ["StreamRelayDO"]

[vars]
EC_ARCHIVE_ORIGIN = "https://forge.every.channel"
