A high-performance, decentralized prediction market platform built using a modern TypeScript monorepo architecture. Users can connect their Solana wallet (Solflare), onramp mock USD, split/merge positions, and trade on live prediction markets with automated orderbook matching.
Users are greeted with a premium dark-mode interface prompting them to sign in using their Solana wallet.

Authentication is handled via a secure cryptographic message signature using the Solflare wallet.

Once authenticated, users can browse and trade live prediction markets. This page displays active order count and quick action buttons for YES/NO positions.

Simulate deposition and withdrawal of funds to trade inside the markets.

This project is structured as a Turborepo monorepo using Bun workspaces for blazing-fast builds and dependency management.
├── apps/
│ ├── frontend/ # Vite + React (TypeScript) SPA Client
│ └── backend/ # Express server handling matching engine logic & endpoints
├── packages/
│ ├── db/ # Database package containing Prisma Client & Schema
│ ├── ui/ # Shared React UI components
│ ├── eslint-config/ # Global ESLint rules
│ └── typescript-config/ # Global tsconfig rules
- Frontend: React 19, Vite, TypeScript, Vanilla CSS (Premium Dark Mode)
- Backend: Express, TypeScript, Bun runtime
- Database: PostgreSQL, Prisma ORM,
@prisma/adapter-pg - Authentication: Solana Web3 Auth via Supabase Custom Claims
- Build System: Turborepo, Bun Workspaces
- Bun runtime installed.
- Docker Desktop installed & running.
- Solflare Browser Extension installed on your browser.
-
Clone the repository:
git clone <your-repo-url> cd prediction-market-yt
-
Install Dependencies:
bun install
-
Start the Local Database: Make sure Docker Desktop is open, then start your local PostgreSQL container (or configure your own postgres connection string in
packages/db/.envandapps/backend/.env). -
Sync Schema and Seed Data: Migrate the database schema to your local Postgres instance:
# In packages/db bun x prisma db push bun x prisma generateSeed the database with sample prediction markets:
bun run seed.ts
-
Start the Development Servers: From the project root, start both the frontend and backend servers simultaneously:
bun run dev
- Frontend Application:
http://localhost:5173 - Backend API:
http://localhost:3000
- Frontend Application:
Extract your PostgreSQL connection string from your hosted provider (e.g., Supabase or Neon). Use the Transaction Pooler connection string (usually port 6543) for production services.
Run migrations and seed the live database:
DATABASE_URL="your-production-connection-string" bun --filter=db exec prisma db push
DATABASE_URL="your-production-connection-string" bun --filter=db run seed.tsDeploy apps/backend to Railway, Render, or Fly.io:
- Build Command:
bun install - Start Command:
bun run index.ts - Environment Variables:
DATABASE_URL: (Your production database connection string)SUPABASE_SECRET_KEY: (Your Supabase service key)
Deploy apps/frontend to Vercel or Netlify:
- Root Directory:
apps/frontend - Build Command:
npm run build(orbun run build) - Output Directory:
dist - Environment Variables:
VITE_API_URL: (Your hosted backend URL)