This plugin allows services to connect to a Turso database. Turso is an edge-hosted distributed database based on libSQL, a SQLite fork.


IMPORTANT: Currently Shuttle isn’t able to provision a Turso database for you (yet). This means you will have to create an account on their website and follow the few steps required to create a database and create a token to access it.

Add shuttle-turso and libsql-client to the dependencies for your service by running cargo add shuttle-turso libsql-client. This resource will be provided by adding the shuttle_turso::Turso attribute to your Shuttle main decorated function.

Internally, shuttle_turso::Turso pins version 0.30.1 of libsql-client. If you add libsql-client either with cargo add or manually, it will be necessary to edit your Cargo.toml file afterwards to downgrade to version 0.30.1.

It returns a libsql_client::Client. When running locally it will instantiate a local SQLite database of the name of your service instead of connecting to your edge database.

If you want to connect to a remote database when running locally, you can specify the local_addr parameter. In that case, the token will be read from your file.


addrstr""URL of the database to connect to. If `libsql://“ is missing at the beginning, it will be automatically added.
tokenstr""The value of the token to authenticate against the Turso database. You can use string interpolation to read a secret from your Secret.toml file.
local_addrOptionNoneThe URL to use when running your service locally. If not provided, this will default to a local file named <service-name>.db


In the case of an Axum server, your main function will look like this:

use libsql_client::client::Client;
use shuttle_axum::ShuttleAxum;

async fn app(
	token="{secrets.DB_TURSO_TOKEN}")] client: Client,
// use secrets if you are not hardcoding your token/addr
#[shuttle_secrets::Secrets] secrets: SecretStore
) -> ShuttleAxum { 
// ... some code