Skip to content

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Environment Variables

Create a .env.local file with the following variables:

# Supabase
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key

# WalletConnect (optional) — enables the WalletConnect payout wallet connector.
# Obtain a project ID from https://cloud.walletconnect.com
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your-walletconnect-project-id

# GitHub — required for client downloads from TurboNodes/client-node Actions artifacts.
# Create a fine-grained or classic token with `actions:read` on that repository.
GITHUB_TOKEN=your-github-token

If NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is omitted, browser-injected wallets (e.g. MetaMask) still work; only the WalletConnect option is hidden.

Referral system

Apply the Supabase migrations before using referrals:

# Run in the Supabase SQL editor (in order):
# 1. supabase/migrations/001_referrals.sql
# 2. supabase/migrations/002_restore_grants.sql
# 3. supabase/migrations/003_commission_only_new_users.sql
# 4. supabase/migrations/004_node_earnings_only_commission.sql
# 5. supabase/migrations/005_tiered_referral_commission.sql

Migration 004_node_earnings_only_commission.sql ensures commissions are calculated from node operator earnings only — referral balance and non-date dailyEarnings entries never count.

Referral rewards: tiered lifetime commission on referred users' node operator earnings only, based on how many of your referrals are verified. A referral verifies automatically once that user earns more than $1 in node earnings, which stops empty signups from inflating a tier.

Tier Verified referrals Rate
Relay 0-4 5%
Hub 5-9 7.5%
Gateway 10-24 10%
Core 25-49 20%
Backbone 50+ 30%

The rate is resolved at payout time and applies forward only — already-commissioned earnings are never repriced, and each row in referral_earnings records the rate it was paid at. The ladder lives in two places that must stay in sync: referral_commission_rate() in supabase/migrations/005_tiered_referral_commission.sql (authoritative, computes payouts) and REFERRAL_TIERS in src/lib/referralTiers.ts (drives the dashboard UI).

Referral income a user receives from their own referrals is never commissionable for their referrer. Commissions are calculated automatically via database triggers when node earnings update. Only new signups can be attributed via a referral link.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Used by

Contributors

Languages