Exchange Trust App

A mobile-first app that matches creators for channel exchanges and scores trust from confirmed outcomes, not opinions.

Type
Web app · PWA
Role
Full-stack engineering: data model, security rules and app
Context
Live, installable as a PWA
Links
eta.ahmadthedev.com
Exchange Trust App landing screen on a phone

01Overview

Creators exchange channel subscriptions with each other, and the usual problem is the other side not keeping their part. Exchange Trust App matches channels by country, language, niche and size, walks both people through a confirmed exchange, and gives everyone a trust score that only completed, mutually confirmed exchanges can raise.

There is no custom backend server. A React single-page app on Cloudflare Pages talks to Supabase for Google sign-in, Postgres, Realtime and Edge Functions, and the database itself is the security boundary.

02Exchange flow

01 · RPC request_exchangeRequestedRate limits checked per person
02 · partner acceptsAccepted72-hour clock starts
03 · both confirmCompletedScore events written for both
Ends earlyDeclined · CancelledPartner notified
pg_cron · every 15 minExpiredNo-show penalty if you were confirmed
Report filedDisputedAdmin upholds or dismisses
Exchange states: requested, then accepted, then completed when both sides confirm. A request can be declined or an exchange cancelled. An accepted exchange that is not fully confirmed within 72 hours expires through a scheduled job. A report moves an exchange to disputed for admin review.

03What I built

  1. Google sign-in with basic scopes only (name, email and photo), channel profiles with up to 20 channels per account, and a Discover screen filtered by country, language, niche and channel size.
  2. A seven-state exchange flow (requested, accepted, completed, declined, cancelled, expired and disputed) with 72-hour expiry, reports, and public profiles showing each person’s score and trust tag.
  3. An in-app notification bell updated live over Supabase Realtime, plus a welcome email and a weekly report sent through Resend from an Edge Function, with one-click unsubscribe.
  4. An admin area for reports, users, channels and niches, backed by an audit log, and an installable PWA whose service worker caches the app shell but never touches API requests.
ReactTypeScriptViteTailwind CSSTanStack QuerySupabasePostgreSQLpg_cronEdge FunctionsResendCloudflare Pages

04Engineering notes

01The browser is untrusted

The client never writes a score, a status or a confirmation. Every state change is a Postgres function that checks who is calling and whether the move is legal, with row-level security on every table and row locks so two confirmations can’t race. A modified client can’t raise a score or skip a step.

02A score that can’t be farmed

Only completed exchanges add points, and confirmations from trusted partners are worth more. Old events fade with a 90-day half-life, and each pair of people can earn from at most two exchanges, so two accounts can’t inflate each other. The score is recomputed from an append-only ledger, so decay and corrections are replayable.

scoring
score  = min(100, max(0, Σ δ · 2^(−age_days / 90)))
δ      = 10 × (0.5 + partner_score / 100) × pair_cap
pair_cap = 1 for the first two exchanges with a person, then 0

03Score the person, not the channel

An account can list up to 20 channels, but open-exchange caps and daily request limits count per person: 2 open and 5 requests a day while unproven, then 5 and 20. A channel URL can belong to only one account, and two channels from the same account can never be matched.

04Background work without a server

pg_cron handles expiry, reminders and nightly score recomputation inside the database. Emails go through an outbox table that a minute-by-minute job drains via an Edge Function, so a failed send is retried instead of lost. Every admin action writes its audit row in the same transaction, and the audit log rejects edits even from the SQL editor.

05Interface

→Outcome

A live, installable app where trust is enforced by the database: states, scores and limits that a tampered client can’t touch, with no backend server to run.

Next projectRAG Support Agent

→Get in touch

Building something
interesting?

[email protected]