1. Introduction
  2. Node CLI

The create-shuttle-app Node CLI is a utility designed to make deploying a NextJS web-app with a Rust backend easier. The CLI will initialize a create-next-app project and export it to a static directory in a rust webserver project based on the axum web framework. The rust server will serve the NextJS app in the static directory, and it can easily be extended with API-routes.

The Rust server also uses Shuttle. Shuttle uses annotations to deploy a webserver written in Rust to the cloud, and it can also provision databases like Postgres and MongoDB via annotations.

For more information on shuttle check out our website: https://www.shuttle.rs/

This is the first iteration of this CLI so you may encounter some issues at first. Feel free to report this to us on GitHub, or reach out to us on Discord

Usage

To install and run the latest version of the create-shuttle-app CLI, run this command:

npx create-shuttle-app

The command also takes some optional args:

--ts                               # Initialize the Next.js app as a typescript project.
--eslint                           # Initialize with eslint config.
-e, --example [name]|[github-url]  # An example to bootstrap the app with. You can use an example name
                                   # from the official Next.js repo or a GitHub URL. The URL can use
                                   # any branch and/or subdirectory
--shuttle-example <github-url>     # A GitHub URL to use to bootstrap the shuttle backend with.

Commands

After initializing your app, you’re ready to deploy it or run it locally.

To deploy your application to the cloud, you need to run the following commands:

First, login: npm run shuttle-login

Start your project container: npm run start

And that’s it! When you’re ready to deploy: npm run deploy

If you’d like to develop locally, you can start a NextJS dev server as well as your shuttle backend with the npm run dev

If you wish to stop your deployment: npm run stop

Windows Troubleshooting

create-shuttle-app will install Rust and the cargo-shuttle crate with install scripts. It will try to do this automatically, but it may fail, and you might want to do this yourself. The install scripts may also cause PowerShell to not be able to run create-shuttle-app, since it disallows scripts by default. To override this, run the set-executionpolicy remotesigned command in a PowerShell started in administrator mode. Or use Git Bash, which doesn’t restrict this.

If you want to install dependencies for create-shuttle-app manually, these are the required native dependencies: