A clean, minimal starter template for building 2D games with Phaser 3, powered by Vite and TypeScript.
Designed for fast prototyping, clear structure, and easy scalability - perfect for game jams, hobby projects, or learning game development. 🎮
- Lightning-fast dev server (Vite)
- Phaser 3 (v3.88+)
- Written in TS
- Modular folder structure
- Built-in asset preloading
- Clean, readable, and minimal codebase
$ git clone https://github.com/gkkconan/phaser-template.git$ cd phaser-template$ pnpm installor$ pnpm i$ pnpm run dev
Then open http://localhost:5173 in your browser.
src/
├── GameData.ts # Shared game constants/data
├── assets/ # Game assets
│ ├── images/ # ImageAsset
│ ├── tilemaps/ # TilemapAsset
│ ├── atlas/ # AtlasAsset
│ ├── spritesheets/ # SpritesheetsAsset
│ ├── sounds/ # SoundAsset
│ ├── videos/ # VideoAsset
│ ├── scripts/ # ScriptAsset
│ ├── fonts/ # FontAsset
│ └── bitmapfonts/ # FontAsset bitmap
├── game/
│ └── scenes/ # Game scenes
│ ├── Menu.ts # Displays Menu options
│ ├── Boot.ts # Loading complete text scene, leads to Menu
│ ├── GamePlay.ts # Main gameplay logic
│ └── Preloader.ts # Loads all assets
├── index.html # HTML entry point
├── index.ts # Game entry (initializes Phaser)
└── style.css # Main styles (optional)
Sample fonts and images are already included in assets/ for testing and layout.
⚠️ For performance and project size, it is recommended to download all fonts and place them insideassets/fonts/.
⚠️ The fileGameData.tscontains key variables and constants used throughout the template. You can add more according to your needs. To keep type safety, update the corresponding interface intypings/gameData.t.tswhen extending.
📝 Note: Not all folders listed above are present in the repository by default, as some are initially empty. However, the structure reflects the ideal organization for assets and game logic. You can create these directories as needed during development.
This project focuses on simplicity and clarity:
- No complex config or plugins
- Flat learning curve for Phaser + TS
- Easily extendable scene-based structure
- Ideal for prototypes, jams, and small projects
Feel free to fork this project, open issues, or suggest improvements.
Pull requests are welcome - especially if they keep the codebase clean and simple.
GPL-3.0 © gkkconan