How sbktckp/clipency works
Purpose and deployment
Clipency is a performance-based creator marketplace: brands fund CPM campaigns; clippers submit short-form content; staff review it; verified views drive creator earnings and brand spend. It is a static HTML/CSS/vanilla-JS frontend deployed to Vercel, backed by Supabase PostgreSQL, Auth, RPCs, and Edge Functions. Primary deployment/routing policy is in vercel.json; authenticated-route deployment settings also exist in auth/vercel.json.
Entry points and route topology
The public entry is index.html, with a mobile alternative at landing-mobile/index.html. The application’s authenticated surface begins at auth/index.html; its principal creator workspace/dashboard is auth/dashboard.html with logic in auth/dashboard.js. Vercel rewrites friendly root routes into auth/; root physical assets can override those rewrites, including duplicate root clipency-*.js files.
Client boot, identity, and authorization
Browser-side Supabase initialization is centralized in auth/supabaseClient.js (and a root counterpart at supabaseClient.js). Authentication entry protection and role-based destination selection are handled by auth/clipency-auth-entry-guard.js, auth/access-control.js, and auth/role-router.js. Roles form an explicit trust boundary: clippers and brands use product flows; admins receive full operational access; reviewers are restricted to submission decisions. The frontend must not be treated as the authorization boundary—privileged Supabase RPCs enforce staff/admin checks.
Creator workflow and marketplace
The creator-facing application combines dashboard, campaign discovery, account linking, submission, earnings, and reporting. The core UI/data orchestration is concentrated in auth/clipency-functional-core.js, while campaigns are surfaced through auth/campaigns/index.html, auth/clipency-campaigns-classic.js, and auth/clipency-campaign-detail-bridge.js. Submission is a discrete stage in auth/clipency-clip-submit.js; connected social accounts and payout views live under auth/accounts/index.html and auth/payouts/index.html. This flow reads/writes Supabase data through the browser client and RPC/query interfaces.
Staff operations and review boundary
Admin operations are a separate admin-OS shell, anchored by auth/admin/index.html, auth/clipency-admin-os.js, and auth/clipency-admin-launch.js. It covers campaign management, users, leads, connected accounts, payouts, logs, and review queues. Reviewers use the narrower review surface at auth/review/index.html and auth/clipency-admin-review-actions.js: approve/reject actions transition submitted clips into or out of the live/earning lifecycle. Admin and reviewer access should be verified server-side via Supabase staff gates and revoked public RPC execution.
Financial, analytics, and operational integrations
Payout/account status and dynamic earnings presentation are implemented client-side in auth/clipency-wallet.js, auth/clipency-payouts-dynamic.js, and auth/clipency-stats-dynamic.js, with authoritative financial state residing in Supabase. The README also identifies an external Next.js finance dashboard at finance.clipency.in, plus custom Supabase analytics views. Operations include a Telegram COO bot implemented outside this tree as Supabase Edge Functions, triggered through webhooks and scheduled via pg_cron/pg_net; its secrets remain in Supabase/Vercel rather than source.
Architectural constraints
The system is predominantly progressive/static pages enhanced by many independently loaded scripts, rather than a bundled SPA framework. UI panels in the admin OS must mount under #cxos, and dynamic data should use delegated listeners rather than inline handlers. Supabase query failures require try/catch; server database migrations are managed through Supabase migration tooling, not direct production SQL.
Main entry points: clipency-auth-entry-guard.js Identity and role routing · clipency-functional-core.js Creator workflow core · supabaseClient.js Browser Supabase client · index.html Authenticated entry
Components 19
Public entry
- Vercel routing · Rewrites friendly routes into the authenticated surface.
vercel.json - Public landing
index.html - Mobile landing
landing-mobile/index.html
Authenticated client
- Authenticated entry
auth/index.html - Identity and role routing · Selects product destinations by role; not the final authorization boundary.
auth/clipency-auth-entry-guard.js - Browser Supabase client
auth/supabaseClient.js - Creator dashboard
auth/dashboard.html - Creator workflow core · Coordinates dashboard, earnings, account, and marketplace interactions.
auth/clipency-functional-core.js - Campaign discovery
auth/campaigns/index.html - Clip submission
auth/clipency-clip-submit.js - Accounts and payouts
auth/accounts/index.html
Staff operations
- Admin OS · Mounts operational panels under #cxos.
auth/admin/index.html - Admin operations · Manages campaigns, users, accounts, payouts, logs, and queues.
auth/clipency-admin-os.js - Reviewer queue
auth/review/index.html - Review decisions · Approves or rejects submitted clips.
auth/clipency-admin-review-actions.js
Supabase backend
- Supabase platform · Authoritative marketplace, financial, identity, and authorization state.
- Privileged RPC staff gates · Enforces staff/admin checks and restricts public RPC execution.
External operations
- Telegram COO automation · Webhook and scheduled operational automation using pg_cron and pg_net.
- Finance dashboard
Connections 24
- Vercel routing → Public landing: serves root
- Vercel routing → Authenticated entry: rewrites authenticated routes
- Public landing → Authenticated entry: sign-in path
- Mobile landing → Authenticated entry: sign-in path
- Authenticated entry → Identity and role routing: boots
- Identity and role routing → Browser Supabase client: checks session
- Identity and role routing → Creator dashboard: routes clippers and brands
- Identity and role routing → Admin OS: routes admins
- Identity and role routing → Reviewer queue: routes reviewers
- Creator dashboard → Creator workflow core: loads workflow UI
- Creator workflow core → Campaign discovery: surfaces campaigns
- Creator workflow core → Clip submission: submits clips
- Creator workflow core → Accounts and payouts: shows accounts and earnings
- Creator workflow core → Browser Supabase client: queries and invokes RPCs
- Browser Supabase client → Supabase platform: Auth, queries, RPCs
- Admin OS → Admin operations: loads operations
- Admin operations → Browser Supabase client: admin data and actions
- Reviewer queue → Review decisions: loads decisions
- Review decisions → Browser Supabase client: transitions clip status
- Supabase platform → Privileged RPC staff gates: executes privileged RPC checks
- Privileged RPC staff gates → Admin operations: authorizes admin operations
- Privileged RPC staff gates → Review decisions: authorizes review decisions
- Supabase platform → Telegram COO automation: webhooks and scheduled triggers
- Finance dashboard → Supabase platform: reads finance and analytics state