Introduction
gamecn is a set of editable game components, scenes, systems, and templates distributed as source code. It works the same way as shadcn/ui, but for game development — Phaser 3, Phaser 4, and Three.js — with a CLI that copies real files into your repo instead of installing a black-box dependency.
This is not a component library. It's a way to build your component library.
You know how most game engines and frameworks ship reusable bits as packages: install from npm, import the symbol, hope the API stays compatible. That works until you need to tweak how a player controller feels, or swap a renderer pipeline, or strip a system you don't need.
gamecn solves that by treating components as code you own. The CLI fetches the source, drops it into your project, runs the package manager, and gets out of the way. There's no runtime, no inheritance, no magic — just files in your repo.
Principles
Open Code
gamecn add copies the actual source. You see exactly what each component
does, edit it freely, refactor it, delete what you don't need. There's no
abstraction layer between you and the game logic.
Composition
Every item declares the same interface in item.json: files it provides,
dependencies it needs, engines it supports, where to wire it up. Items
compose without coupling.
Distribution
A flat-file schema (registry.json + registry-item.json) and a CLI make
it trivial to publish your own catalog. Host on a static site, behind auth,
or from a local file — gamecn doesn't care where the registry lives.
Engine-aware
First-class support for Phaser 3, Phaser 4, and Three.js. Authors declare which engine versions an item targets, and the CLI checks before installing. You won't accidentally drop Phaser 4 code into a Phaser 3 project.
Safe wiring
Where an item needs to hook into your existing files (preload lists, scene
registries, asset manifests) it uses comment markers like
// gamecn:preload:start — no AST rewrites, no surprise edits. Files
without markers are never modified.
How it works
- Pick a template or component from the catalog or templates.
- Run
npx create-gamecnto scaffold a new project, ornpx gamecn add <name>to drop into one you already have. - Edit. The installed files are yours. Future updates use lockfile
sha256s to detect what you've changed and never overwrite without
--force.
npx create-gamecn my-game --template phaser-endless-runner
npx gamecn add platformer-player
npx gamecn-registry build --src registry --out registry-distWhere to next
| If you want to… | Read |
|---|---|
| Run gamecn for the first time | Installation |
Configure gamecn.json for your project |
Configuration |
| Add an item from the official registry | gamecn add |
| Install from a different source | Spec forms |
| Use a private or self-hosted registry | Custom registries |
| Publish your own catalog | Authoring |
Status
gamecn is pre-1.0. Schemas may shift before stable. The default @main
registry isn't yet hosted at a permanent URL — the CLI uses
https://gamecn.dev/r/{name}.json as a placeholder. Until that's
live, point at your own registry via gamecn.json#registries.