Skip to content

feat(routes-f): add creator earnings breakdown api#543

Merged
davedumto merged 15 commits intoStreamFi-x:devfrom
ACOB-DEV:codex/feat-routes-f-408-earnings-only
Apr 3, 2026
Merged

feat(routes-f): add creator earnings breakdown api#543
davedumto merged 15 commits intoStreamFi-x:devfrom
ACOB-DEV:codex/feat-routes-f-408-earnings-only

Conversation

@ACOB-DEV
Copy link
Copy Markdown
Contributor

Description

Implements the creator earnings breakdown API for routes-f, including authenticated earnings time-series responses, cached lifetime/monthly summaries, top supporters aggregation, and the supporting XLM pricing/schema helpers needed for the endpoint to run.

Closes #408

Changes proposed

What were you told to do?

Build GET /api/routes-f/earnings and GET /api/routes-f/earnings/summary so creators can view their earnings by source and period, with USD conversion from the cached XLM price endpoint, top supporters, date filtering, and summary caching.

What did I do?

Earnings endpoints

  • Added GET /api/routes-f/earnings with session auth, from/to filtering, day|week|month grouping, totals, and per-transaction detail.
  • Added GET /api/routes-f/earnings/summary with all-time, this-month, last-month, and top-10 supporter aggregation for the authenticated creator.
  • Scoped both endpoints to the logged-in creator so one user cannot read another creator's earnings.

Pricing and caching

  • Added a shared XLM pricing helper and updated /api/prices/xlm plus the earnings service to use the same cached price source.
  • Added Redis-backed JSON caching with an in-memory fallback so the summary endpoint honors the requested 5-minute cache behavior when Upstash is configured.

Schema and verification support

  • Added a migration for the earnings data sources used by this API: tip_transactions, gift_transactions, and subscriptions.
  • Added a focused unit test for time-period grouping.
  • Added the smallest safe runtime/type shim for the existing Transak hook so the repository can pass its required pre-commit build checks without bypassing hooks.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

Screenshots / Testing Evidence

  • npm test -- --runInBand __tests__/lib/routes-f/format.test.ts
  • npm run type-check
  • npm run build
  • Build completed successfully; local warnings about missing Upstash, Mux, and Postgres environment variables remained non-blocking.

davedumto and others added 14 commits March 12, 2026 14:11
- move past streams from tab to inline section on explore home
- add proper empty states to live, trending sections (dashed border card with icon)
- add skeleton loaders to /explore/live and /explore/trending pages
- add explore/loading.tsx for page-level navigation skeleton
- remove unimplemented watch-later and saved pages and nav links
- fix Heart icon missing import in sidebar data
- replace about section image with streamer.jpg, full-height flex layout
- rewrite about section body copy and steps to remove nft/defi/staking claims
- update all 4 faq answers with accurate, distinct, no-hyphen copy
- delete unused about-image svg
- build twitch-style carousel: left/right peek cards, nav arrows, progress dots
- auto-play featured stream (live or vod recording) via mux player
- unmute on play via ref+event to bypass autoPlay="muted" browser restriction
- fall back to past recordings in featured slot when no live streams
- move streamer info, live/vod badge, view count and mute button to top bar
- suppress neon db connection warn in dev so next.js overlay doesn't trigger
seo:
- fix metadataBase to www.streamfi.media
- add robots, manifest, icons metadata and json-ld scripts
- dynamic sitemap with top 500 users + static routes
- per-page metadata for landing, explore, browse pages
- username layout: live-aware title, og:profile, person + videoobject json-ld
- dynamic og image for streamer profiles (1200x630, nodejs runtime)
- x-robots-tag noindex for /dashboard and /settings layouts
- robots.txt and pwa manifest.json

profile icons:
- add lib/profile-icons.ts with 9 icons, random and deterministic helpers
- avatar modal: 3x3 icon grid, fix preview sync on selection
- registration routes: assign random icon on signup
- auth provider: support string avatarUrl alongside file upload
- api update routes: handle preset icon saves + cloudinary cleanup
- replace all user.png fallbacks with getDefaultAvatar(username)

fix: resolve curly-brace lint errors that were blocking ci
- add /admin layout with sidebar, protected route (privy session allowlist)
- analytics page: 6 real-time stat cards (30s SWR refresh)
- user management: paginated list, search, filter, ban/unban, delete
- content moderation: stream reports + bug reports with status actions
- category management: create, edit, delete with cloudinary image upload
- wire ReportLiveStreamModal and ReportBugForm to real API endpoints
- add admin auth guard to category POST/PATCH/DELETE routes
- add admin subdomain redirect in middleware (admin.streamfi.media)
- db migration: is_banned cols on users, stream_reports, bug_reports tables
- Banner upload in profile settings with Cloudinary, shown on profile
- Profile share buttons copy URL to clipboard with toast feedback
- Chat input always visible via absolute inset-0 scroll container
- Emoji picker with 4 categories in chat input
- Fix SidebarWrapper height overflow hiding chat input
- Fix LIVE badge clipping in Sidebar expanded view
- Add UsernamePromptModal with 24-hour snooze for users without
  a username set
- Fix DialogTitle accessibility error in ReportLiveStreamModal
- Fix watch page share to clipboard-only
- Fix stream info section design system tokens
- Updated chat-section.tsx: replaced Wallet icon with LogIn, added onLoginClick prop
- Updated view-stream.tsx: wired Privy login() to sidebar and fullscreen overlay chat
- Updated chat-section.test.tsx: updated test expectations for new prompt text
- Fixed pre-existing lint error in profile-header.tsx (missing curly braces)
- Ran Prettier on files with formatting issues
- fix window.location.replace for live redirect (avoid RSC fetch failure)
- add mobile chat clearance for bottom nav
- extract shared emoji data to lib/emoji-categories.ts (DRY)
- add emoji picker to dashboard stream-manager chat
- increase chat icon spacing
- add fullscreen chat overlay outside-click-to-close on mobile
- move fullscreen collapsed chat button to bottom on mobile
- fix StreamInfo empty src when thumbnail is null
- add share button to clip player page and clips grid cards
- add OG metadata layout and branded opengraph-image for clip detail pages
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@ACOB-DEV is attempting to deploy a commit to the chibuikemmichaelilonze's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

👷 Deploy request for streamfi pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 66585ef

@ACOB-DEV ACOB-DEV changed the base branch from main to dev March 29, 2026 21:47
}

function StreamerAvatar({ src, name }: { src: string; name: string }) {
if (src.includes("cloudinary.com")) {

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
cloudinary.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
opacity-50 hover:opacity-75 transition-all duration-300 hover:scale-[1.02]
${side === "left" ? "origin-right" : "origin-left"}`}
>
{thumb.includes("cloudinary.com") || thumb.includes("mux.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
cloudinary.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
opacity-50 hover:opacity-75 transition-all duration-300 hover:scale-[1.02]
${side === "left" ? "origin-right" : "origin-left"}`}
>
{thumb.includes("cloudinary.com") || thumb.includes("mux.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
mux.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
/>
) : (
<div className="absolute inset-0">
{thumb.includes("cloudinary.com") || thumb.includes("mux.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
cloudinary.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
/>
) : (
<div className="absolute inset-0">
{thumb.includes("cloudinary.com") || thumb.includes("mux.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
mux.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
@davedumto davedumto merged commit 0ff92a2 into StreamFi-x:dev Apr 3, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(routes-f): creator earnings breakdown api

3 participants