
Prerequisites
Before you start, make sure you:- Install the Turso CLI
- Sign up or login to Turso
- Have an Axum app — learn more
1
Retrieve database credentials
You will need an existing database to continue. If you don’t have one, create one.Get the database URL:Get the database authentication token:Assign credentials to the environment variables inside
.env
.You will want to store these as environment variables.
2
Add the libsql crate to the project
Optionally, you can add a package such as
dotenvy
to help you work with .env
files:3
Execute SQL
4
Use in an Axum handler
Database
instance in the application state, which is then used in the handler to execute queries.