A comprehensive crypto trading simulator built with modern web technologies. Practice trading cryptocurrencies with virtual money, track your portfolio performance, and analyze market trends through interactive charts.
FinalResults.2.mp4
- Virtual Trading: Start with $10,000 virtual cash to practice trading
- Simulated Price Updates: Realistic cryptocurrency price movements with mock data
- Buy/Sell Orders: Execute market orders for Bitcoin, Ethereum, Tether, Binance Coin, and Cardano
- Portfolio Tracking: Monitor holdings, average purchase prices, and P&L
- Authentication: Secure signup/login with JWT tokens
- User Profiles: View trading statistics and profile information
- Transaction History: Complete record of all trades with timestamps and delete functionality
- Interactive Charts: Price charts with historical data simulation
- Portfolio Breakdown: Visual representation of holdings and performance
- Performance Metrics: Unrealized and realized P&L calculations
- Dark Mode: Professional dark theme for optimal viewing
- Responsive Design: Mobile-first UI with Tailwind CSS
- Type Safety: Full TypeScript implementation
- Real-time Updates: 5-minute portfolio refresh cycles
- Local Storage: Persistent data storage for portfolios and transactions
- React 19 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- Recharts for data visualization
- React Router for navigation
- Axios for API calls
- Node.js with Express.js
- MongoDB with Mongoose ODM
- JWT for authentication
- bcryptjs for password hashing
- ESLint for code quality
- Git for version control
- Environment-based configuration
CryptoTradeGame/
β
βββ backend/
β βββ middleware/
β βββ models/
β βββ routes/
β βββ services/
β β
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ trading/
β β βββ contexts/
β β βββ hooks/
β β βββ pages/
β β βββ utils/
β β βββ App.tsx
β β βββ main.tsx- Node.js (v16 or higher)
- MongoDB (local installation or MongoDB Atlas account)
- Git
-
Clone the repository
git clone https://github.com/DeepakSinghRajputC/CryptoTradeGame.git cd CryptoTradeGame -
Backend Setup
cd backend npm installCreate a
.envfile in the backend directory:PORT=5000 MONGODB_URI=mongodb://localhost:27017/cryptotrade JWT_SECRET=your-super-secret-jwt-key-here
Note: For MongoDB Atlas, replace the MONGODB_URI with your connection string.
-
Frontend Setup
cd ../frontend npm installCreate a
.envfile in the frontend directory:VITE_API_BASE_URL=http://localhost:5000
-
Start MongoDB
- Local MongoDB: Ensure MongoDB is running on your system
- MongoDB Atlas: Update the connection string in
backend/.env
-
Start the Backend Server
cd backend npm startThe server will start on http://localhost:5000
-
Start the Frontend Development Server
Open a new terminal and run:
cd frontend npm run devThe frontend will be available at http://localhost:5173
-
Access the Application
- Open http://localhost:5173 in your browser
- Create a new account or login with existing credentials
- Start practicing crypto trading with virtual money!
- Port conflicts: If port 5000 or 5173 is busy, update the PORT in
.envfiles - MongoDB connection: Ensure MongoDB is running locally or your Atlas connection string is correct
- Dependencies: Run
npm installin both directories if you encounter missing modules
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profile
POST /api/trade/buy- Execute buy orderPOST /api/trade/sell- Execute sell order
GET /api/prices- Get current cryptocurrency prices
PORT=5000
MONGODB_URI=mongodb://localhost:27017/cryptotrade
JWT_SECRET=your-jwt-secret-key
CMC_API_URL=https://sandbox-api.coinmarketcap.com/v1/cryptocurrency/listings/latest
CMC_API_KEY=your-coinmarketcap-api-keyVITE_API_BASE_URL=http://localhost:5000- Sign Up/Login: Create an account or login with existing credentials
- View Dashboard: See your portfolio, recent transactions, and market prices
- Trade: Use the trade form to buy/sell cryptocurrencies
- Monitor Performance: Track your P&L and portfolio value
- Analyze Charts: Use price charts to make informed trading decisions
This project is licensed under the MIT License - see the LICENSE file for details.
- CoinMarketCap for providing cryptocurrency data
- React and Vite communities for excellent documentation
- Tailwind CSS for beautiful styling utilities