Scratchjr
With ScratchJr, young children (ages 5-7) can program their own interactive stories and games.
Install / Use
/learn @scratchfoundation/ScratchjrREADME
Overview
This is the official git repository hosting the source code for the ScratchJr project.
ScratchJr can be built both for iOS and Android. A pure-web version is planned to follow at some point in the future.
Platform | Status -------- | ------------- iOS | Released in App Store Android | Released in Google Play
Architecture Overview
The diagram below illustrates the architecture of ScratchJr and how the iOS (functional), Android (functional) and pure HTML5 (future) versions share a common client.

Directory Structure and Projects
This repository has the following directory structure:
- <tt>src/</tt> - Shared JavaScript code for iOS and Android common client. This is where most changes should be made for features, bug fixes, UI, etc.
- <tt>editions/</tt> - Assembly directories for each "flavor" of ScratchJr. These symlink to src for common code, and could diverge in settings and assets.
- <tt>free/</tt> - Free edition JavaScript, including all shared code for all releases
- <tt>android/</tt> - Android port of Scratch Jr. (Java, Android Studio Projects)
- <tt>ScratchJr/</tt> - Android Studio Project for ScratchJr Android Application
- <tt>bin/</tt> - Build scripts and other executables
- <tt>doc/</tt> - Developer Documentation
- <tt>ios/</tt> - Xcode project for iOS build. (Make sure to open <tt>ScratchJr.xcworkspace</tt> not <tt>ScratchJr.xcodeproj</tt>)
Building ScratchJr
Initial setup
Regardless of whether you are doing iOS development or Android development, you should do these steps.
These instructions assume you are building both versions on Mac OSX, with Homebrew installed.
- Clone or update the code for this repo
- Ensure you have node and npm installed.
- Run <tt>sudo easy_install pysvg</tt> to install python svg libraries
- Run <tt>brew install librsvg</tt> to install commandline
rsvg-convert - Run <tt>brew install imagemagick</tt> to install commandline
magick - In the top level of the scratchjr repo directory, install npm dependencies for bundling the JavaScript: <tt>npm install</tt>
Analytics
ScratchJr uses the Firebase SDK to record analytics for the app. Scratch Team developers should look for the configuration files in the Scratch Devs Vault. If you're not on the Scratch Team, then you'll need to set up your own app analytics with Google Firebase. It's free. Firebase will generate the configuration files for you to download.
- Place the
google-services.jsonfile ineditions/free/android-resources - Place the
GoogleService-Info.plistfile ineditions/free/ios-resources
iOS
- To build the iOS version, you need to have a Mac with Xcode
- Run <tt>brew install cocoapods</tt> to install CocoaPods
- Run <tt>pod install</tt> to install the Firebase Analytics dependencies
- Open Xcode
- In Xcode, open <tt>ios/ScratchJr.xcworkspace</tt>
Android
- Install or update Android Studio
- In Android Studio, open the project <tt>android/ScratchJr</tt>
- Choose the appropriate flavor/build variant in Android Studio
Note: you can still do Android development on Ubuntu. Instead of the install commands above, run:
- <tt>sudo easy_install pysvg</tt> to install python svg libraries
- <tt>sudo apt-get install librsvg2-bin</tt> to install rsvg-convert
- <tt>sudo apt-get install imagemagick</tt> to install ImageMagick
Where and how to make changes
All changes should be made in a fork. Before making a pull request, ensure all changes pass our linter:
- <tt>npm run lint</tt>
For more information, see CONTRIBUTING.md.
Code credits
ScratchJr would not be possible without free and open source libraries, including:
Acknowledgments
ScratchJr is a collaborative effort between:
