Libraries
EdgeDB implements libraries for popular languages which make it easier to build applications backed by EdgeDB.
Languages
Design
Our libraries provide a common set of functionality and a consistent design philosophy.
Automatic client pooling
Most libraries implement a Client class that internally manages an internal client-side connection pool that works transparently and gets out of the way, while enabling you to write scalable code.
Zero config
All client libraries implement a standard protocol for determining how to connect to your database. In most cases, this will involve checking for special environment variables like EDGEDB_DSN
or, in the case of EdgeDB Cloud instances, EDGEDB_INSTANCE
and EDGEDB_SECRET_KEY
. (More on this in the Connection section below.)
Query execution
A Client will provide both blocking and non-blocking methods for executing queries against your database so that you can use the IO mode that works best in every scenario. Under the hood, your query is executed using EdgeDB’s efficient binary protocol.
Resiliency
EdgeDB client libraries automatically retry failed transactions and queries so that your users get greater reliability without any extra effort from you.
Code generation
EdgeDB client libraries automatically retry failed transactions and queries so that your users get greater reliability without any extra effort from you.
Consistency
EdgeDB client libraries are all designed with the same philosophy. This means, once you learn one of them, you basically know them all. They’re all implemented in a consistent way while also taking into account the idioms of the language. No matter which binding, you’ll feel right at home!
Connecting
For local instances
Use edgedb project init
in your project’s directory to initialize that directory as an EdgeDB project. This will allow you to either create a new instance associated with this directory or to associate an existing instance. All commands run from this directory that don’t specify connection options will automatically connect to this instance. The same goes for any client libraries running within the directory.
For EdgeDB Cloud instances
Set the EDGEDB_INSTANCE
and EDGEDB_SECRET_KEY
environment variables. The client will use these to connect to your EdgeDB Cloud instance.
For self-hosted instances
Set the EDGEDB_DSN
environment variables to a DSN that points to your instance. The client will use it to connect to your EdgeDB instance.
As an alternative in local development…
you may pass a DSN or instance name to the client creation function. Here’s what it looks like in JavaScript:
const client = edgedb.createClient({
dsn: "edgedb:https://..."
});
See connection parameters for more options for connecting a client to your EdgeDB instance.