# CockroachDB on Layerbase Desktop and CLI

> Run CockroachDB locally with Layerbase Desktop or self-host it with the Layerbase CLI. Distributed SQL, Postgres wire-protocol compatible.

Canonical: https://layerbase.com/db/cockroachdb
Last updated: 2026-08-25

Distributed SQL with strong consistency, Postgres wire-protocol compatible. Available on Layerbase Desktop and self-hosted with the Layerbase CLI.

## Key facts

| Fact | Value |
| --- | --- |
| Engine | CockroachDB |
| Category | Relational |
| Upstream project | [CockroachDB](https://www.cockroachlabs.com/) |
| Layerbase Cloud | No |
| Layerbase Desktop | Yes |
| SpinDB (local CLI) | Yes |
| Best for | Distributed transactional workloads, strong-consistency apps that need to span regions, and existing Postgres apps that want horizontal scale. |

## Availability on Layerbase Cloud

The CockroachDB Software License (CSL) wording makes us uncomfortable to host CockroachDB as a serverless platform. We didn't want to ship something where the licensing story was murky for our paying customers.

If you're with Cockroach Labs and would like to work with us on a clean managed offering, we would love to hear from you.

## Use cases

- Develop against a real CockroachDB locally before deploying to a managed Cockroach Cloud
- Prototype multi-region patterns on the desktop without a paid cluster
- Self-host CockroachDB on your own infra with the same Layerbase CLI
- Validate Postgres-compatible queries against the CockroachDB SQL layer
- Run schema migrations against an on-machine cluster before production

## Common CockroachDB questions

### What is CockroachDB?

CockroachDB is a distributed SQL database with strong consistency that speaks the PostgreSQL wire protocol, so psql, libpq-based drivers, and Postgres ORMs connect to it. It is built for transactional workloads that need horizontal scale or want to span regions. Layerbase does not host it on Cloud for licensing reasons, but it runs on Layerbase Desktop and self-hosted through the Layerbase CLI, in both cases as the upstream binary.

### How much does CockroachDB cost on Layerbase?

There is no managed CockroachDB to buy: it is not on Layerbase Cloud for licensing reasons, so no plan includes it. Layerbase Desktop is free for personal use and runs the upstream binary on your own machine, and self-hosting it with the Layerbase CLI costs whatever your own hardware costs.

### Why is CockroachDB not on Layerbase Cloud?

CockroachDB ships under the CockroachDB Software License (CSL), which restricts hosted commercial offerings. We do not run it as a managed service for that reason. On the desktop or via the Layerbase CLI you run the upstream binary directly under its standard license.

### Can my Postgres app connect to CockroachDB?

Yes. CockroachDB speaks the PostgreSQL wire protocol, so psql, libpq-based drivers, ORMs (Prisma, Drizzle, etc.) all work. There are some SQL dialect differences, primarily around schema and transactions.

### How is the desktop experience different from cloud Postgres?

Desktop CockroachDB still runs the full distributed SQL engine, just with a single in-process node. The dashboard surfaces the same connection panel, query console, and management UI as the rest of Layerbase.

### When would Layerbase Cloud add CockroachDB?

If the licensing landscape changes or we partner with Cockroach Labs directly. For now, desktop and self-host are the supported paths.

### Can I move a schema from Postgres to CockroachDB?

For most apps, yes. Identify Postgres-specific features your schema uses (custom types, certain extension features) and confirm they map to CockroachDB before migrating.

## Links

- [CockroachDB on Layerbase](https://layerbase.com/db/cockroachdb)
- [Pricing](https://layerbase.com/pricing) (markdown: https://layerbase.com/pricing.md)
