Skip to content

Cloudflare Infrastructure

Services Used

ServicePurposeConfiguration
PagesStatic site hostingProject: portfolio, output: out/
WorkersChat backendWorker: portfolio-chat
Durable ObjectsChat session stateClass: ChatSession (SQLite-backed)
KVRate limits, thread mapsNamespace: THREAD_MAP
TurnstileBot protection on chatSite key in Next.js config
AccessDocs site authenticationGoogle SSO, owner-only
DNSDomain managementZone: anshulbisen.com

Domains

DomainServicePurpose
anshulbisen.comCloudflare PagesPortfolio site
chat.anshulbisen.comCloudflare WorkersChat API
ph.anshulbisen.comReverse proxyPostHog analytics
docs.anshulbisen.comCloudflare PagesDocumentation site

Workers Configuration

From chat-worker/wrangler.toml:

toml
name = "portfolio-chat"
main = "src/index.ts"
compatibility_date = "2025-04-01"

[vars]
ALLOWED_ORIGIN = "https://anshulbisen.com"

[[routes]]
pattern = "chat.anshulbisen.com"
custom_domain = true

[[durable_objects.bindings]]
name = "CHAT_SESSION"
class_name = "ChatSession"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["ChatSession"]

[[kv_namespaces]]
binding = "THREAD_MAP"
id = "e8f8d634274046bf9cee006bb7d9b289"
preview_id = "06d16be879e7436497715f403b81181c"

Bindings

BindingTypePurpose
CHAT_SESSIONDurable ObjectPer-session stateful chat management
THREAD_MAPKV NamespaceMaps Slack thread timestamps to session IDs, rate limit counters, block lists

KV Key Patterns

Key PatternPurposeTTL
rate:session:{ip}Rate limit counter3600s (sliding)
{threadTs}Thread → session mapping1800s
block:ip:{ip}IP block listNone
block:email:{email}Email block listNone

Pages Configuration

The site is deployed as a static export:

  • Build command: npm run build
  • Build output: out/
  • Framework: Next.js (static export mode)
  • Node version: Specified in .nvmrc