10 KiB
Admin Panel Documentation
Overview
The TurboTrades admin panel provides comprehensive tools for managing the marketplace, tracking financials, monitoring transactions, and overriding item prices. This panel is only accessible to users with admin privileges (staffLevel >= 3).
Access Control
Granting Admin Access
Use the make-admin.js script to grant admin privileges:
node make-admin.js
This sets your Steam ID (76561198027608071) to staffLevel 3.
Alternatively, set admin Steam IDs in the .env file:
ADMIN_STEAM_IDS=76561198027608071,76561198027608072
Features
1. Dashboard Tab
The dashboard provides a quick overview of your marketplace:
Quick Stats
- Total Users: Number of registered users
- Active Items: Currently listed items (with CS2/Rust breakdown)
- Transactions: Daily, weekly, and monthly transaction counts
- Total Fees: All-time fees collected from transactions
Recent Activity
- Last 10 completed transactions
- User information and transaction details
- Real-time transaction amounts
Top Sellers
- Users with the highest sales volume
- Total sales amount and item count per seller
2. Financial Tab
Comprehensive financial analytics and profit tracking:
Period Filters
- Today: Current day's transactions
- This Week: Last 7 days
- This Month: Last 30 days
- This Year: Last 365 days
- All Time: Complete financial history
Financial Metrics
Deposits
- Total amount deposited by users
- Number of deposit transactions
- Shows money coming into the platform
Withdrawals
- Total amount withdrawn by users
- Number of withdrawal transactions
- Shows money leaving the platform
Net Balance
- Calculated as:
Deposits - Withdrawals - Shows the platform's cash flow position
User Purchases
- Total value of items purchased by users
- Number of items bought
- Represents marketplace activity
Total Sales
- Value of all items sold through the marketplace
- Number of items sold
- Tracks marketplace volume
Fees Collected
- This is your revenue!
- Total fees collected from transactions
- Number of fee-generating transactions
- Fees are typically a percentage of each sale
Profit Tracking
- Gross Profit: Total fees collected (direct revenue)
- Net Profit: Gross profit minus (Withdrawals - Deposits)
- Provides clear view of platform profitability
3. Transactions Tab
View and filter all transactions in the system:
Filters
- Type: Filter by transaction type
- Deposit: User adds funds
- Withdrawal: User removes funds
- Purchase: User buys an item
- Sale: User sells an item
- Trade: Item exchange
- Bonus: Promotional credits
- Refund: Returned funds
- Status: Filter by transaction status
- Completed: Successfully processed
- Pending: Awaiting processing
- Failed: Transaction failed
- Cancelled: User cancelled
- Processing: Currently being processed
- User ID: Filter by specific user MongoDB ID
- Search: Real-time search with debouncing
Transaction Details
Each transaction shows:
- Date and time
- User information (avatar, username)
- Transaction type (color-coded badge)
- Status (color-coded badge)
- Amount (green for positive, red for negative)
- Fee collected
- User's balance after transaction
Pagination
- 50 transactions per page
- Navigate between pages
- Total transaction count displayed
4. Items Tab
Manage all marketplace items with price override capabilities:
Game Separation
- All Games: View items from both games
- CS2: Counter-Strike 2 items only
- Rust: Rust items only
Filters
- Status:
- Active: Currently listed
- Sold: Successfully sold items
- Removed: Delisted items
- Category: Filter by item type (rifles, pistols, knives, gloves, etc.)
- Search: Real-time item name search
- Sort By:
- Listed Date: When item was added
- Price: Listing price
- Market Price: Steam market price
- Views: Item popularity
Item Display
Each item shows:
- Item image
- Item name and details
- Game badge (CS2/Rust)
- Rarity badge (color-coded)
- Wear condition (for CS2 items)
- Phase (for Doppler/Gamma Doppler)
- Seller information
- View count
- Listing Price: Price set by seller
- Market Price: Current Steam market price
- Edit Prices button for overrides
Price Override System
Why Override Prices?
- Correct incorrect market data
- Adjust for special items (e.g., rare patterns)
- Manual pricing for items not on Steam market
- Promotional pricing
How to Override
- Click "Edit Prices" on any item
- Modal opens with current prices
- Modify:
- Listing Price: What buyers pay
- Market Price: Reference price from Steam
- Click "Save Changes"
- Item is marked with
priceOverride: true
Tracking Overrides
- Items with admin overrides are flagged in the database
priceOverridefield set totruepriceUpdatedAttimestamp updated- Original prices preserved in history
API Endpoints
Dashboard
GET /api/admin/dashboard
Returns comprehensive dashboard data.
Financial Overview
GET /api/admin/financial/overview?period=all
Parameters:
period: today, week, month, year, allstartDate: Custom start date (ISO format)endDate: Custom end date (ISO format)
Returns financial metrics and profit calculations.
Transactions
GET /api/admin/transactions?type=sale&status=completed&limit=50&skip=0
Parameters:
type: Transaction type filterstatus: Transaction status filteruserId: Filter by user IDlimit: Results per page (max 100)skip: Pagination offsetstartDate: Filter from dateendDate: Filter to date
Returns paginated transaction list.
Items
GET /api/admin/items/all?game=cs2&status=active&limit=100&skip=0
Parameters:
game: cs2, rust, or empty for allstatus: active, sold, removedcategory: Item categoryrarity: Item raritysearch: Search querysortBy: price, marketPrice, listedAt, viewssortOrder: asc, desclimit: Results per page (max 200)skip: Pagination offset
Returns paginated item list.
Update Item Price
PUT /api/admin/items/:id/price
Body:
{
"price": 99.99,
"marketPrice": 95.00
}
Sets custom prices and marks item as overridden.
Users
GET /api/admin/users?limit=50&skip=0
Parameters:
limit: Results per page (max 100)search: Username or Steam ID searchsortBy: balance, createdAtsortOrder: asc, desc
Returns user list with balances.
Understanding Profit
Revenue Streams
-
Transaction Fees
- Primary revenue source
- Configured percentage of each sale
- Stored in
transaction.feefield - Example: 5% fee on $100 sale = $5 revenue
-
Float (User Deposits)
- Users deposit money before purchasing
- Money held in user balances
- Not counted as profit until fees are collected
- Withdrawals reduce available float
Profit Calculation
Gross Profit = Sum of all transaction fees
Net Profit = Gross Profit - (Total Withdrawals - Total Deposits)
Example:
- Users deposited: $10,000
- Users withdrew: $6,000
- Fees collected: $500
Net Profit = $500 - ($6,000 - $10,000)
Net Profit = $500 - (-$4,000)
Net Profit = $4,500
This accounts for the float you're holding.
Important Notes
- Deposits increase available funds but aren't profit
- Withdrawals decrease available funds and impact net profit
- Fees are pure profit
- Net Profit shows true profitability after accounting for float
Best Practices
Price Overrides
- Document why you're overriding prices
- Check Steam market regularly for updates
- Use overrides sparingly for special cases
- Review overridden items periodically
Financial Monitoring
- Check financial tab daily
- Monitor deposit/withdrawal ratio
- Track fee collection rates
- Watch for unusual transaction patterns
Transaction Review
- Investigate failed transactions
- Monitor for refund patterns
- Check for suspicious activity
- Verify high-value transactions
Item Management
- Separate CS2 and Rust analytics
- Remove inactive listings
- Monitor market price discrepancies
- Track item popularity (views)
Security Considerations
Admin Access
- Limit admin access to trusted staff only
- Use staffLevel 3 or higher
- Consider IP whitelisting for production
- Enable 2FA for admin accounts
Price Overrides
- Log all price changes
- Track which admin made changes
- Implement approval workflow for large changes
- Set maximum override limits
Transaction Monitoring
- Alert on large transactions
- Flag unusual patterns
- Monitor for fraud
- Implement rate limiting
Troubleshooting
Can't Access Admin Panel
- Verify your staffLevel is >= 3
- Check ADMIN_STEAM_IDS in .env
- Clear cookies and re-login
- Check browser console for errors
Financial Data Looks Wrong
- Verify transaction status filters
- Check date range selection
- Ensure database indexes are built
- Run data consistency checks
Items Not Showing Prices
- Run price update from admin panel
- Check SteamAPIs.com API key
- Verify item names match market data
- Use price override for missing items
Slow Performance
- Reduce pagination limit
- Use specific filters instead of "All"
- Add database indexes
- Consider caching frequently accessed data
Future Enhancements
Planned Features
- Export financial reports (CSV/PDF)
- Charts and graphs for trends
- Email alerts for large transactions
- Bulk price override tools
- User ban/restriction management
- Automated fraud detection
- Revenue forecasting
- Inventory analytics
- A/B testing for fees
Integration Ideas
- Stripe for deposits/withdrawals
- PayPal integration
- Cryptocurrency payments
- Steam trading bot automation
- Discord notifications
- Slack integration for alerts
Support
For issues or questions:
- Check this documentation
- Review backend logs
- Check browser console
- Verify database state
- Contact development team
Last Updated: 2024 Version: 1.0.0 Requires: Admin access (staffLevel >= 3)