Project — 2026
Towerpower
A browser-based tower defense game with a campaign mode, a roguelite survival mode, and a Fastify API backing auth and persistent progression.
- TypeScript
- Phaser 3
- Vite
- Fastify
- Drizzle ORM
- SQLite
- Zod
- Vitest
- Playwright
- pnpm
- Turborepo
What it is
Towerpower is a browser-based tower defense game built around two distinct play modes. The campaign mode runs fixed-grid maps where the player deploys a squad of named operators to hold lanes against wave-based enemy spawns. Progress is server-authoritative for authenticated users — gold, unlocked operators, stars, and high scores are stored server-side, with client and server scores merged by best value. The roguelite mode is a self-contained survivor loop with player movement, auto-fire, XP drops, level-up card offers, run-focus mechanics, and local meta-progression tracked in localStorage.
Architecture
The project is structured as a pnpm monorepo with Turborepo. The @towerpower/web package is a Phaser 3 client built with Vite. The @towerpower/api package is a Fastify 5 server with SQLite persistence managed through Drizzle ORM. A @towerpower/shared package holds Zod schemas, level configs, and validation helpers used by both the client boot flow and the API’s run-completion validation — if the two drift, level completions are rejected at the boundary.
The API handles guest and full-account auth, Google OAuth linkage, rotating refresh tokens, a leaderboard, Campaign V2 squad and operator state, stage session tracking for anti-cheat checkpointing, and an admin interface. The Fastify server also serves the built web client in production.
Campaign design
The campaign layer (Campaign V2) uses authored grid maps with deterministic terrain contracts, operator deployment to typed ground and flying surfaces, and a structured operator taxonomy — six classes, six tactical roles, and a set of meta markers — inspired by Arknights-style roster design. Operator data is authored in JSON and validated through shared schemas at both boot time and API submission time.
Where it’s at
The test suite covers Vitest unit tests in both web and api packages, a Playwright E2E suite for full-flow coverage, and tooling scripts for content validation, art sync, determinism checks, and boundary enforcement. The project is live via a Cloudflare tunnel backed by a PM2-managed process and is actively in development toward a Chapter 1 beta slice.