Cloudflare Infrastructure
Services Used
| Service | Purpose | Configuration |
|---|---|---|
| Pages | Static site hosting | Project: portfolio, output: out/ |
| Workers | Chat backend | Worker: portfolio-chat |
| Durable Objects | Chat session state | Class: ChatSession (SQLite-backed) |
| KV | Rate limits, thread maps | Namespace: THREAD_MAP |
| Turnstile | Bot protection on chat | Site key in Next.js config |
| Access | Docs site authentication | Google SSO, owner-only |
| DNS | Domain management | Zone: anshulbisen.com |
Domains
| Domain | Service | Purpose |
|---|---|---|
anshulbisen.com | Cloudflare Pages | Portfolio site |
chat.anshulbisen.com | Cloudflare Workers | Chat API |
ph.anshulbisen.com | Reverse proxy | PostHog analytics |
docs.anshulbisen.com | Cloudflare Pages | Documentation 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
| Binding | Type | Purpose |
|---|---|---|
CHAT_SESSION | Durable Object | Per-session stateful chat management |
THREAD_MAP | KV Namespace | Maps Slack thread timestamps to session IDs, rate limit counters, block lists |
KV Key Patterns
| Key Pattern | Purpose | TTL |
|---|---|---|
rate:session:{ip} | Rate limit counter | 3600s (sliding) |
{threadTs} | Thread → session mapping | 1800s |
block:ip:{ip} | IP block list | None |
block:email:{email} | Email block list | None |
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