

A trading simulation platform to practice investing without financial risk.
Features โข Tech Stack โข Installation โข API โข Roadmap
TradeLab is a full-stack application that allows users to simulate buying and selling financial assets with real-time market data. Each user starts with a virtual portfolio of 10,000โฌ and can practice trading in realistic conditions.
โ ๏ธ MVP - This project is under active development. New features are coming regularly!
- Complete dashboard with performance visualization
- Track total value and portfolio evolution
- Asset allocation with automatic weighting
- Portfolio snapshots history
- Buy/Sell stocks with real-time bid/ask prices
- Market data powered by Alpaca & Finnhub
- Automatic unrealized P&L calculation
- Complete transaction history
- Price evolution charts (OHLC)
- Portfolio performance charts
- Modern interface with dark/light theme
- Secure sign up / sign in
- JWT management with NextAuth.js
- Password reset via email
- Automatic price updates via cron jobs
- Real-time market status (open/closed)
- Trading days calendar
| Technology | Usage |
|---|---|
| NestJS 11 | REST API Framework |
| Prisma 7 | ORM & migrations |
| PostgreSQL | Database |
| Passport JWT | Authentication |
| Swagger | API Documentation |
| Sentry | Monitoring & errors |
| Technology | Usage |
|---|---|
| Next.js 15 | React Framework (App Router) |
| React 19 | UI Library |
| TypeScript | Static typing |
| Tailwind CSS 4 | Styling |
| Radix UI | Accessible components |
| TanStack Query | Server state management |
| Recharts | Charts |
| React Hook Form + Zod | Forms & validation |
- Alpaca Markets - Real-time market data
- Finnhub - Company information & prices
trade-lab/
โโโ backend/ # NestJS API
โ โโโ src/
โ โ โโโ alpaca/ # Alpaca API integration
โ โ โโโ assets/ # Assets management
โ โ โโโ assets-price/ # Price history
โ โ โโโ auth/ # JWT authentication
โ โ โโโ email/ # Email service
โ โ โโโ finnhub/ # Finnhub integration
โ โ โโโ market-status/ # Market status
โ โ โโโ portfolios/ # Portfolio management
โ โ โโโ transactions/ # Transaction history
โ โ โโโ users/ # User management
โ โโโ prisma/ # Schema & migrations
โ
โโโ frontend/ # Next.js Application
โ โโโ app/ # Pages (App Router)
โ โ โโโ market/ # Market pages
โ โ โโโ portfolio/ # Portfolio pages
โ โ โโโ transactions/ # History
โ โ โโโ ...
โ โโโ components/ # React components
โ โ โโโ charts/ # Charts
โ โ โโโ portfolio/ # Portfolio components
โ โ โโโ ui/ # UI components (shadcn)
โ โโโ hooks/ # Custom hooks
โ โโโ mutations/ # TanStack Query mutations
โ โโโ lib/ # Utilities
โ
โโโ conception/ # Diagrams (ERD)
- Node.js 20+
- PostgreSQL 16+
- pnpm (recommended) or npm
git clone https://github.com/your-username/trade-lab.git
cd trade-labcd backend
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your API keys and DATABASE_URL
# Migrations & seed
npx prisma migrate dev
npx prisma db seed
# Start the server (port 3001)
npm run start:devcd frontend
pnpm install
# Configure environment variables
# Create .env.local with:
# NEXT_PUBLIC_NEST_API_URL=http://localhost:3001
# NEXTAUTH_SECRET=your-secret
# NEXTAUTH_URL=http://localhost:3000
# Start the application (port 3000)
pnpm dev| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login |
Login |
| POST | /users |
Sign up |
| POST | /auth/forgot-password |
Request password reset |
| POST | /auth/reset-password |
Reset password |
| Method | Endpoint | Description |
|---|---|---|
| GET | /assets |
List all assets |
| GET | /assets/:symbol |
Asset details |
| GET | /assets/:symbol/prices |
Price history |
| Method | Endpoint | Description |
|---|---|---|
| GET | /portfolios/:id |
Portfolio details |
| POST | /portfolios/:id/buy |
Buy an asset |
| POST | /portfolios/:id/sell |
Sell an asset |
| GET | /portfolios/:id/assets |
Portfolio assets |
| GET | /portfolios/:id/snapshots |
Value history |
| Method | Endpoint | Description |
|---|---|---|
| GET | /transactions |
Transaction history |
| Method | Endpoint | Description |
|---|---|---|
| GET | /market-status |
Market status |
# Backend - Unit tests
cd backend
npm run test
# Backend - E2E tests
npm run test:e2e
# Backend - Coverage
npm run test:cov- Advanced performance statistics
- Optimized mobile responsive
- ๐ User leaderboard
- ๐ Custom price alerts
- ๐ฐ Financial news integration
- ๐ฏ Trading goals & gamification
- ๐ Technical indicators (RSI, MACD, etc.)
- ๐ฑ Cryptocurrency support
This project is licensed under the MIT License - see the LICENSE file for details.
Built with โค๏ธ as a personal project to learn and demonstrate my full-stack development skills.
โญ If you like this project, feel free to give it a star!