MewBattle is a cat-themed turn-based card RPG built with Next.js 16, React 19, and Firebase.
Players collect cat cards, build decks, open boosters, and fight a boss through a web-first battle flow with persistent account data and shared cloud state.
- turn-based cat card battle loop against a boss
- card collection and owned-card progression
- deck building and deck editing flow
- booster opening flow with Firestore-backed inventory updates
- Firebase Auth with guest mode and authenticated persistence
- Firestore sync for cards, decks, battles, and user state
- PWA shell with service worker registration and version metadata
- isolated legacy darts modules kept outside the active MewBattle runtime
- Next.js 16 App Router
- React 19
- TypeScript
- Firebase Auth
- Firestore
- Tailwind CSS
- Radix UI / shadcn-style primitives
- Vitest
npm install— install dependenciesnpm run dev— start the development servernpm run build— build the production bundlenpm run build:sync-version— sync version metadata and buildnpm run start— start the production servernpm run lint— run ESLintnpm run test— run unit tests with Vitestnpm run migrate:cards— run the card-field migration scriptnpm run migrate:cards:dry— dry-run the card-field migration
cd /Users/valeryazartsov/mewbattlenpm installnpm run dev- Open
http://localhost:3000
Create .env.local with:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_APP_ID
Optional:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
app/layout.tsx— providers, metadata, and service worker registrationapp/page.tsx— main app shell with auth flow and top-level tabslib/auth-context.tsx— Firebase auth state, guest mode, and auth actionslib/mew-firestore.ts— Firestore layer for cards, decks, battles, and boosterslib/mew-engine.ts— battle turn resolution and ability behaviorlib/mew-types.ts— domain types for cards, decks, battles, and logscomponents/mew/card-collection.tsx— owned-card overviewcomponents/mew/deck-builder.tsx— deck assembly UIcomponents/mew/booster-shop.tsx— booster opening flowcomponents/mew/battle-arena.tsx— active battle loop
Current test coverage includes:
lib/mew-engine.test.tslegacy/darts/lib/game-engine.test.tslegacy/darts/lib/game-firestore.test.ts
Run all tests with npm run test.
- Build version is stored in
lib/version.tsand updated byscripts/update-version.js. - PWA metadata is configured in
public/manifest.json. - If Firestore data contracts change, update both the TypeScript types and tests.
- Backup XML parsing in
lib/game-firestore.tsxaccepts both legacy and current backup root tags for compatibility. - Legacy darts scoring code stays isolated under
legacy/darts/*and is not part of the active MewBattle runtime.