LittleJS: a tiny HTML5 game engine with 2D, 3D and Box2D built in
Tiny fast HTML5 game engine with many features and no dependencies.
At a glance
- What is it?
- LittleJS is an MIT-licensed JavaScript game engine with no runtime dependencies, a WebGL2 and Canvas2D renderer, arcade physics, Box2D integration and a Three.js plugin. It suits small web games and size-coding entries.
- Who is it for?
- Adopt LittleJS for small browser games, jam entries and anything where the download size matters, and start from the Vite template rather than wiring the script tag by hand. Skip it if you expect a large third-party plugin market.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- KilledByAPixel/LittleJS4,411 ★ · +228
| Repository | 2026-09-23 | 2026-11-25 |
|---|---|---|
| KilledByAPixel/LittleJS | 4.2k | 4.4k |
228 Stars in the last 63 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What LittleJS is for, and who it is aimed at
LittleJS is a JavaScript game engine for the browser. The README describes it as "a fast, lightweight, and fully open source HTML5 game engine designed for simplicity and performance", and the package.json describes it as "Tiny and Fast HTML5 Game Engine". The stated feature set covers 2D and 3D rendering, physics, particles, sound and input handling, all in a package with no dependencies.
The audience is narrower than the feature list suggests. The README names size coding competitions directly, pointing at Js13kGames. It also lists TypeScript and module support with example projects for both, a Vite starter template, and an AI section with templates and prompts tuned for LLM-assisted workflows. So the project is aimed at people writing game code by hand, often in a single file, often against a byte budget.
That framing matters when you evaluate it. It presents itself as a library you write against, with functions like gameInit and gameRender as the entry points.
How the engine is put together: canvas, objects and plugins
The rendering layer is described in the README as a "WebGL2 + Canvas2D hybrid rendering system". The 3D renderer is described as one that "shares the canvas with your 2D game". That single shared surface is the central architectural decision.
3D objects are described as having "the same physics, children and timers as 2D". In other words, the 3D support is an extension of the existing object model rather than a separate scene graph. The README lists height map terrain with collision and raycasts, shadow maps, colored lights, specular, emissive glow, fog, and orbit, chase and first person cameras with mouse picking. There is also an optional Three.js plugin described as "an alternative renderer", which is a notable split: the built-in renderer is the default, and Three.js is a swap-in path for people who want it.
Physics comes in two layers. There is an arcade physics system with collision handling plus tilemap collision and raycasting, and separately "Full Box2D integration" using Box2D v2.3.1 compiled to wasm. Pathfinding is a plugin, described as grid-based A* with optional path smoothing. Audio supports mp3, ogg and wave files, and there is a ZzFX integration for generating sounds without asset files. The repository layout reflects the plugin model: top-level plugins/, src/, dist/, tools/ and test/ directories, with examples split into folders such as box2d, threejs and particles.
Installing LittleJS and getting a first game on screen
There are two documented starting points. The npm package is named littlejsengine, and the README gives a single install command for it. The package's main entry is dist/littlejs.esm.js, with a production export pointing at dist/littlejs.esm.min.js and types at dist/littlejs.d.ts.
npm install littlejsengineThe second path is the Vite starter, which the README presents as an empty template. It uses degit to copy the template directory, then installs and starts a dev server.
npx degit KilledByAPixel/LittleJS/examples/vite-starter my-game
cd my-game
npm install
npm run devIf you would rather not use a bundler at all, the README's minimal example is a plain HTML file that loads the engine from the installed package and defines the five engine callbacks. Note that gameRenderPost is where the hello world text is drawn, using drawTextScreen with mainCanvasSize scaled by .5 and a font size of 80.
<!DOCTYPE html>
<script src="node_modules/littlejsengine/dist/littlejs.js"></script>
<script>
function gameInit() {}
function gameUpdate() {}
function gameUpdatePost() {}
function gameRender() {}
function gameRenderPost() { drawTextScreen('Hello World!', mainCanvasSize.scale(.5), 80); }
engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost);
</script>What you should see is the text "Hello World!" centered on the canvas. The engine's own build script is npm run build, which runs node src/engineBuild.mjs, and the package requires Node 22.12.0 or newer according to its engines field. For learning the API, the repository points at a REFERENCE.md quick reference sheet, an FAQ.md, a Breakout tutorial directory, and a set of single-file demos under examples/shorts.
Where LittleJS gets awkward
The README lists a live example browser with a code editor, an effect design tool for particles, and built-in 2D and 3D level editors that edit your game while it runs, with undo, autosave and prefabs. 2D levels load and save as Tiled JSON, so Tiled can edit them too. Sprites and animations load into texture sheets at runtime, or come from TexturePacker and Aseprite atlases.
There is a second boundary worth naming. The README states the engine is compatible with "all modern web browsers and mobile devices", which is a browser target, not a native one. If your requirement is a shipped mobile app rather than a web page, this is the wrong layer to start from.
Picking between LittleJS and a full engine like Three.js
The most direct comparison in the README is the one the project makes itself: the optional Three.js plugin, described as "an alternative renderer". That framing is precise. Three.js is a rendering library, and LittleJS is a game engine that happens to include a renderer. If you adopt Three.js, you get a mature rendering layer and you assemble the rest yourself: the update loop, input, collision, audio, particles and object lifecycle are yours to write or to source elsewhere. If you adopt LittleJS, those systems arrive together and are designed to talk to each other, with 3D objects sharing physics, children and timers with 2D objects.
The trade is depth against integration. Three.js has a much larger ecosystem of loaders, controls and post-processing, and the plugin implies you can keep that ecosystem if you want it. LittleJS gives you a smaller API surface, which the README argues is a benefit for LLM-assisted development: "The entire API is small and well documented so LLMs can produce high quality results". That is a claim about API size, not a measured outcome, and it should be read as a design intention rather than a result.
A second reference point is Box2D. LittleJS integrates Box2D v2.3.1 as wasm rather than reimplementing a rigid body solver, which is the pragmatic choice: you get a real physics engine behind a plugin boundary, and you can ignore it entirely and use the arcade physics if your game only needs AABB collision and tilemap raycasts.
Maintenance, licence and what upgrades cost you
The repository is not archived, and the last push was on 2026-11-02. Releases are frequent: v1.29.0 on 2026-11-02, v1.28.0 on 2026-10-20, and v1.27.1 on 2026-10-14. The release titles tell you what to expect from an upgrade. v1.29.0 is labelled "Normal Maps and Decals", v1.28.0 is "Cameras, Screen Shake and Box2D Platforms", and v1.27.1 is "Faster Post Processing in Firefox and Physics Helpers".
That cadence is the upgrade cost. The engine ships as a single bundle with a generated type definition file, so an upgrade means replacing dist/ and re-checking that your game still renders and that any plugin you rely on still matches. The repository has a test directory and the package defines npm test as node --test over test/**/*.test.mjs, so the project tests itself, but those tests cover the engine, not your game. The repository keeps a CHANGELOG.md, so pinning a version in package.json and reading the changelog before bumping is the practical approach.
The licence is MIT, stated in the README, in package.json and in the LICENSE file, with a COPYRIGHT.txt alongside it. MIT is permissive: it allows commercial use and modification, and it requires that the copyright notice and permission notice be preserved. The package's files field publishes dist/, src/, plugins/, COPYRIGHT.txt and FAQ.md, so the notice ships with the package. This is a description of the licence text, not legal advice; check the actual terms with your own counsel if your situation is unusual.
Editorial conclusion
Adopt LittleJS for small browser games, jam entries and anything where the download size matters, and start from the Vite template rather than wiring the script tag by hand. Skip it if you expect a large third-party plugin market. Before committing, build your own game and confirm its output matches the size you are budgeting for.
Frequently asked questions
What is LittleJS used for?
It is used to build HTML5 games that run in the browser. The README describes 2D and 3D rendering, physics, particles, sound and input handling, and it points at size coding competitions such as Js13kGames as a target use case.
Is LittleJS free to use?
Yes. The README, the package.json and the LICENSE file all state the MIT licence, which permits commercial use and modification provided the copyright and permission notice are kept.
Is LittleJS good for beginners?
The README provides a Breakout tutorial, a quick reference sheet, an FAQ and single-file demos under examples/shorts, and it says the code is clean and well documented. It also ships built-in 2D and 3D level editors that edit your game while it runs.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/killedbyapixel-littlejs)Star history chart for your README
[](https://hysenlabs.com/projects/killedbyapixel-littlejs)Was this useful?