We're excited to share that Capacitor developers can now use Turso Cloud in their mobile apps thanks to the new @capawesome/capacitor-libsql
plugin from the Capawesome team. This means you can now build offline-first mobile apps that sync seamlessly with Turso Cloud.
npm install @capawesome/capacitor-libsql
npx cap sync
Once installed, connect to your existing Turso Cloud Database using the url
and authToken
provided by the Turso Cloud Dashboard (or CLI):
import { Libsql } from '@capawesome/capacitor-libsql';
const { connectionId } = await Libsql.connect({
url: 'libsql://your-database-url.turso.io',
authToken: 'your-auth-token-here',
// Or use a local file: path: 'database.db'
});
Now you're connected, you can execute queries just like you'd expect:
const result = await Libsql.query({
connectionId,
statement: 'SELECT * FROM users WHERE active = ?',
values: [true],
});
await Libsql.execute({
connectionId,
statement: 'INSERT INTO users (name, email) VALUES (?, ?)',
values: ['John Doe', 'john@example.com'],
});
We can use sync()
our remote changes with the local SQLite file (if configured in the steps above). This will replace the current data in the local SQLite file with the data from Turso Cloud:
await Libsql.sync({ connectionId });
The plugin works identically on both iOS and Android, and supports local SQLite files, in-memory databases, or remote connections to Turso Cloud. This flexibility means you can start local and move to the cloud when you're ready, or build hybrid apps that work both online and offline.
What makes this particularly powerful is the combination of SQLite's reliability with Turso's offline-first architecture. Your mobile app gets all the benefits of a local database - fast queries, offline capability, and familiar SQL - while your data is synced between the local device and Turso Cloud, giving you zero network latency for reads and true offline functionality.
Check out the full documentation and source code to dive deeper. Big thanks to the Capawesome team for making this integration possible!