Turso Cloud SDKs Official SDKs TypeScript Guides
Qwik + Turso
Set up Turso in your Qwik project in minutes

Prerequisites
Before you start, make sure you:
- Install the Turso CLI
- Sign up or login to Turso
- Have a Qwik app — learn more
1. Add Turso Integration
npm run qwik add turso
pnpm qwik add turso
yarn qwik add turso
2. Configure database credentials
Get the database URL:
turso db show --url <database-name>
Get the database authentication token:
turso db tokens create <database-name>
Assign credentials to the environment variables inside .env.local.
PRIVATE_TURSO_DATABASE_URL="..."
PRIVATE_TURSO_AUTH_TOKEN="..."
3. Execute SQL
import { tursoClient } from "~/utils/turso";
export const useFrameworks = routeLoader$(
async (requestEvent: RequestEventBase) => {
const db = tursoClient(requestEvent["env"]);
const { rows } = await db.execute("select * from table_name");
return {
items: rows,
};
},
);
Examples
Synced from official Turso documentation (
tursodatabase/turso-docs
· MIT License)
Official Docs ↗