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
Project snapshot
- Status
- Live and actively developed toward a Chapter 1 beta slice.
- Modes
- Server-authoritative campaign progression plus a local roguelite survival loop.
- Backend
- Fastify API with Drizzle-managed SQLite, guest/full-account auth, Google OAuth, leaderboards, and stage sessions.
- Validation
- Shared Zod schemas validate level configs, boot flow, and run-completion submissions across client and server.
Technical proof
- Phaser 3 client and Fastify API live in a pnpm/Turborepo monorepo with shared contracts.
- Campaign V2 combines authored grid maps, terrain contracts, operator roles, and schema-validated JSON content.
- Test and tooling coverage includes Vitest, Playwright, content validation, art sync, determinism checks, and boundary enforcement.
In the app
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 actively developed toward a Chapter 1 beta slice.