nx.js is a framework that enables the development of Nintendo Switch homebrew applications using JavaScript. Powered by the QuickJS engine, nx.js provides a streamlined environment for writing homebrew applications for the Nintendo Switch console.

With nx.js, developers can leverage their JavaScript skills and tools to create engaging and interactive experiences for the Nintendo Switch platform. The framework abstracts the underlying low-level details and provides a high-level JavaScript API that simplifies the development process.

nx.js is designed with Web standards in mind, so familiar APIs like setTimeout(), fetch(), new URL(), Canvas and much more are supported. If you are familar with web development then you should feel right at home.

  • JavaScript Development: Write homebrew applications for the Nintendo Switch using JavaScript, a popular and widely supported programming language.
  • High-Level API: Benefit from a high-level JavaScript API designed specifically for the Nintendo Switch platform, providing easy access to console-specific features and functionality.
  • Input Handling: Capture and process user input with ease, including buttons, touch screen, and motion controls, to create engaging gameplay experiences.
  • Graphics and UI: Create visually appealing and interactive user interfaces using the web Canvas API.
  • Audio Support: Integrate audio playback and sound effects into your applications using the web Audio API.
  • WebAssembly: Support for executing code compiled to WebAssembly (WASM).
  1. Set up a custom firmware on your Switch, so that it can run homebrew applications (instructions).
  2. Download the nxjs.nro file from the Releases page.
  3. Create a file called nxjs.js with the following contents:
    console.log('Hello Switch, from JavaScript!');
  4. Copy both files into the /switch directory on your SD card.
  5. Launch the app from the homebrew loader.
  6. Profit!

See the API docs for further details, and check out the apps directory for examples.

Run the following command to bootstrap the creation of an nx.js application:

npm create nxjs-app@latest

You will be able to choose from one of the example applications as a starting point. Follow the prompts, and afterwards a new directory will be created with the project name that you entered.

The following package.json scripts are configured:

  • build - Bundle the application code into a single JavaScript file using esbuild
  • nro - Package the bundled app (+ any other files in the romfs dir) into a self-contained .nro file

Contributions to nx.js are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request in the GitHub repository.

Join the Discord server!

  1. Node.js needs to be installed (curl -sfLS install-node.vercel.app/20 | bash)
  2. pnpm needs to be installed (npm i -g pnpm)
  3. jq needs to be installed (brew install jq)
  4. The devkitPro compiler toolchain needs to be installed
  5. Install required packages from the official registry:
    dkp-pacman -S switch-dev switch-freetype switch-libjpeg-turbo switch-libpng switch-libwebp switch-mbedtls
  6. Install additional packages which are not in the official registry (cairo, pixman, wasm3, harfbuzz, quickjs-ng):
    docker pull ghcr.io/tootallnate/pacman-packages:nxjs
    docker run -it --rm --mount type=bind,source="$(pwd)",target=/host ghcr.io/tootallnate/pacman-packages:nxjs sh -c 'cp packages/*/*.pkg.tar.zst /host'
    dkp-pacman -U *.pkg.tar.zst
  7. Now you can compile one of the example apps into a self-contained .nro:
    ./build.sh hello-world

nx.js is released under the MIT License. Please see the LICENSE file for more details.