# CaseForge CS-style case opening site with virtual credits, inventory, multiplayer item betting, shop, leaderboard, and an admin panel for cases / drops / rates. ## Stack - **Server**: Node.js, Express, Prisma, SQLite, express-session, Socket.IO - **Client**: React (Vite), React Router, Socket.IO client ## Setup ```bash npm run install:all npm run db:push npm run db:seed npm run dev ``` - App: http://localhost:5173 - API: http://localhost:3001 - LAN: http://\:5173 (Vite binds to `0.0.0.0`) Create `server/.env` if missing: ``` DATABASE_URL="file:./dev.db" PORT=3001 CLIENT_ORIGIN=http://localhost:5173 SESSION_SECRET=dev-secret STARTING_BALANCE=10000 STARTING_OSU=100 JACKPOT_ROUND_SECONDS=60 JACKPOT_MAX_ITEMS=3 ``` ## Demo accounts | Role | Username | Password | |-------|----------|------------| | Admin | `admin` | `admin123` | | Player| `player` | `player123`| New registrations receive **100.00** starting credits and **100 osu** (`STARTING_BALANCE` / `STARTING_OSU` in `server/.env`; credits stored in cents). ## Features - Login / register (username + password) - Inventory: sort by recent or value, multi-select and sell at market value - **Feed Drop**: toggle in nav — live left column of latest case unboxes + player - Cases page: browse and open crates (CS-style reel, result rolled server-side) - **Bet Item** hub: - **MultiPlayers Case** — live shared pot, up to 3 items, win chance by value, Socket.IO sync - **1vX Case** — custom rooms (player/item limits, min value), spectate in-progress - **Coinflip** — stub (coming soon) - **Shop**: spend osu on credit packs; watch an ad every 1 min for 100.00–200.00 cr - Profile (via username in the nav): avatar, bio, password, stats - Leaderboard: richest players (balance + inventory market value) - Admin: manage cases, items, images (URL or upload), drop weights, enable/disable cases ## Notes - Balances and prices are integers in **cents**; **osu** is a separate demo currency for the shop - Inventory items locked while deposited in a bet; unlocked or transferred on resolve - `Transaction` types include `open_case`, `seed_credit`, `seed_osu`, `sell_item`, `shop_purchase`, `ad_reward`, `jackpot_bet`, `jackpot_win`, `duel_bet`, `duel_win` - Avatars stored under `server/uploads/` and served at `/uploads` - Real-time state via Socket.IO (`jackpot`, `duel:{id}`, `duels` rooms) - Swap `DATABASE_URL` to PostgreSQL later without changing app logic