# Quick Start Guide - Testing Market & Sell Fixes ## 🚀 Get Started in 5 Minutes ### Step 1: Set Up Steam API Key (2 minutes) 1. **Get your API key from SteamAPIs.com:** - Go to https://steamapis.com/ - Sign up for a free account - Copy your API key from the dashboard 2. **Add to your `.env` file:** ```bash # Open .env file in TurboTrades root directory # Add this line: STEAM_API_KEY=your_api_key_here ``` ### Step 2: Restart Backend (30 seconds) ```bash # Stop current backend (Ctrl+C) # Start again: npm run dev ``` You should see in the logs: ``` ✅ Server running on http://localhost:3000 ``` ### Step 3: Restart Frontend (30 seconds) ```bash # In frontend directory cd frontend npm run dev ``` You should see: ``` ➜ Local: http://localhost:5173/ ``` ### Step 4: Test Market Page (1 minute) 1. Open browser: `http://localhost:5173/market` 2. ✅ Items should load from database 3. ✅ Try filtering by game (CS2/Rust) 4. ✅ Try searching for items 5. ✅ Try sorting options **If you see infinite loading:** - Check browser console for errors - Check backend logs - Make sure backend is running on port 3000 ### Step 5: Test Sell Page (2 minutes) 1. **Login with Steam:** - Click "Login" button - Authenticate via Steam - You'll be redirected back 2. **Make your Steam inventory public:** - Open Steam client - Profile → Edit Profile → Privacy Settings - Set "Game details" and "Inventory" to **Public** 3. **Set your Trade URL (optional for testing):** - Go to profile page - Add your Steam Trade URL - Get it from: https://steamcommunity.com/id/YOUR_ID/tradeoffers/privacy 4. **Navigate to Sell page:** - Go to `http://localhost:5173/sell` - Should load your CS2 inventory automatically - ✅ Items should appear with images and prices 5. **Test selling:** - Click items to select them - Click "Sell Selected Items" - Confirm in the modal - ✅ Balance should update - ✅ Items removed from inventory --- ## 🐛 Troubleshooting ### Market Page Not Loading **Problem:** Infinite loading spinner **Check:** 1. Browser console - any errors? 2. Backend logs - is it receiving requests? 3. Database - are there items in the database? **Fix:** ```bash # Seed some items to the database node seed.js ``` ### Sell Page Shows Error **Error:** "STEAM_API_KEY not configured" - Make sure you added `STEAM_API_KEY` to `.env` - Restart the backend server **Error:** "Steam inventory is private" - Go to Steam → Profile → Privacy Settings - Make inventory **Public** **Error:** "Failed to fetch Steam inventory" - Check if SteamAPIs.com is working - Verify your API key is correct - Check backend logs for detailed error ### No Items in Inventory **If your real inventory is empty:** 1. Switch game (CS2 ↔ Rust) 2. Or use a test Steam account with items --- ## ✅ What Should Work Now ### Market Page - [x] Loads items from database - [x] Shows game, price, rarity, wear - [x] Filtering by game, rarity, wear, price - [x] Search functionality - [x] Sorting (price, name, date) - [x] Pagination - [x] Click to view item details ### Sell Page - [x] Fetches real Steam inventory - [x] Shows CS2 and Rust items - [x] Automatic price calculation - [x] Item selection system - [x] Game filter (CS2/Rust) - [x] Search items - [x] Sort by price/name - [x] Pagination - [x] Trade URL validation - [x] Sell confirmation modal - [x] Balance updates after sale - [x] WebSocket notifications --- ## 📝 Quick Test Script Run this to verify everything is working: ```bash # 1. Check if backend is running curl http://localhost:3000/api/health # 2. Check if market items endpoint works curl http://localhost:3000/api/market/items # 3. Check Steam inventory endpoint (need to be logged in) # Open browser console on http://localhost:5173 after login: fetch('/api/inventory/steam?game=cs2', { credentials: 'include' }).then(r => r.json()).then(console.log) ``` --- ## 🎯 Expected Results ### Market Page ``` ✅ Loads in < 2 seconds ✅ Shows items with images ✅ Filters work instantly ✅ Pagination works ``` ### Sell Page ``` ✅ Loads inventory in 3-5 seconds ✅ Shows item images and prices ✅ Can select multiple items ✅ Shows total value ✅ Selling updates balance ✅ Items disappear after sale ``` --- ## 🔧 Configuration Check Run this checklist: - [ ] `.env` has `STEAM_API_KEY` - [ ] Backend running on port 3000 - [ ] Frontend running on port 5173 - [ ] MongoDB is running - [ ] Logged in via Steam - [ ] Steam inventory is public - [ ] Have items in CS2 or Rust inventory --- ## 📞 Still Having Issues? ### Check Backend Logs Look for these messages: ```bash ✅ All plugins registered ✅ All routes registered ✅ Server running on http://localhost:3000 ``` ### Check Browser Console Press F12 → Console tab Look for: - API errors (red text) - Network requests (Network tab) - Cookie issues ### Verify API Calls Network tab should show: ``` GET /api/market/items → 200 OK GET /api/inventory/steam?game=cs2 → 200 OK POST /api/inventory/price → 200 OK POST /api/inventory/sell → 200 OK ``` --- ## 🎉 Success Indicators You'll know it's working when: 1. **Market page:** - Shows items immediately - No infinite loading - Items have images and prices 2. **Sell page:** - Loads your inventory - Shows estimated prices - Can select items - Selling updates balance --- ## 📚 More Info - Full setup: `STEAM_API_SETUP.md` - Detailed fixes: `MARKET_SELL_FIXES.md` - API docs: `API_ENDPOINTS.md` --- **Last Updated:** 2024 **Estimated Time:** 5-10 minutes **Difficulty:** Easy ⭐