Create & connect a database
A Comwit Cloud database is a Turso/libSQL database (powered by Louhi) that lives
inside one of your projects. You create and manage it through the product API or
the comwit CLI, and your app talks to it directly as a plain libSQL endpoint at
https://db.cloud.comwit.io.
This page walks you through creating a database, safely handling the connection token, listing the databases in a project, and pointing your app at the new database.
Before you start
Section titled “Before you start”You need a project to put the database in. Every database belongs to a project,
and most commands take a --project <projectId> (or {projectId} in the API).
If you have not installed the CLI yet, see Install the CLI.
Create a database
Section titled “Create a database”Pick a --name for the database (for example app-db). With the CLI:
comwit databases create --project <projectId> --name app-dbThe equivalent API call is a POST to the project’s databases collection:
POST /v1/projects/{projectId}/databases{ "name": "app-db" }A successful create returns the new database and, importantly, a one-time connection token:
{ "database_id": "db-xxxx", "database_url": "https://db.cloud.comwit.io/v1/<tenant_id>", "created": true, "database_token": "<one-time token>"}The fields are:
database_id— the stable identifier for this database (for exampledb-xxxx). Use it in lifecycle and SQL operations.database_url— the libSQL data endpoint your app connects to (see Connect your app below).created—truewhen the database was provisioned by this request.database_token— the long-lived connection token your app authenticates with.
Copy the token now — it is shown only once
Section titled “Copy the token now — it is shown only once”List the databases in a project
Section titled “List the databases in a project”To see what already exists in a project:
comwit databases list --project <projectId>GET /v1/projects/{projectId}/databasesThe response wraps the databases in a databases array:
{ "databases": [ { "database_id": "db-xxxx", "name": "app-db", "status": "...", "created_at": "2026-06-16T12:34:56Z", "database_url": "https://db.cloud.comwit.io/v1/<tenant_id>" } ]}Each entry includes database_id, name, status, created_at, and
database_url (omitted when empty). Note that the list does not include any
token — tokens only ever come back from create and rotate.
Connect your app
Section titled “Connect your app”Your database is a standard libSQL endpoint, so any libSQL client can connect to it using the URL plus the token. The URL has this shape:
https://db.cloud.comwit.io/v1/<tenant_id>Use database_url (from create or list) as the connection URL and the
database_token (from create or rotate) as the auth token in your libSQL client.
Store both as secrets/environment variables in your app.
Next steps
Section titled “Next steps”- Run SQL against your new database from the console or with a query token.
- Manage a database to rotate the token, check status and usage, or delete it.
- Deploy an app and wire it to this database.