Tech Stack & Dev Notes

The nuts and bolts of what makes TW 3002 AI tick — and how it was built.


Architecture

TW 3002 AI has three deploy targets, all hosted on Cloudflare and auto-deployed on every push to main:

LayerStackURL
APICloudflare Worker (TypeScript) + D1 (SQLite)api.tw3002.net
Game ClientVue 3 SPA + Pinia + Tailwind CSSplay.tw3002.net
Marketing & DocsAstro static site (what you’re reading now)tw3002.net

The API handles all game logic — trading, combat, warp routing, PvP encounters, NPC ticks, auth, and Stripe payments. The game client is a single-page app that talks to the API via fetch(). The marketing site is pure static Astro, hosting these guides, the changelog, and the API reference.

Development tooling: Bun runs the seed scripts that generate the galaxy and NPC data, Wrangler manages D1 migrations and remote queries, and Vite powers the game client dev server.

Everything here runs within Cloudflare’s free tier — Workers, D1, Pages, and Workers AI all have generous limits that keep operational costs at zero (at least until the player base grows). The only real expense is the coding subscriptions used to build it, which I already carry for other projects and side work.


Database

All game state lives in Cloudflare D1, a serverless SQLite database distributed to Cloudflare’s edge network.

Key tables:

TableWhat It Holds
sectorsAll 1,000 sectors: ports, trade inventories, warp connections, planet data, danger levels
playersEmail-based auth with opaque Bearer tokens
player_shipsEvery active ship: stats, credits, cargo, fighters, mines, upgrades, kills/deaths, alignment, XP
npcs150 AI-driven NPCs with factions, personas, ships, and memory
planetsPlayer-owned planets: colonists, citadels, production rates
pvp_killsAll player-vs-player combat records
newsGalaxy event log and sector headlines

D1 was chosen over traditional databases because it colocates data with the Worker runtime — queries run at the edge with sub-millisecond latency.


Integrated Services

ServiceWhat It Does
Cloudflare Workers AIPowers NPC decision-making (96 ticks/day) and the daily galaxy summary narrative
ResendTransactional email: account verification codes, admin digest, re-engagement campaigns
StripePaid features: fighter fleet naming ($2 one-time), with plumbing for future products
DiscordCommunity server + webhook notifications for player deaths, bounties, and admin alerts
TurnstileCloudflare’s privacy-respecting CAPTCHA on registration and verification

NPC AI System

Every 15 minutes, the server ticks all 150 NPCs. Each one evaluates its situation and takes an action — move, trade, hunt, or idle. This runs ~96 times per day, making the galaxy feel alive regardless of player activity.

The LLM layer (Cloudflare Workers AI running @cf/zai-org/glm-4.7-flash) is used only for Raider-type NPCs — the hostile ones. It receives a small snapshot (faction, danger level, port presence, warp exits) and picks one action word. Traders and patrols use a fixed probability matrix instead.

What the LLM doesn’t do: It can’t see players, fighters, mines, or cargo. It doesn’t choose routes or targets. All tactical decisions — movement destinations, combat resolution, commodity selection — are handled by deterministic server code. The LLM is a seasoning, not the chef.

A daily summary at 8 AM UTC feeds 24 hours of player activity through a larger model to generate a short in-universe narrative paragraph for the game admin.


Game Client

The game interface is a Vue 3 SPA with a terminal-inspired design system. Key choices:

  • Pinia for state management — stores handle both reactive UI state and API communication with the Worker.
  • Tailwind CSS with a custom palette: terminal-cyan, terminal-green, terminal-red, terminal-yellow, and deep void backgrounds.
  • JetBrains Mono for all code/terminal text, Inter for headings.
  • Vue Composition API with <script setup> throughout.
  • Teleported modals — every overlay (combat, trade, PvP, planets, settings) renders into <Teleport to="body"> so only one is visible at a time.
  • Keyboard-first — every major action has a shortcut. Mouse is optional.

AI-Driven Development

TW 3002 AI was built with heavy use of AI coding agents — and this page exists to be transparent about that.

The short version

Yes, AI did all the coding. The planning, design decisions, game mechanics, and direction were human. The execution was AI-driven.

More about me and my workflow

My name is Aaron Prill and I’ve been a software engineer for 25 years. Since late 2025, when coding agents reached a tipping point, my daily workflow involves writing very few lines of code by hand.

For TW 3002 AI, I primarily used the Pi coding agent (pi.dev) with open-weight models via an OpenCodeGo or ChatGPT/Codex subscription. Claude models from Anthropic are excellent but too expensive for a side project at the scale of agentic development work — models that generate and iterate on hundreds of lines at a time rack up tokens quickly. (My employer-provided Claude Max plan stays on my work laptop where it belongs.)

How agentic development works in practice

Rather than writing code, the workflow shifts to:

  1. Describing what needs to exist — in plain language, with constraints and design rules
  2. Providing project context — AGENTS.md files (like the ones in the repo) that teach the agent about architecture, conventions, and gotchas
  3. Reviewing the output — reading every line the agent produces, asking for corrections where needed
  4. Iterating — tightening the specification until the implementation matches the intent

The agent handles the typing, the boilerplate, the refactoring, the bug fixes. The human handles the vision, the game design, the product decisions, and the final accountability for what ships.

This is similar to how a senior engineer works with a team — they don’t write every line of code themselves. They set direction, review pull requests, and ensure quality. The agent just happens to be an LLM instead of a junior developer.

Why be open about this?

Because it’s the reality of software in 2026, and pretending otherwise does a disservice to everyone — especially new developers wondering how to get started. If you use AI to build something, own it. The work is in the ideas, the design, the persistence, and the taste to know what’s worth building. The code is just the final artifact.


Open Source?

Not yet. The repo is private while the game is in active development. If there’s interest down the road, some components (like the shared game engine or the client design system) could be extracted and open-sourced.


Resources