A retro-styled browser trading game inspired by the Drug Wars gameplay loop.
Players move between real U.S. city markets, buy/sell illegal cat breeds, manage heat risk, and survive escalating debt pressure.
main.ts)Honohttps://esm.town/v/std/sqlite/main.tsblob (avatar path still supports blob keys, UI uses pixel presets)main.ts: HTTP routes, DB bootstrap/migrations, rendering, game actions, and admin dashboard/APIauth.ts: session cookie parsing, session token lifecycle, authenticated user lookupconfig.ts: static game config (markets, breeds, pixel avatar metadata)rules.ts: pure game logic helpers (borrow terms and heat streak cap)rules_test.ts: script-based regression tests for rules.tsday by 1.Sphynx, Bengal) produce the largest swings.Seattle, Austin) help reduce bust frequency while hunting good exits.debt_due_day).Account identity, role (player/admin/super_admin), and avatar key.
Cookie-token sessions with expiry.
Current market, cash, debt, heat, day, cargo, debt due day, borrow tier, and heat max streak.
City list and enforcement risk profile.
Base economy metadata for each cat breed.
Owned quantity per breed per user.
Shared daily per-market prices across all users (multiplayer-ready market tape).
Deprecated table kept only for migration compatibility. Active writes no longer target this table.
Tracks one-way migration IDs that have been applied.
POST /api/registerPOST /api/loginPOST /api/logoutGET /api/meGET /admin (dashboard UI; admin-only)GET /api/admin/overviewGET /api/admin/marketsPOST /api/admin/markets/:marketIdGET /api/admin/breedsPOST /api/admin/breeds/:breedIdPOST /api/buyPOST /api/sellPOST /api/travelPOST /api/borrowPOST /api/pay-debtPOST /api/avatar/presetGET /api/pixel-avatar/:avatarIdGET /api/avatar/:userIdinitDb() creates base tables and then runs idempotent tracked migrations:
2026-03-02-add-player_state-debt_due_day2026-03-02-add-player_state-borrow_count2026-03-02-add-player_state-heat_max_streak2026-03-02-backfill-debt_due_day2026-03-02-add-users-role2026-03-02-backfill-super-admin-first-user2026-03-02-create-market-day-prices2026-03-02-backfill-market-day-prices-from-user-market-prices2026-03-02-clear-user-market-prices-legacyApplied migrations are recorded in schema_migrations.
Run the script file directly in Val Town:
rules_test.tsIt validates:
day + market for all users.MARKET_PRICE_RETENTION_DAYS (currently 45) relative to the active max player day.travel, borrow, pay-debt, buy, sell) centralize write coordination and use sqlite.batch for multi-write updates where possible.pchinjr/cat-warsauth.tsconfig.tsrules.tsrules_test.ts/api/travel, /api/borrow, bankruptcy reset).