Mercor Clone is a demo marketplace application showcasing how to implement Whop Rails, a payments platform that enables you to operate marketplaces and platforms with ease.
This project demonstrates a complete end-to-end implementation of:
- Payins: Accept payments from buyers (recruiters posting gigs)
- Payouts: Send payments to sellers (earners completing gigs)
The app simulates a gig marketplace where recruiters post job listings and earners submit work, with Whop Rails handling all payment processing and disbursement logic.
Whop Rails is a payments platform designed for marketplaces and platforms. It handles:
- Payment processing
- Seller payouts
- Fee collection and management
- Compliance and fraud prevention
- Multi-party transaction flows
This demo shows how to integrate Whop Rails into a Next.js application using the Whop SDK and APIs.
For full documentation, visit docs.whop.com/payments/platforms for more information.
- Node.js 18+ installed
- pnpm installed
- PostgreSQL database (we'll use Vercel Postgres for production)
pnpm installCreate a .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/mercorclone?schema=public"
# Auth - Generate a secret with: openssl rand -base64 32
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"You have two options:
- Install Vercel CLI:
pnpm add -g vercel - Link your project:
vercel link - Create Postgres database:
vercel postgres create - Pull environment variables:
vercel env pull .env.local
- Install PostgreSQL locally
- Create a database:
createdb mercorclone - Update
DATABASE_URLin.envwith your local connection string
# Generate Prisma Client
pnpm prisma generate
# Run migrations
pnpm prisma migrate dev --name initpnpm devVisit http://localhost:3000 to see your app!
- Go to your Vercel project dashboard
- Navigate to the "Storage" tab
- Click "Create Database" and select "Postgres"
- Follow the prompts to create your database
In your Vercel project settings, add:
DATABASE_URL(automatically added when you create Postgres)NEXTAUTH_URL=https://your-domain.vercel.appNEXTAUTH_SECRET= Generate withopenssl rand -base64 32
vercel --prod# Connect to production database
vercel env pull .env.production
# Run migrations
pnpm prisma migrate deployThe app includes the following models:
- User: Stores user accounts with email/password authentication
- Account: For OAuth providers (future use)
- Session: Manages user sessions
- Listing: Job postings created by recruiters
- Submission: Applications from earners to listings
✅ Email/password authentication with NextAuth.js ✅ Secure password hashing with bcrypt ✅ Protected routes (earner and recruiter pages) ✅ Role-based access (EARNER or RECRUITER) ✅ Session management ✅ Sign in/Sign up pages ✅ Automatic redirect after authentication
# Open Prisma Studio to view/edit database
pnpm prisma studio
# Generate Prisma Client after schema changes
pnpm prisma generate
# Create a new migration
pnpm prisma migrate dev --name migration_name
# Reset database (WARNING: deletes all data)
pnpm prisma migrate reset
# Format Prisma schema
pnpm prisma formatMake sure you're using prisma-client-js in your schema, not prisma-client.
- Check your
DATABASE_URLis correct - Ensure your database is running
- For Vercel Postgres, make sure you've pulled the latest env vars
Add NEXTAUTH_URL to your .env file:
- Local:
http://localhost:3000 - Production:
https://your-domain.vercel.app