Cohort Feedback
A tiny feedback tracker that collects responses in cohorts of 20. When a cohort fills up, the next one starts by itself. Cloudflare Workers and D1, plain white and grey, no tracking.
Cohort Feedback is how Haq is tested: 20 people try a release and tell us how it went, we read every answer, ship a fix, and the next 20 start. It is small enough to read in an afternoon and free for anyone to run.
Why cohorts
A rating that keeps averaging forever hides whether the last release got better. Cohorts give each round its own number: cohort 1 rated 4.0, cohort 2 rated 4.4 after the fixes. The 21st answer starts cohort 2 automatically, so nobody has to reset anything.
What people answer
| Question | Required | Notes |
|---|---|---|
| Who are you? | Yes | A user, a developer, a lawyer or legal aid, business or compliance, or prefer not to say |
| What did you review? | Yes | The app or the website, and optionally which part |
| How did you find it? | Yes | 1 Poor to 5 Excellent |
| What worked well? What should change? | No | Free text |
| Did you spot a legal error? | Lawyers only | The law or section and an official source, so a correction can go straight into a rule pack |
| You used it on | No | Phone, tablet or computer |
| Can we quote this as a testimonial? | Yes | With yes, a name and title to show, or "Anonymous" |
| Consent to store the answers | Yes | Without it, nothing is saved |
Every response gets a receipt like cf_k3x9q2m7, so a person can ask for their answers to be deleted.
Privacy by design
- No IP addresses. Spam limits use a salted hash that changes daily and is deleted after a day.
- No cookies, no trackers, no third-party requests. A strict Content Security Policy blocks anything else.
- Names only with consent to quote. Testimonials show in public only when the person said yes and the owner chose to feature them.
The owner view
Behind a Cloudflare Access login, the owner sees each cohort's average and progress, filters by role, product, testimonials and legal errors, features testimonials, and downloads a CSV. The Worker checks the Access token's signature, audience and expiry itself, and the view stays off until Access is set up.
How it is built
| Part | Choice |
|---|---|
| Hosting | Cloudflare Workers with static assets |
| Database | Cloudflare D1 (SQLite) |
| Front end | Plain HTML, CSS and JavaScript, no frameworks |
| Owner login | Cloudflare Access (email and one-time code) |
| Tests | 16 tests, with the real Worker against an in-memory SQLite database |
Cohort numbers are worked out inside the database insert, so two people sending at the same moment can't get the same place.
Run your own
- Create a D1 database:
wrangler d1 create cohort-feedback, and put its ID inwrangler.jsonc. - Create the tables:
npm run db:init:remote. - Set a secret salt:
wrangler secret put HASH_SALT. - Describe your products and pages in
FORM_CONFIG, then deploy:npm run deploy. - Protect
/adminand/api/admin/*with a Cloudflare Access application, and setACCESS_TEAM_DOMAINandACCESS_AUD.
Link to the form with the product filled in, like ?product=app&page=report. The full setup, settings and API are in the README that comes with the code. Questions or ideas? Ask in Haq's Discussions.
Licence
MIT: use it, change it, share it.
Want documentation like this for your product?