Skip to main content
Axum banner

Prerequisites

Before you start, make sure you:
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

This example creates a shared Database instance in the application state, which is then used in the handler to execute queries.