A best-in-class TypeScript boilerplate for shipping high-quality 2D HTML5 games — built on PixiJS, Rapier physics, Howler audio, and tween.js — so you can build at the speed of thought with AI, ship a polished game, and rank #1 on Google.
⚡ Demo: 2d-game-base.gallop.software
☁️ Cloudflare Demo: 2d-game-base-cloudflare.gallop.software
🎨 Template: gallop.software/templates
📦 Repository: github.com/gallop-software/2d-game-base
🏷️ Category: 2D Game Boilerplate
Just chat with AI inside our Gallop AI Editor using Gallop templates, and you will never want to wrestle with a 3D engine, a heavyweight game framework, or a bloated visual editor again. Simply describe the game you want, and AI writes the code. No Unity, no GameMaker, no level editors, and no design limitations. Just type and watch. Build fun and crisp gameplay, add smooth physics-driven animations, configure your SEO and AI discoverability instantly, expand endlessly, and get prompting tips from our Gallop community. Go live in minutes.
core/, scenes/, systems/, objects/, ui/ separationVideoGame schemastrict: trueNew to this? No problem. You'll have AI guiding you the entire way.
The Gallop AI Editor is a desktop app built specifically for AI-powered web development. It includes everything you need — code editor, AI assistant, Git, terminal, media manager, font manager, SEO & structured data scanner, and a gallery of open-source templates — all in one window with nothing to configure.
It was purpose-built for this workflow, whether you're a complete beginner or an advanced game developer who wants AI-assisted iteration:
| What you get | |
|---|---|
| Best for | Non-programmers, junior programmers, advanced programmers |
| AI built in | Claude ready to go — use Gallop AI with no setup, your Claude Max or Pro plan, or your own API key |
| Template gallery | Built in, and every template is free and open source |
| Media manager | Built-in Studio with CDN sync — sprites, audio, and tilemaps |
| Font manager | Built-in Studio with WOFF2 font generation |
| SEO Audit | Analyze SEO & Structured Data |
| Git | Git UI with modal diff viewer |
| Node.js | Built-in installer and version manager |
| Deployment | Connect Cloudflare or Vercel, then let AI deploy for you |
Available for Mac and Windows.
Open the New Project modal. It has three tabs — Gallop Templates, Git Repositories, and Local — and you want the first one.
The editor then does everything else in one pass:
Because the repository is created here, your GitHub repo already exists by the time you reach Put Your Game Online — there's nothing to set up on GitHub when it's time to deploy.
Why this is one click: you're already signed in to GitHub inside the editor, so it can create the repository on your behalf without asking you for anything.
Click the play icon in the left rail (or press Cmd+1) to open the Start Website view. It's a terminal with a toolbar across the top — two clicks and your game is running locally.
Here's the full toolbar, and the command each button saves you from typing:
| Button | What it does | Equivalent command |
|---|---|---|
| Install / Reinstall | Downloads the project's dependencies. Reads Reinstall once they're already installed. | npm install |
| Start Website | Starts the Vite dev server with hot reload — save a file and the browser updates itself. | npm run dev |
| Stop | Shuts the server down and frees up the port. Replaces Start Website while the game is running. | Ctrl+C |
| Refresh Cache | Clears the build cache and restarts the server. Only appears while running. | delete .vite, restart |
| Clear | Wipes the terminal output. Doesn't touch the server. | clear |
The play icon in the left rail turns green with a dot while your game is running, so you can tell at a glance from any view.
Leave the server running while you work. You only need Start Website once per session — the page refreshes on its own every time you or the AI saves a file.
If something looks stuck — a change won't appear, or the canvas won't load — try Refresh Cache first, and Stop then Start Website if that doesn't do it.
Press Cmd+J to show the AI panel on the right. Click the + in its header and you'll get a picker with three cards:
| Card | What it is |
|---|---|
| AI Chat | Gallop's own chat interface — message bubbles, plan mode, and the target for screenshots you insert. Start here. |
| Claude Code | Claude Code itself, running as a terminal inside the panel. |
| Terminal | A plain shell, for when you want to run something yourself. |
Both AI options are Claude Code. Gallop's AI Chat runs Claude Code under the hood and puts a friendlier interface on top of it; the Claude Code card gives you the same engine as its normal terminal interface. Same capabilities, same access to your project — pick whichever you find easier to read.
You can run both at once in separate tabs — they're independent sessions.
Pick AI Chat, then just ask:
I'm new to this. Help me turn this template into my own 2D game.
The AI assistant can read and edit your project files, run commands, and explain anything you're confused about. Just describe what you want in plain English:
Replace the placeholder with a side-scrolling platformer
Add jump physics with a double-jump unlock
Make the player sprite a pixel-art knight
Wire up a game-over screen with a high-score table
Tip: Press Cmd+Shift+S to take a screenshot of your running game and attach it to the chat. The AI can see exactly what you see and suggest changes visually.
Everything below is how you actually build your game day to day. The left rail switches between views; each has a keyboard shortcut.
| Icon | View | Shortcut | What it's for |
|---|---|---|---|
| ▶ | Start Website | Cmd+1 | Run your game locally. Install, Start, Stop, Refresh Cache — see Step 3. Turns green while running. |
| ⑂ | Source Control | Cmd+2 | Commit, branch, and merge visually. The badge shows how many files changed. |
<> | Editor | Cmd+3 | The code editor, with autocomplete and go-to-definition. Cmd+B toggles the file explorer. |
| 🖼 | Studio | Cmd+4 | Your sprites, audio, and fonts — see below. |
| 🌐 | SEO | Cmd+5 | Scan your page for SEO and structured-data problems. |
| 🚀 | Publish | Cmd+6 | Connect Cloudflare and Vercel so AI can deploy for you. |
Cmd+K cycles forward through views if you'd rather not remember numbers.
The AI panel lives on the right and is where most of your work happens.
Cmd+J shows and hides it. Hiding does not stop what's running — a long AI task keeps going while the panel is closed.Cmd+I expands it to fill the window, for when you're reading a long answer.Cmd+T opens a new tab; Cmd+Shift+[ and Cmd+Shift+] cycle between them. You can drag tabs to reorder them.×. Close the last one and you're back at the AI Chat / Claude Code / Terminal picker.Agent mode vs Plan mode — on an AI Chat tab, press Cmd+. to switch between them. (Claude Code tabs have their own mode controls, so Cmd+. doesn't apply there.)
| Mode | Behavior | Use it when |
|---|---|---|
| Agent | AI edits your files directly. | You trust the change — most of the time. |
| Plan | AI describes what it intends to do and waits for approval. | The change is large or you want to learn what it does. |
Two AI Chat slash commands are worth knowing: /new starts a fresh conversation, and /compact summarizes a long one so you can keep going without losing the thread.
How you pay for AI is set in the panel's settings gear. There are three options, and none of them require you to have an API key:
| Option | What it uses | Good for |
|---|---|---|
| Gallop AI | Our proxy, billed from a prepaid balance | Getting started — nothing to sign up for or configure |
| Subscription | Your existing Claude Max or Pro plan | You already pay Anthropic monthly and want to use that |
| Your API Key | Your own Anthropic API key | You'd rather be billed by Anthropic per request |
Sessions pick up this setting when they start, so change it before opening a chat tab.
Describing a visual bug in a game is hard — a sprite that jitters, a hitbox that feels off, a camera that lags behind. Show it instead.
Cmd+Shift+S — drag a box around any part of your running game. The capture opens in an annotator where you can draw arrows and boxes, then Insert it straight into a chat tab.Cmd+Shift+L — drops the file you're editing into the chat as a reference, so you can say "the jump feels floaty here" without explaining where "here" is.Cmd+4 opens Studio, which manages everything in your public/ folder — including public/assets/sprites/, public/assets/audio/, and public/assets/tilemaps/.
Studio keeps its records in _data/_studio.json. That file is generated — let Studio manage it.
Canvas games are invisible to crawlers by default, so the HTML shell around your game does all the SEO work. Cmd+5 opens the SEO view to check it. You run a report yourself — the AI can't trigger one for you:
http://localhost:5173)| Report | What it tells you |
|---|---|
| Analyze On-Page SEO | Titles and descriptions, each rated from "Missing" through "Too long" so you can see what to tighten |
| HTML vs DOM | What search engines receive versus what loads in the browser — the critical check for a canvas game |
| Analyze Structured Data | Whether the JSON-LD VideoGame block that search engines and AI assistants read is valid |
Each report opens in its own tab, so you can check several pages side by side.
Once you have the results, hand them to AI: screenshot the report with Cmd+Shift+S and insert it into a chat, or paste the details in. Then ask for what you want:
Here's the SEO report for my game page. Fix everything it flags.
Cmd+2 gives you Git without the command line — stage individual lines, review diffs side by side, and browse history. If you'd rather not think about Git at all, don't: ask AI to "commit my changes and push them."
| Shortcut | Action |
|---|---|
Cmd+1–Cmd+6 | Switch views |
Cmd+K | Cycle views forward |
Cmd+J | Show/hide the AI panel |
Cmd+I | Expand/collapse the AI panel |
Cmd+. | Toggle agent ↔ plan mode |
Cmd+T | New tab |
Cmd+W | Close tab |
Cmd+Shift+[ / ] | Cycle tabs |
Cmd+B | Toggle file explorer |
Cmd+P | Quick Open — jump to any file |
Cmd+F | Find |
Cmd+Shift+F | Find in all files |
Cmd+S | Save |
Cmd+Shift+S | Screenshot |
Cmd+Shift+L | Send the current file to chat |
Cmd+Shift+N | New window |
On Windows, use Ctrl wherever this says Cmd.
Connect with other Gallop users on Discord or Slack. Share your progress, swap AI prompting tips, and see what indie devs are shipping with the help of AI.
Your code is already on GitHub — you're signed in inside the editor, and your repository was created when you started the project. All that's left is a hosting account: either Cloudflare or Vercel. Check their current plans before you pick — pricing and what each tier allows change over time.
Either way you're shipping a static build. npm run build produces a dist/ folder of HTML, JavaScript, and assets with no server behind it, which is why deployment here is simpler than for a server-rendered site: there are no environment variables to push and no secrets to manage.
Press Cmd+6 (the rocket icon) to open the Publish view. It has a tab for each service you might need:
| Tab | What it's for |
|---|---|
| Cloudflare | Deploy to Cloudflare Workers |
| Vercel | Deploy to Vercel |
Each tab links straight to the page where you generate the token, with the right permissions preselected — you paste it in, click Connect to verify it, then Save.
From then on the editor injects those credentials into your terminal and AI chat automatically, so the assistant can deploy on your behalf and you never paste a token into a project file.
Important: credentials are handed to a session when it starts. After saving a new token, open a new chat or terminal tab — an existing one won't see it.
Then just ask:
Push my latest changes to GitHub and deploy this game
The AI will walk you through every step. When you're done, your game will be live with a URL you can share.
Already know which host you want? Use the ready-made prompt for Cloudflare or Vercel.
2D Game Base ships Cloudflare-ready — the build output is served as static assets straight from Cloudflare's edge.
Step 1 — Connect Cloudflare in the Publish view (Cmd+6). Once saved, the editor puts your Cloudflare credentials (CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID) into the terminal environment and makes them available to the AI chat. Wrangler reads those variables automatically, which means nobody has to run npx wrangler login, and no token is ever pasted into a file.
Step 2 — Paste this prompt into the AI chat:
Deploy this game to Cloudflare Workers. My Cloudflare account is alreadyconnected, so CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are in theterminal environment — do not run `wrangler login`.Please:1. Push my latest changes to GitHub2. Run `npm run cf:deploy` to build and create the Worker3. Tell me the live URL when it's done
That's the entire first deploy — there's nothing to fill in, because a static game has no secrets. It takes a couple of minutes.
Step 3 — Follow-up prompts for anything after the first deploy:
Deploy my latest changes to Cloudflare
Rename my Cloudflare Worker to my-game and redeploy
My game loads on Cloudflare but the audio 404s — check the asset paths
If a prompt fails, paste the error back into the chat. The most common cause is a Cloudflare account that isn't connected yet, so wrangler has no credentials — the AI can diagnose that from the error text.
Everything below is reference material for your AI assistant — what files Cloudflare needs, which ones get generated, and what has to change when you rename things. You don't need to read or run any of it yourself; the prompts above cover the whole process. It's here so the AI has accurate ground truth, and so you have something to point at if a deploy goes wrong.
If you forked or generated this repo, every config file already exists — you do not create any of them.
1. Config files — already in the repo, keep them
| File | What it does for Cloudflare |
|---|---|
wrangler.jsonc | The Worker manifest. Names the Worker and points at dist/. There is no main entry — this is an assets-only Worker, so no server-side code runs. |
public/_headers | Cache-control rules that ship inside the build. Vite's fingerprinted bundles get immutable caching; the plain-named game assets revalidate instead. |
package.json | Holds the cf:* scripts plus wrangler as a devDependency. |
2. Build output — generated, never committed
| Path | Created by |
|---|---|
dist/ | npm run build — the static site wrangler.jsonc points at |
.wrangler/ | Wrangler's local state and cache |
Both are already gitignored. dist/ does not exist until you build, which is why cf:deploy and cf:preview always run the build first.
This is what the AI runs on your behalf:
npm run cf:deploy # build + deploy — creates the Worker on first run
No wrangler login step is needed: connecting Cloudflare in the editor already put CLOUDFLARE_API_TOKEN in the environment, and wrangler picks it up automatically. If your account can't be inferred from the token, also set CLOUDFLARE_ACCOUNT_ID. Wrangler ships as a dev dependency, so npx runs the local copy — no global install needed.
Names must match. The name in wrangler.jsonc must equal the Worker's actual name in your Cloudflare dashboard. If a Git-connected deploy created it under a different name, update wrangler.jsonc to match.
wrangler.jsonc ships with the Worker named 2d-game-base. Change the single name field to rename it — nothing else in the repo references it:
{"name": "your-game-name" // ← the Worker name}
If you connect the repo in the Cloudflare dashboard instead of deploying from your machine:
npm run buildnpx wrangler deployCustom domains live under the Worker's Settings → Domains & Routes.
not_found_handling is set to single-page-application, so any URL that doesn't match a file returns index.html instead of a 404. That's what you want for a canvas game with client-side screens, but it does mean a mistyped path loads the game rather than erroring.
| Command | What it does |
|---|---|
npm run cf:build | Type-check and build the static site into dist/ |
npm run cf:preview | Build, then run the real Workers runtime locally |
npm run cf:deploy | Build and deploy to Cloudflare |
npm run cf:upload | Build and upload a new Worker version without making it live (staged rollouts) |
Connect your Vercel account in the Gallop AI Editor, then paste this into the AI chat:
Deploy this game to Vercel. My Vercel account is already connected.Please:1. Push my latest changes to GitHub2. Link this project to Vercel and deploy it to production3. Tell me the live URL when it's done
Vercel detects Vite automatically — build command npm run build, output directory dist. It redeploys every time you push, so from here on your changes go live by asking the AI to push them.
Congratulations! Your game is now live to the world. Share your new URL and start growing your audience. Ready for a custom domain? See Vercel's domain setup guide.
2D Game Base is part of the Gallop template ecosystem. Gallop templates are designed to be built with AI — just describe what you want in plain English and watch your project come to life.
The Gallop AI Editor is a desktop code editor built specifically for AI-powered development. It combines a full code editor, Claude AI assistant, visual Git interface, integrated terminal, media manager, and template gallery into one app. Everything is preconfigured to work with Gallop templates out of the box — no extensions, no plugins, no setup.
Key highlights:
Cmd+Shift+S to screenshot your running game and share it with AI for visual feedbackThis template was crafted from the ground up to get your game ranked #1 on Google and recommended by AI assistants like ChatGPT and Google's Gemini. Canvas-rendered games are invisible to crawlers by default, so the HTML shell ships with semantic landmarks, complete metadata, Open Graph, Twitter cards, and a JSON-LD VideoGame schema block that search engines and AI models actually parse.
AI mentions are becoming more important than traditional SEO. When someone asks an AI assistant for "fun browser games like X," you want yours in that answer. Gallop templates are built with the structured data and semantic markup that AI models rely on to understand and recommend your work.
The team behind Gallop has decades of combined experience building websites, apps, and web applications for top global brands. We've helped projects achieve #1 Google rankings in competitive markets and understand what it takes to ship something polished. That expertise is baked into every template, every component and every line of code.
2d-game-base/├── src/│ ├── main.ts # Async bootstrap: creates Game, switches to PreloadScene│ ├── constants.ts # COLORS, ASSETS, gameplay tunables│ ├── types.ts # Shared scene-data interfaces│ ├── core/ # Engine glue│ │ ├── Game.ts # PIXI app + systems + scene manager + frame loop│ │ ├── Scene.ts # Abstract base extending PIXI.Container│ │ └── SceneManager.ts # Active-scene management with safe transitions│ ├── systems/ # Reusable subsystems│ │ ├── InputManager.ts # Keyboard + pointer + onPress() helpers│ │ ├── AudioManager.ts # Howler wrapper│ │ ├── PhysicsWorld.ts # Rapier wrapper: bodies, sensors, collision events│ │ └── AssetManager.ts # PIXI.Assets wrapper│ ├── scenes/ # Game flow│ │ ├── PreloadScene.ts # Loads assets, shows progress, hands off to Menu│ │ ├── MenuScene.ts # Title + Start button│ │ ├── GameScene.ts # Placeholder mini-game (REPLACE THIS)│ │ └── GameOverScene.ts # End screen + restart│ ├── objects/ # Per-entity classes (Pixi display + Rapier body)│ │ ├── Player.ts│ │ └── Coin.ts│ ├── ui/ # Persistent UI overlays│ │ └── HUD.ts│ └── utils/ # Shared helpers│ └── math.ts # clamp, lerp, randRange, randInt├── public/│ ├── screenshot.jpg # Featured image for OG / template gallery│ ├── images/ # Responsive screenshot variants│ ├── favicon.svg # Vector favicon│ ├── manifest.webmanifest # PWA manifest│ ├── robots.txt # Crawler directives│ ├── sitemap.xml # Sitemap (single URL by default)│ ├── _headers # Cloudflare cache-control rules│ └── assets/ # Game assets│ ├── sprites/ # Drop sprite sheets here│ ├── audio/ # Audio files (e.g. pickup.wav)│ └── tilemaps/ # Tilemap JSON / images├── _data/│ └── _studio.json # Studio media metadata├── index.html # SEO-rich HTML shell + JSON-LD VideoGame schema├── vite.config.ts # Vite + vite-plugin-pwa configuration├── wrangler.jsonc # Cloudflare Workers config (assets-only)├── tsconfig.json # TypeScript config (strict: true)├── .eslintrc.cjs├── .prettierrc.json├── package.json└── README.md
npm run dev — Start development server at http://localhost:5173 with hot reloadnpm run build — Type-check, then bundle to dist/ for productionnpm run preview — Serve the production build locally for testingnpm run typecheck — TypeScript type checking without emittingnpm run lint — Run ESLint on all source filesnpm run format — Format all source files with Prettiernpm run cf:build — Type-check and build the static site into dist/npm run cf:preview — Build, then serve it with the real Workers runtime locallynpm run cf:deploy — Build and deploy to Cloudflare Workersnpm run cf:upload — Build and upload a new version without making it liveEvery dependency is battle-tested in production and chosen for stability, performance, and long-term maintainability.
8.5.1 — WebGL/WebGPU 2D renderer with native high-DPI support0.14.0 — Rust → WASM physics engine (@dimforge/rapier2d-compat)2.2.4 — Web Audio with HTML5 fallback, sprite slicing, master volume/mute25.0.0 — Lightweight animation library (@tweenjs/tween.js)Tools for building, developing, and shipping the game:
5.4 — Dev server and bundler with instant HMR0.20.1 — Service worker + manifest generation5.5 — Type safety and IntelliSense (strict: true)8.57 — Code linting (with @typescript-eslint)3.3 — Code formatting4.x — Cloudflare Workers CLI for local preview and deployment2.2.11 — TypeScript types for HowlerMIT License — see LICENSE for details
Contributors:
Built with ❤️ by the team at Gallop