Connect to libSQL / SQLite
Tested with: libsql-server (sqld) 0.24 on Databasezy · drivers listed per tab · zb CLI 0.1
libSQL is SQLite served over the network. The instance runs libsql-server (sqld) and speaks the Hrana protocol
over HTTPS and WebSockets, so the clients are HTTP clients and there is no CA to download: the certificate is
publicly trusted and verified by your language’s TLS stack.
- Copy the URL from Connect. libSQL uses a JWT-style auth token instead of a username and password; it is shown once, like any credential, and rotated the same way.
- Add your egress IPs under Network → Allow-list (the allow-list applies to HTTP engines too).
- Use an official client (Node, Python, Go, Rust) or the HTTP pipeline API from anything else.
libSQL / SQLite listens on port 443 (HTTPS). Versions: 0.24. Replace the example host with the one on your instance's Connect tab; credentials are shown once at creation.
libsql://libsql-7f3k.us-east.databasezy.com?authToken=<token>import { createClient } from "@libsql/client";
export const db = createClient({ url: "libsql://libsql-7f3k.us-east.databasezy.com", // TLS with a publicly trusted certificate authToken: process.env.ZB_TOKEN,});
const rs = await db.execute("select sqlite_version() as v");console.log(rs.rows[0].v);Tested with: libSQL / SQLite 0.24 · @libsql/client 0.14
import asyncioimport osimport libsql_client
async def main(): async with libsql_client.create_client( url="libsql://libsql-7f3k.us-east.databasezy.com", auth_token=os.environ["ZB_TOKEN"] ) as client: rs = await client.execute("select sqlite_version() as v") print(rs.rows[0]["v"])
asyncio.run(main())Tested with: libSQL / SQLite 0.24 · libsql-client 0.3
package main
import ( "database/sql" "fmt" "os"
_ "github.com/tursodatabase/libsql-client-go/libsql")
func main() { url := fmt.Sprintf("libsql://libsql-7f3k.us-east.databasezy.com?authToken=%s", os.Getenv("ZB_TOKEN")) db, err := sql.Open("libsql", url) if err != nil { panic(err) } defer db.Close() var v string if err := db.QueryRow("select sqlite_version()").Scan(&v); err != nil { panic(err) } fmt.Println(v)}Tested with: libSQL / SQLite 0.24 · libsql-client-go v0.0.0-2024
use libsql::Builder;
#[tokio::main]async fn main() -> libsql::Result<()> { let token = std::env::var("ZB_TOKEN").expect("ZB_TOKEN"); let db = Builder::new_remote("libsql://libsql-7f3k.us-east.databasezy.com".to_string(), token).build().await?; let conn = db.connect()?; let mut rows = conn.query("select sqlite_version()", ()).await?; while let Some(row) = rows.next().await? { println!("{}", row.get::<String>(0)?); } Ok(())}Tested with: libSQL / SQLite 0.24 · libsql 0.6
// libSQL has no standard JDBC driver yet; call the Hrana HTTP pipeline directly.import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;
public final class Db { public static void main(String[] args) throws Exception { var body = """ {"requests":[{"type":"execute","stmt":{"sql":"select sqlite_version()"}},{"type":"close"}]} """; var req = HttpRequest.newBuilder(URI.create("https://libsql-7f3k.us-east.databasezy.com/v2/pipeline")) .header("Authorization", "Bearer " + System.getenv("ZB_TOKEN")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)).build(); var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString()); System.out.println(res.body()); }}Tested with: libSQL / SQLite 0.24 · Java 21 java.net.http (Hrana v2 over HTTPS)
# Hrana v2 pipeline over HTTPS (works from any language with an HTTP client)curl -sS https://libsql-7f3k.us-east.databasezy.com/v2/pipeline \ -H "Authorization: Bearer $ZB_TOKEN" \ -H "Content-Type: application/json" \ -d '{"requests":[{"type":"execute","stmt":{"sql":"select sqlite_version()"}},{"type":"close"}]}'
# orzb connect libsql-7f3k --print # endpoint only: HTTP engines have no shellTested with: libSQL / SQLite 0.24 · curl 8 · sqld 0.24
Embedded replicas
Section titled “Embedded replicas”The Node, Go and Rust clients can keep a local SQLite file in sync with the instance (syncUrl / Builder::new_remote_replica).
Reads are then local and writes go to Databasezy. This is the recommended mode for edge and serverless runtimes
with a filesystem.
Limits
Section titled “Limits”- One writer at a time (SQLite semantics); readers are unlimited.
- Database size counts toward the instance’s storage; backups are file snapshots plus a WAL stream to object storage (“bottomless”) with point-in-time recovery.
- No CA bundle is needed; the Java tab shows the HTTP pipeline for platforms without an official client.