EdgeDB is a next-generation database that gives developers superpowers. It takes the tools and features you know and love — declarative schema, interactive migrations, deep querying, introspectability, and more — and bakes them directly into the database.
The easiest and preferred way to install and set up the EdgeDB server is using our command-line tool. Run the following in your terminal and follow the on-screen instructions.
$
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh
Your schema is too important to be scattered across your database, migration scripts, and ORM models. With EdgeDB, your datamodel is defined in one place, using EdgeDB’s readable declarative schema language. Just write out your object types (analagous to tables in SQL), their properties, and the links between them—no foreign keys required.
type Person {
required property name -> str;
multi link friends -> Person;
}
type Animal {
property num_legs -> int32;
link owner -> Person;
}
EdgeDB makes hard queries easy. It was designed in conjunction with an accompanying query language, EdgeQL, featuring a readable, composable syntax that supports deep queries, nested mutations, and more while remaining more compact, composable, and readable than SQL.
# no JOINs, no foreign keys
SELECT Person {
id,
name,
pets: {
id,
name
}
}
FILTER .name = "Tony";
Never write another schema migration script again. Just update your schema file and run edgedb create-migration to interactively generate a migration. Then run edgedb migrate to push the latest changes to your database. It’s that simple.
type BaseUser {
type User {
required property name -> str;
required property email -> str;
multi link friends -> User;
}
EdgeDB includes the all-encompassing edgedb
command-line tool. It provides an idiomatic way to do just about everything: install EdgeDB, spin up a local instance, open a REPL, execute queries, manage auth roles, introspect a database schema, create migrations, and more. Install it with one shell command.
$
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh
Unlike most relational databases, EdgeDB maintains first-party clients for popular languages like JavaScript/TypeScript, Python, and Go. All clients implement EdgeDB’s binary protocol for low latency, blazing fast queries.
$
npm install edgedb
$
pip install edgedb
$
go get github.com/edgedb/edgedb-go
import * as edgedb from "https://deno.land/x/edgedb/mod.ts";
If you’re a GraphQL fan we’ve got you covered. EdgeDB databases can expose an auto-generated GraphQL endpoint, so you can query all types, filter and sort by any property, easily fetch deeply related fields, introspect your schema with GraphiQL, and integrate with your favorite GraphQL tooling.
query getMovie($id: String!){
Movie(filter: {id: {eq: $id}}) {
id
title
actors(order: {name: DESC}) {
name,
email
}
}
}
Normally convenience comes at the price of performance, but not this time. Under the hood, EdgeDB maintains an optimal table layout, intelligently caches incoming queries, and compiles EdgeQL into efficient Postgres queries that go head-to-head with the best handwritten SQL. Plus, the composable nature of EdgeQL can eliminate unnecessary requests with easy nested queries and mutations.
Yes — EdgeDB is a new database with its own query language, type system, and set of tools and conventions.
That said, EdgeDB is built on top of Postgres. This lets us design a better abstraction for databases while taking advantage of the incredible work done by the Postgres community over the past 35 (!) years. Internally, all EdgeQL queries are compiled into an equivalent Postgres query. You can run EdgeDB as a query engine on top of an externally hosted Postgres instance or let EdgeDB manage Postgres for you under the hood.
No. Like every database throughout history, EdgeDB introduces a layer of abstraction on top of more primitive mechanisms performing data access and manipulation. In the case of most databases, these mechanisms are often low-level key-value stores (for example, WiredTiger in MongoDB, InnoDB in MySQL, or RocksDB in CockroachDB). EdgeDB takes this concept one level further: it treats PostgreSQL as a lower-level storage engine and introduces better schema and query abstractions on top.
In contrast, ORMs are libraries that provide a high-level way to query and manipulate data in your database. Typically an ORM 1) provides a standard interface for querying a number of supported databases, 2) is strongly coupled to a particular programming language (like JavaScript or Python), 3) is less capable than the query language is abstracts away (usually SQL), and 4) provides an object-oriented way to perform and persist data manipulations.
EdgeDB has none of these properties. You query and manipulate data with a full-featured query language (EdgeQL) that is designed to match or surpass the power of SQL (though certain advanced features are still under development, see the Roadmap for details). It’s language agnostic: you can interact with your database with any programming language you like. And it was designed from the start as a new abstraction on top of Postgres specifically.
That last part is important. It lets EdgeDB take full advantage of the power of Postgres, whereas ORMs cannot; their capabilities are limited to features shared by all the databases they support.
There are a lot! Scroll down to the "Showcase" below for a bunch of examples. As a rough structure, we consider the main innovations to be three-fold:
The EdgeQL query language: a full redesign of SQL that has been sorely needed for decades. This includes support for GraphQL-style selection sets, easily nestable subqueries (including inserts and updates), a new link
concept that abstracts away JOINs and foreign keys, edge properties, and a typesafe NULL-free type system grounded in set theory.
Declarative schema. The EdgeDB spec includes a schema definition language (simply called the EdgeDB SDL) that lets you define your schema declaratively and succinctly, including advanced features like abstract types, computable fields, unions, custom scalars, and JSON support.
First-party migrations. Migrations have been a pain point for developers since the introduction of SQL. Hundreds of libraries across dozens of language ecosystems have tried to solve the problem of SQL migrations. EdgeDB ships with a first-party interactive migration tool baked directly into the `edgedb` command-line tool.
But there are a hundred cool and nifty ways we’ve upgraded the developer experience of creating, querying, and managing databases. Jump into the docs to understand EdgeDB in all its glory.
EdgeDB is a relational database at its core. Literally: it’s built on top of PostgreSQL. But it takes inspiration of ideas pioneered by NoSQL, graph databases, GraphQL, and ORM libraries.