Skip to content

Examples for using shuttle with different frameworks and resources

Notifications You must be signed in to change notification settings

DitherWither/shuttle-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shuttle Examples

This is a collection of some example apps that show what you can do with shuttle.

The examples in this repository, listed below, consists of "Hello, world!" examples of all officially supported web frameworks and how to combine them with Shuttle resources, but also fullstack templates and more.

There are also unofficial examples that are created and maintained by community members. Contributions to this list are welcome. Check out the list at the bottom of this page.

How to clone, run and deploy an example

To clone an example, use the init command of the cargo-shuttle binary and specify the git URL and optional subfolder:

cargo shuttle init --from https://github.com/shuttle-hq/shuttle-examples --subfolder axum/hello-world

You can also add --name my-project-name and the target path as arguments. Otherwise, they will be prompted for.

The --from argument uses cargo-generate internally, which means you can also use these forms:

# GitHub prefix. Change to 'gl:' or 'bb:' for GitLab or BitBucket
cargo shuttle init --from gh:username/repository
# Also GitHub
cargo shuttle init --from username/repository

# From local folder
cargo shuttle init --from ../path/to/folder
cargo shuttle init --from /home/user/some/folder

Then, you can navigate into the folder where it was created, and use these commands to run the example locally, and to deploy it.

# Run locally
cargo shuttle run

# Start the Shuttle environment, make sure the project has a unique name
cargo shuttle project start
# Deploy to Shuttle
cargo shuttle deploy

Official Examples

This is a list of all examples maintained in this repostiory.

Framework Name & Link Description Command
Actix Web hello-world Hello World cargo shuttle init --template actix-web
Actix Web postgres TODO app with a Postgres DB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder actix-web/postgres
Actix Web websocket-actorless Websocket app that checks the status of Shuttle's API cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder actix-web/websocket-actorless
Axum hello-world Hello World cargo shuttle init --template axum
Axum metadata Simple app that prints the service information such as Shuttle service name cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/metadata
Axum static-files Hello World page that serves static HTML and JS files cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/static-files
Axum static-next-server SPA server for serving a apps from frameworks such as Next.js cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/static-next-server
Axum websocket Websocket app that checks the status of Shuttle's API cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/websocket
Axum with-state Hello World with example of how to utilize State in Axum cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder axum/with-state
Axum & Next.js saas Competent opinionated fullstack web app with pre-made routes and assets cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder fullstack-templates/saas
Poem hello-world Hello World cargo shuttle init --template poem
Poem mongodb TODO app with MongoDB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder poem/mongodb
Poem postgres TODO app with a Postgres DB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder poem/postgres
Poise hello-world Hello World Discord bot cargo shuttle init --template poise
Rocket authentication Use JWT to authenticate API endpoints cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/authentication
Rocket dyn-templates Handlebars dynamic templates cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/dyn-templates
Rocket hello-world Hello World cargo shuttle init --template rocket
Rocket persist Store weather data with Shuttle Persist cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/persist
Rocket postgres TODO app with a Postgres DB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/postgres
Rocket secrets Extract secrets from your Secrets.toml file cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/secrets
Rocket url-shortener URL shortener with Postgres storage cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/url-shortener
Rocket workspace A cargo workspace where one crate is a Shuttle service cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder rocket/workspace
Salvo hello-world Hello World cargo shuttle init --template salvo
Serenity hello-world Hello World Discord bot cargo shuttle init --template serenity
Thruster hello-world Hello World cargo shuttle init --template thruster
Thruster postgres TODO app with a Postgres DB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder thruster/postgres
Tide hello-world Hello World cargo shuttle init --template tide
Tide postgres TODO app with a Postgres DB cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder tide/postgres
Tower hello-world Hello World cargo shuttle init --template tower
Tracing custom-tracing-subscriber Hello world with a custom tracing setup cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder tracing/custom-tracing-subscriber
Warp hello-world Hello World cargo shuttle init --template warp
Custom Service none Empty service - A barebones implementation of Shuttle Service trait that does nothing cargo shuttle init --template none
Custom Service request-scheduler A custom Request Scheduler service cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder custom-service/request-scheduler
Custom Resource pdo Custom Shuttle resource that holds a Plain Data Object (PDO), shown in the context of an Axum app cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder custom-resource/pdo
Other standalone-binary How to split a project to allow it to run both with Shuttle and standalone cargo shuttle init --from shuttle-hq/shuttle-examples --subfolder other/standalone-binary

Community Examples

This is a collection of unofficial examples that community members have submitted. Quality and maintenance is not guaranteed. You can submit a Pull Request to add your example to the list.

Framework Name & Link Description Command
Axum/Any Fullstack Rust A basic project template for fullstack Rust projects cargo shuttle init --from TylerBloom/shuttle-fullstack-rust-example
Axum/Yew Web App with Yew A basic project template for a web app using the Yew framework cargo shuttle init --from sentinel1909/shuttle-template-yew

About

Examples for using shuttle with different frameworks and resources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 49.0%
  • TypeScript 45.3%
  • HTML 4.3%
  • Shell 0.6%
  • Handlebars 0.4%
  • JavaScript 0.3%
  • CSS 0.1%