Real-time multiplayer economic simulation and card trading game — bet on creators, ride the curve, beat the market.
Tropex is a real-time multiplayer trading platform where players buy and sell creator cards whose prices move along a sigmoid bonding curve based on live market activity. Think of it as a stock market, but the assets are people — and the price is determined by math, not mood.
Built as a full-stack monorepo with a focus on real-time performance, provably fair pricing, and a clean developer experience.
| Layer | Tech |
|---|---|
| Runtime | Bun |
| Framework | Express 5 |
| Language | TypeScript |
| ORM | Prisma |
| Database | Neon (PostgreSQL) |
| Cache / Pub-Sub | Upstash Redis |
| Auth | Supabase Auth |
| Realtime | Supabase Realtime |
| Layer | Tech |
|---|---|
| Framework | Next.js 15 (App Router) |
| Styling | Tailwind CSS |
| Components | shadcn/ui |
| Charts | Recharts |
| Language | TypeScript |
tropex/
├── apps/
│ ├── server/ # Express 5 backend (Bun)
│ └── web/ # Next.js 15 frontend
├── packages/
│ └── db/ # Prisma schema + client (shared)
└── package.json
- Supabase Auth integration (email/password)
- JWT verification middleware on all protected routes
- Session handling with Supabase client
- Full CRUD for creator cards
- Card metadata: name, category, description, image
- Seeded database with initial card set
- Price determined by supply via a sigmoid function — early buyers get low prices, late buyers pay a premium
- Built with
decimal.jsfor precision arithmetic — no floating point drift - Price recalculated on every trade
- Buy and sell endpoints with atomic wallet + holding updates
- Trade validation: balance checks, holding checks, supply checks
- Full trade history stored per user
- Per-user wallet with balance tracking
- Debit/credit on trade execution
- Transaction log
- Aggregated holdings per user
- Current value computed from live card prices
- P&L calculation (cost basis vs. current value)
- Ranked by portfolio value
- Supports pagination
- Seed script for cards, users, and initial balances
- Deterministic — safe to re-run in dev
Card price is derived from total supply using a sigmoid function:
price = P_min + (P_max - P_min) / (1 + e^(-k * (supply - midpoint)))
P_min/P_max— floor and ceiling price boundsk— steepness of the curve (controls how fast price rises)midpoint— supply at which price is halfway between min and max
All arithmetic uses decimal.js to prevent precision loss at scale.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup |
Register new user |
| POST | /api/auth/login |
Login, returns session |
| POST | /api/auth/logout |
Invalidate session |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cards |
List all cards with current prices |
| GET | /api/cards/:id |
Get single card detail |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/trade/buy |
Buy shares of a card |
| POST | /api/trade/sell |
Sell shares of a card |
| GET | /api/trade/history |
Get user's trade history |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/wallet |
Get current balance |
| GET | /api/wallet/transactions |
Get transaction log |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/portfolio |
Get all holdings with current value and P&L |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/leaderboard |
Get top players ranked by portfolio value |
- Bun >= 1.0
- Node.js >= 18 (for Next.js)
- A Neon PostgreSQL database
- A Supabase project (Auth + Realtime)
- An Upstash Redis instance
# Clone the repo
git clone https://github.com/yourusername/tropex.git
cd tropex
# Install dependencies
bun installCreate .env files in both apps/server and apps/web.
apps/server/.env
DATABASE_URL=
DIRECT_URL=
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
PORT=3001apps/web/.env.local
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_API_URL=http://localhost:3001# Push schema to your Neon database
cd packages/db
bunx prisma db push
# Seed initial data
bun run seed# Run both apps concurrently from root
bun run devOr individually:
# Backend (runs on :3001)
cd apps/server && bun run dev
# Frontend (runs on :3000)
cd apps/web && bun run dev- Auth system
- Cards API + pricing engine
- Trade, Wallet, Portfolio, Leaderboard APIs
- Database seeding
- Cards display page
- Marketplace page
- Card detail page
- Leaderboard page
- Wallet page
- Profile page
- Tiered IPO fee system for card creation
- Creator dashboard
- Revenue sharing mechanics
- Claude API-powered in-game news feed
- Market events generated from trade activity
- AI commentary on price movements
This is a personal project — not open to contributions at this stage.