A simple TypeScript + Vite boilerplate to create games with melonJS.
Built with:
- melonJS 2 β lightweight HTML5 game engine
- TypeScript β type-safe JavaScript
- Vite β fast dev server and bundler
- melonJS debug plugin β auto-loaded in development mode
Ensure you have Node.js installed, then install dependencies:
npm install
npm run devβ start the dev server atlocalhost:5173npm run buildβ generate a production build in thedistfoldernpm run previewβ preview the production build locally
If everything goes well, you should see this:
src/
βββ data/ # game assets
β βββ bgm/ # background music
β βββ fnt/ # bitmap fonts
β βββ img/ # images and spritesheets
β βββ map/ # Tiled map files
β βββ sfx/ # sound effects
βββ scripts/
β βββ renderables/ # game objects (player, enemies, etc.)
β βββ stage/ # game screens (title, play, etc.)
βββ index.ts # entry point
βββ index.css # base styles
βββ manifest.ts # asset list for the melonJS preloader
This boilerplate works with plain JavaScript too. Just rename .ts files to .js β TypeScript is optional, not required. Vite handles both seamlessly.
The boilerplate includes the melonJS debug plugin, which is automatically loaded in development mode.
The debug panel is hidden by default and can be toggled with the S key. See the plugin docs for details.
- Discord β chat with the community
- Forum β ask questions
- API Docs β full API reference
- Wiki β tutorials and guides
- Thank you @edmundg for the original TypeScript x Vite boilerplate

