A paper trading platform where you can practice stock trading with $100K in virtual cash using real-time market data. No real money involved — just learn and experiment.
- Frontend: Next.js, TypeScript, Tailwind CSS, Zustand, Recharts
- Backend: Go, Gin, PostgreSQL, JWT auth
- Real-time: WebSocket for live price updates
- Market Data: Finnhub API
- Node.js (v18+)
- Go (v1.24+)
- PostgreSQL database (we used Neon but any Postgres works)
- Finnhub API key (free tier works fine)
git clone https://github.com/yourusername/PaperStack.git
cd PaperStackcd backendCreate a .env file:
DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require
JWT_SECRET=some_secret_key
STOCK_API_KEY=your_finnhub_api_key
PORT=8080
Run the database migrations against your Postgres instance — the SQL files are in backend/db/migrations/ (run them in order: 001_initial_schema.sql, then 002_watchlist_badges.sql).
Install dependencies and start the server:
go mod download
go run main.goBackend runs on http://localhost:8080.
cd frontend
npm install
npm run devFrontend runs on http://localhost:3000.
- Register/login with JWT authentication
- Search stocks and view real-time quotes
- Buy and sell stocks with your virtual portfolio
- Track portfolio value over time with charts
- Watchlist to keep an eye on stocks
- Compare stocks side by side
- Leaderboard to see how you rank
- Badges and achievements
- Portfolio diversification score
- Full transaction history
PaperStack/
├── frontend/ # Next.js app
│ └── src/
│ ├── app/ # Pages (dashboard, trade, compare, etc.)
│ ├── components/
│ ├── stores/ # Zustand state management
│ ├── hooks/
│ ├── lib/ # API client
│ └── types/
├── backend/ # Go API server
│ ├── handlers/ # Route handlers
│ ├── services/ # Business logic
│ ├── models/ # Data models
│ ├── middleware/ # JWT auth middleware
│ ├── db/
│ │ ├── migrations/
│ │ ├── queries/ # SQL queries (sqlc)
│ │ └── sqlc/ # Generated code
│ └── config/
└── .github/