Skip to content
← All cases

/cases · Backends and dashboards on Cloudflare Workers

Partner dashboard and team CRM on Cloudflare Workers

A web dashboard for a partner program — stats, payouts, an advertiser panel, courses and a team CRM — where access rules live in the database, not in the front end.

Service
Backends and dashboards on Cloudflare Workers
Stack
  • Hono
  • TypeScript
  • Astro
  • PostgreSQL
  • Browser Rendering
  1. 01Manual

    Partners, team owners, advertisers and admins look at the same data, and each must see only their own slice.

    • Roles: four kinds of users share one dataset with different rights.
    • Risk: an access rule kept only in application code can leak another user's data.
  2. 02System

    One Worker serves the API, a static front end serves the pages, and the database decides who sees what.

    • API: Hono and TypeScript on a Cloudflare Worker.
    • Front end: static Astro with uk, ru and en dictionaries.
    • Sign-in: Telegram login widget and a JWT session.
    • Access: the Worker calls a few SECURITY DEFINER SQL functions; the role is resolved in SQL (fn_tcrm_role) and the data is cut to the caller's scope.
    • CRM: team owners get a reduced view of their own people.
  3. 03Autopilot

    Receipts are rendered and sent by a queue consumer.

    • Receipts: a queue consumer renders payout receipts with Browser Rendering (headless Chromium), takes an element screenshot as PNG and sends it to Telegram with sendPhoto.
    • Fallback: if rendering fails, a text receipt goes out.
    • Tests: the Worker routes are covered by automated tests, so role and payout changes are checked before release.

Have a similar process?

Tell us about it. We start by mapping how it runs today.

Discuss a similar project