PitchTank is an interactive investment simulation platform that allows users to invest in startup founders using virtual currency. The platform utilizes an Automated Market Maker (AMM) model to determine founder share prices based on supply and demand dynamics.
- User Authentication: Secure signup and login functionality with event-based redirects
- Event-Based System: Multiple pitch events with different founders
- QR Code Sharing: Share event links via QR codes for instant participant onboarding
- Investment Simulation: Invest virtual currency in promising founders
- Automated Market Maker (AMM): Dynamic pricing using constant product formula (x × y = k)
- Real-time Updates: Live price changes and portfolio tracking
- Leaderboards: Track top founders and investors
- Interactive Trading Table: Clean, minimal interface showing owned stock and current prices
- Tabbed Interface: Switch between Trading and Leaderboard views
- Interactive Dashboard: Monitor your investments and market performance
- Price History: View historical price trends with interactive charts
- Fancy Dark Blue Theme: Modern, elegant dark theme with animated gradients, glowing effects, and smooth transitions
- Comprehensive Testing: Stress tests with 100 concurrent users and 12 edge case scenarios
- Frontend: React with TypeScript
- State Management: React hooks and context
- Styling: TailwindCSS with custom dark blue theme and advanced CSS animations
- QR Codes: qrcode.react for event sharing
- Backend: Supabase (PostgreSQL, Authentication, Storage)
- Serverless Functions: Supabase Edge Functions
- Realtime Updates: Supabase Realtime
- Testing: TypeScript with ts-node for stress and edge case testing
- Node.js (v14 or higher)
- npm or yarn
- Supabase account
-
Clone the repository:
git clone https://github.com/yourusername/PitchTank.git cd PitchTank -
Install dependencies:
npm install # or yarn -
Create a
.envfile in the root directory with your Supabase credentials:VITE_SUPABASE_URL=your_supabase_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key -
Start the development server:
npm run dev # or yarn dev -
Open http://localhost:5173 to view the app in your browser.
PitchTank includes comprehensive test suites for the AMM trading system:
# Run all tests
npm test
# Run stress test (100 concurrent users)
npm run test:stress
# Run edge case tests (12 scenarios)
npm run test:edgeSee tests/README.md for detailed testing documentation.
-
Create the following tables in your Supabase project:
events: Pitch eventsfounders: Startup founders participating in eventsinvestors: Users with investment capabilitiesinvestor_holdings: Investment positionstrades: Record of all buy/sell transactionsprice_history: Historical price data for foundersuser_roles: User permissions and roles
-
Deploy the Edge Function for trade execution:
supabase functions deploy executeTrade
src/
├── components/ # UI components
├── hooks/ # Custom React hooks
├── lib/ # Utilities and services
│ ├── supabaseClient.ts # Supabase client setup
│ └── ammEngine.ts # AMM calculations
├── pages/ # Page components
├── types/ # TypeScript type definitions
├── main.tsx # App entry point
└── index.css # Global styles
PitchTank uses an AMM model for pricing founder shares. The core formula is x × y = k, where:
x: Shares in the pooly: Cash in the poolk: Constant product value
This creates a price curve where buying shares increases price and selling decreases it, simulating market dynamics.
Investors start with an initial balance and can:
- Buy shares in founders
- Sell shares to realize gains/losses
- Track performance via ROI percentage
Each PitchTank event represents a pitch competition with:
- Multiple founders
- Independent investor leaderboards
- Separate investment pools
- 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
Distributed under the MIT License. See LICENSE for more information.
PitchTank includes enterprise-grade testing:
- Simulates 100 concurrent users trading simultaneously
- Verifies constant product formula (x × y = k) is maintained
- Ensures share conservation and no negative values
- Performance metrics and bottleneck identification
12 comprehensive edge case tests including:
- Price cap enforcement ($100 maximum)
- Minimum reserve protection
- Zero and negative value handling
- Very large trade impact
- Floating-point precision over 100 trades
- Round trip arbitrage prevention
- Depleted pool behavior
- Market cap calculation accuracy
- Extreme K constant values
- Monotonic price increase verification
See tests/README.md for complete testing documentation.
PitchTank features a sophisticated dark theme with professional CSS:
- Primary Colors: Deep blues (#0052b3 to #1a80ff)
- Dark Backgrounds: Multi-layered gradients with animated orbs
- Accent Colors: Cyan (#00d4ff) for highlights and emphasis
- Grid Pattern Overlay: Subtle tech-inspired grid backgrounds
- Animated Gradients: Pulsing gradient orbs for depth and movement
- Interactive Elements: Glow effects on hover and focus states
- Typography: High contrast gradient text for excellent readability
- Event Pages: Tabbed interface with Trade and Leaderboard views
- Trading Table: Clean, minimal table format with inline buy/sell actions
- QR Share Modal: Beautiful modal with QR code generation and sharing
- Liquid Capital Display: Fixed label showing available trading balance
- Glassmorphic Cards: Cards with subtle gradients and border effects
- Smooth Animations: Professional transitions throughout the app
- Responsive Design: Optimized for all screen sizes
- Consistent Spacing: Professional typography and spacing system
- Accessible Color Contrasts: WCAG compliant color combinations