Probo is a modern prediction market platform built with Next.js 15, TypeScript, and Prisma. It allows users to create markets, make predictions, and trade on outcomes using a sophisticated pricing mechanism. The platform features real-time updates, admin controls, and a beautiful responsive UI.
- Prediction Markets: Create and participate in prediction markets
- Real-time Trading: Dynamic pricing using automated market maker (AMM) algorithm
- User Authentication: Secure authentication with Clerk
- Admin Dashboard: Comprehensive admin interface for market management
- Responsive Design: Modern UI built with Tailwind CSS and Radix UI
- Real-time Updates: Live market data and trading information
- Market Browsing: View all available prediction markets
- Trading Interface: Intuitive trading cards with Yes/No options
- Balance Management: Track and manage trading balance
- Trade History: View past trades and predictions
- Live Market Status: Real-time market status and countdown timers
- Market Creation: Create new prediction markets with custom questions
- Market Management: View, edit, and close markets
- Trade Monitoring: Monitor all trades and user activities
- User Management: View user balances and trading history
- Analytics Dashboard: Comprehensive market analytics
- Frontend: Next.js 15, React 18, TypeScript
- Styling: Tailwind CSS, Radix UI Components
- Database: PostgreSQL with Prisma ORM
- Authentication: Clerk
- Caching: Redis (Upstash)
- State Management: Zustand
- Animations: Framer Motion, GSAP
- Charts: Recharts
- Forms: React Hook Form with Zod validation
model User {
id String @id @unique @default(uuid())
clerkId String @unique
name String
username String? @unique
email String
balance Int
trades Trade[]
}
model Market {
id String @id @unique @default(uuid())
Question String
description String
yesCount Int
noCount Int
yesreserve Int
noreserve Int
category String
status MARKETSTATUS @default(OPEN)
endsAt DateTime
startedon DateTime @default(now())
predections Trade[]
}
model Trade {
id String @id @unique @default(uuid())
UserID String
user User @relation(fields: [UserID], references: [id])
TradeType TRADETYPE
tradeAmount Float
sharesbought Int
orderType ORDERTYPE @default(BUY)
time DateTime
predictionId String
prediction Market @relation(fields: [predictionId], references: [id])
}- Node.js 18+
- PostgreSQL database
- Redis instance (Upstash recommended)
- Clerk account for authentication
-
Clone the repository
git clone <repository-url> cd probo
-
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile with the following variables:# Database DATABASE_URL="postgresql://username:password@localhost:5432/probo" # Clerk Authentication NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key CLERK_SECRET_KEY=your_clerk_secret_key # Redis (Upstash) UPSTASH_REDIS_REST_URL=your_redis_url UPSTASH_REDIS_REST_TOKEN=your_redis_token # Admin Configuration ADMIN=admin_email@example.com ADMIN_KEY=admin_user_id
-
Database Setup
# Generate Prisma client npx prisma generate # Run migrations npx prisma migrate dev # (Optional) Seed database npx prisma db seed
-
Start Development Server
npm run dev
-
Open your browser Navigate to http://localhost:3000
probo/
โโโ app/ # Next.js App Router
โ โโโ (admin)/ # Admin route group
โ โ โโโ dashboard/ # Admin dashboard
โ โ โ โโโ [id]/ # Individual market view
โ โ โ โโโ MarketDetails.tsx
โ โ โโโ MarketCreate/ # Market creation interface
โ โโโ api/ # API routes
โ โ โโโ market/ # Market CRUD operations
โ โ โโโ trade/ # Trading operations
โ โ โโโ user/ # User management
โ โโโ StartTradingNow/ # Trading interface
โ โโโ Predictions/ # Predictions page
โ โโโ store/ # State management
โโโ components/ # Reusable UI components
โ โโโ ui/ # Base UI components
โ โโโ LandingPage.tsx # Landing page components
โโโ lib/ # Utility libraries
โ โโโ prisma.ts # Prisma client
โ โโโ redis.ts # Redis client
โ โโโ utils.ts # Utility functions
โโโ prisma/ # Database schema and migrations
โโโ public/ # Static assets
GET /api/market- Get all marketsPOST /api/market- Create new market (admin only)GET /api/market/[id]- Get specific market detailsPATCH /api/market/[id]- Update market (admin only)
POST /api/trade/[id]- Create new tradeGET /api/trade/[id]- Get trade detailsGET /api/trade/[id]/count- Get trade counts
GET /api/user- Get user informationPATCH /api/user- Update user data
The platform uses an Automated Market Maker (AMM) algorithm for pricing:
- Initial State: Each market starts with 100 shares each for Yes/No
- Pricing Formula: Uses constant product formula (k = yes_reserve ร no_reserve)
- Dynamic Pricing: Prices change based on trading volume and direction
- Liquidity: Maintains liquidity through reserve management
- User selects a market to trade on
- Chooses Yes/No prediction
- Specifies trade amount
- System calculates shares and updates reserves
- Trade is recorded and user balance is updated
- Market Creation: Admins can create markets with custom questions
- Market Management: View, edit, and close markets
- User Monitoring: Track user activities and balances
- Analytics: Comprehensive market and trading analytics
- Modern Interface: Clean, modern design with dark/light theme support
- Responsive Design: Mobile-first approach with Tailwind CSS
- Component Library: Reusable components built with Radix UI
- Animations: Smooth animations with Framer Motion and GSAP
- Intuitive Navigation: Clear navigation and user flows
- Real-time Updates: Live market data and status updates
- Loading States: Proper loading indicators and error handling
- Toast Notifications: User feedback for actions and errors
- Clerk Integration: Secure authentication with Clerk
- Role-based Access: Admin and user role management
- Protected Routes: Middleware protection for sensitive routes
- Session Management: Secure session handling
- Input Validation: Zod schema validation
- SQL Injection Prevention: Prisma ORM protection
- Rate Limiting: API rate limiting (configurable)
- Environment Variables: Secure configuration management
npm run build
npm startEnsure all environment variables are properly configured for production:
- Database connection string
- Clerk production keys
- Redis production credentials
- Admin configuration
- Vercel: Optimized for Next.js deployment
- Railway: Easy PostgreSQL and Redis hosting
- PlanetScale: Managed MySQL/PostgreSQL
- Upstash: Managed Redis service
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use conventional commit messages
- Write meaningful commit descriptions
- Test thoroughly before submitting PRs
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review existing issues and discussions
- Mobile app development
- Advanced analytics dashboard
- Social features and sharing
- Integration with external data sources
- Advanced trading features
- Multi-language support
- Advanced admin tools
- Database query optimization
- Caching strategies
- CDN integration
- Image optimization
Built with โค๏ธ using Next.js, TypeScript, and modern web technologies