Chan Forum
A forum that runs entirely on the Cloudflare edge. React, Hono and D1 are served by one Worker, with single sign-on, notifications and English and Chinese interfaces.
Visit projectThe problem
Hosted forums own your community, and self-hosted ones need a server and a database to keep alive. I wanted a full forum with profiles, follows and notifications that runs on the edge with nothing to operate, and that signs people in with the same account as my other apps.
Technical approach
- A Bun monorepo with the React app, the Worker and a shared package of TypeScript types used by both sides.
- One Cloudflare Worker serves the static app and the Hono API on a single origin. D1 stores posts, replies, likes and notifications, and R2 holds avatars.
- Sign-in is OIDC single sign-on through the shared id service, with an HttpOnly refresh cookie. Crawlers get Open Graph HTML for each post.
- Rate limits, reports and an admin view keep the forum in order. The interface follows Apple’s Human Interface Guidelines and ships in English and Chinese.
Running at the edge
There is no origin server. Each request is handled by a Cloudflare Worker in a data center near the reader, and the same Worker serves the app itself.
Close to every reader
Hono keeps API routes light enough to start in milliseconds, while D1 stores posts without a database server to run.
Locations on the globe are illustrative.
