AI-native design editor. Open-source Figma alternative.
Feedback service
Cloudflare Worker for pings, opt-in usage stats, error and problem reports, and the Cloud waitlist; overview and setup in README.md.
- Every field the app may send is a closed Valibot list in
src/contract/schema.ts, with its plain-language meaning insrc/contract/describe.ts; the privacy page renders both. Add an event or property in both files and updatepackages/docs/overview/privacy.mdprose if what is collected changes (tests/contract.test.ts). - The Worker never stores or forwards a client address: rate limits key on it in memory, PostHog requests are new requests from the Worker, and Turnstile is verified without
remoteip(tests/ingest.test.ts). Pings count the sender's network only as Cloudflare's AS number and operator name (tests/ping.test.ts). - Schema changes are new files in
migrations/, applied bywrangler d1 migrations; keepsrc/db/tables.tsin step (tests/harness.tsapplies them). Everything else, tests included, queries D1 through the typed Kysely database; rawsqltemplates are rejected (open-pencil/no-raw-sql). - Calendar days are
CalendarDates from@internationalized/date(src/days.ts), turned into ISO dates only where they are stored or sent;Dateis for moments such as the clock and sign-up times (tests/snapshot.test.ts). - Routes are chained Hono routers that validate bodies with
validatedJSON(schema)and exportFeedbackAPI; clients usecreateFeedbackClient(hc<FeedbackAPI>), as Cloud's do, never hand-written paths (tests/harness.tsusestestClient). - Bindings are declared in
src/env.tswith importable Workers types, so the app can typecheckFeedbackAPI; never use the generated globalEnvin code the router reaches. Runbun --filter @open-pencil/feedback typesafter changingwrangler.jsonc;src/index.tschecksEnvagainstFeedbackBindingsandbun run test:feedbackchecks the generated file. - Outside services (
fetch, the clock) come throughFeedbackServices, and bindings throughEnv, so tests run the real app against a local D1 underbun test(tests/harness.ts). - The metrics snapshot (
src/snapshot/) keys every table on the UTC day it describes and replaces whole days in one D1 batch (replaceDays), so a rerun corrects a day and a failed write keeps the old rows; it writes the table it resumes from (site_visits) last, runs each source on its own, and parses every answer with Valibot before writing (tests/snapshot.test.ts). Issues and pull requests are the exception:repo_itemsmirrors each one by number and resumes from its newest update, and the admin API derives daily counts from it. - Everything under
/adminpassesrequireAccess(src/admin/access.ts), which verifies Cloudflare Access's signed token against the team's keys and the application's audience even though Access already blocks others at the edge; admin answers areprivate, no-storeand carry waitlist domains, never addresses (tests/admin.test.ts). - Reports (
src/reports/) are forwarded to PostHog and never stored; only the files they declare are kept, in R2 underreports/<id>/<name>with fixed names such asdocument.fig, uploaded with an HS256 token bound to the report, each file's name, and its size, and deleted by retention afterREPORT_FILE_RETENTION_DAYS(tests/reports.test.ts).