A monorepo for compiling Scratch 3 (.sb3) projects into standalone, high-performance web applications using TypeScript and Konva.js.
The Scratch Compiler transforms Scratch project files into a directory containing:
index.html: A clean entry point for the web application.assets/: All costumes and sounds extracted from the original.sb3file.src/main.js: A generated JavaScript file that initializes the project state.src/engine.min.js: A lightweight runtime that handles rendering and execution.
This project is managed as a PNPM workspace:
packages/cli: The command-line interface used to compile.sb3files.- Extracts assets and
project.json. - Generates the
main.jsloader. - Packages the static web template.
- Extracts assets and
packages/client: The browser runtime (engine).- Built with Konva.js for hardware-accelerated 2D rendering.
- Defines the
StageandSpriteprimitives.
packages/types: Shared TypeScript definitions for the Scratch 3.0 file format.
The project is currently in early development.
- Extraction of
.sb3archives. - Automated asset extraction (Images, SVGs, Audio).
- Migration of project structure (Stage and Sprite initial states).
- Generation of a readable
main.jsfile. - Basic rendering engine using Konva.js.
- Basic events (flag, click, keypress, broadcast).
- Monorepo setup with optimized build pipeline (esbuild + TSC).
- Block execution engine (interpreting Scratch scripts).
- Support for Scratch variables and lists.
- Sound playback integration.
- Advanced graphic effects (ghost, color, etc.).
- Pen extension support.
pnpm installBuild the entire workspace:
pnpm run buildTo compile a .sb3 file:
pnpm run cli:start --file path/to/your/project.sb3 --output ./dist-webMIT