The post-SQL era
has arrived

EdgeDB is an open-source database designed as a spiritual successor to SQL and the relational paradigm. It aims to solve some hard design problems that make existing databases unnecessarily onerous to use.

Powered by the Postgres query engine under the hood, EdgeDB thinks about schema the same way you do: as objects with properties connected by links. It's like a relational database with an object-oriented data model, or a graph database with strict schema. We call it a graph-relational database.

Install EdgeDB locally with one command:

Linux and macOS
Windows
$
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh
Copy
Click for step by step AWS cloud hosting deploy instructions
Click for step by step Google Cloud cloud hosting deploy instructions
Click for step by step Azure cloud hosting deploy instructions
Click for step by step DigitalOcean cloud hosting deploy instructions
Click for step by step Fly.io cloud hosting deploy instructions
Click for step by step Docker cloud hosting deploy instructions
Tap a logo for step by step deploy instructions

A graph-like schema
with a relational core

The core unit of schema in the graph-relational model is the object type—analogous to a table in SQL. Object types contain properties and can be linked to other object types to form a schema graph.

module default {
  type Account {
    required property username -> str {
      constraint exclusive;
    };
    multi link watchlist -> Content;
  }

  type Person {
    required property name -> str;
    link filmography := .<actors[is Content];
  }

  abstract type Content {
    required property title -> str;
    multi link actors -> Person {
      property character_name -> str;
    };
  }

  type Movie extending Content {
    property release_year -> int32;
  }

  type Show extending Content {
    property num_seasons := count(.<show[is Season]);
  }

  type Season {
    required property number -> int32;
    required link show -> Show;
  }
};
Interactive Schema
Learn more aboutSchema modeling

schema that does more
so you don't have to

Computeds
Default values
Constraints
Deletion policies
Indexes
1 2 3 4 5 6 7 8 9 10 11 12
type Player { required property username -> str; property clean_username := str_trim(.username); required property level -> int64 { default := 0; constraint min_value(0); } multi link friends -> Person { on target delete allow; }; index on (.username); }

Object types can contain computed properties and links. These "computeds" can return a modified version of a single property, reference multiple properties, or execute an entire subquery. The full power of EdgeQL is at your disposal.

View docs

The default expression will be executed upon insertion. It can be an arbitrary EdgeQL expression.

View docs

Use a built-in constraint type or declare a custom one that uses an arbitrary EdgeQL expression. Properties, links, and object types can be constrained.

View docs

Links can be assigned a deletion policy, which determines the cascade behavior when the target of a link is deleted.

View docs

Speed matters. Create indexes on a single property (computed or otherwise), combination of properties, or arbitrary EdgeQL expression.

View docs

Putting the great
in migrate

All migrations are generated and tracked by the database. You can interactively sanity-check each migration step with the CLI-based migration workflow.

schema.esdl
migrations/0001.edgeql
1 2 3 4 5 6 7 8
module default { type User { required property username -> str; } }
1 2 3 4 5 6 7 8
CREATE MIGRATION m1kdtk6ze2irotrxzscsr5hmt55zxv... { ALTER TYPE default::User { CREATE REQUIRED PROPERTY email -> std::str { SET REQUIRED USING ('example@example.com'); }; }; };
$ 
Learn more aboutMigrations

An elegant query language for a more civilized age

Think in objects
not rows

EdgeQL solves the object-relational impedance mismatch by returning a structured result object, not a list of rows—eliminating the need for a third-party ORM to denormalize the results.

Input
Run
Output JSON
Press the 'Run' button to evaluate the input

A query language
that composes

EdgeQL queries are fully composable, making things like subqueries and nested inserts a breeze.

Input
Run
Output JSON
Press the 'Run' button to evaluate the input

Designed for devs
not suits

SQL was designed with 1970s businessmen in mind, and it shows. EdgeQL uses syntax that's familiar to developers to represent selection sets, scope, structure, and property assignment.

Input
Run
Output JSON
Press the 'Run' button to evaluate the input

A comparison that speaks for itself

Select
Aggregations
Nested filters
Copy
# EdgeQL

select Movie {
  title,
  actors: {
   name
  },
};
Copy
# SQL

SELECT
  title,
  Actors.name AS actor_name
FROM Movie
 LEFT JOIN Movie_Actors ON
  Movie.id = Movie_Actors.movie_id
 LEFT JOIN Person AS Actors ON
  Movie_Actors.person_id = Person.id

Plays nice
with today's languages

A Typescript query builder
that puts ORMs to shame

It’s not an ORM; all the “object relational mapping” happens inside EdgeDB. Instead, it’s a query builder that’s auto-generated from your schema, can represent arbitrarily complex EdgeQL queries, and statically infers the type of the query result. Bye, bye, ORMs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import e, {createClient} from "./dbschema/edgeql-js";

const client = createClient();

const query = e.select(e.Movie, (movie) => ({
  title: true,
  actors: (actor) => ({
    name: true,
    uppercase_name: e.str_upper(actor.name),
    order_by: actor.name
  }),
  num_actors: e.count(movie.actors),
  filter: e.op(movie.title, 'ilike', '%avengers%')
}));

// fully typed results!
const result = await query.run(client);
result.actors[0].name;
DiscoverTypescript query builder

First-party clients
for your favorite languages

  • TypeScript and JavaScript

    Copy
    $ 
    npm install edgedb
  • Python

    Copy
    $ 
    pip install edgedb
  • Golang

    Copy
    $ 
    go get github.com/edgedb/edgedb-go
  • Deno

    Copy
    import * as edgedb from "https://deno.land/x/edgedb/mod.ts";
  • Rust

    Copy
    $ 
    cargo install edgedb-tokio
  • Dart

    Copy
    $ 
    dart pub add edgedb
  • .NETunofficial

    Copy
    $ 
    dotnet add package EdgeDB.Net.Driver
  • Elixirunofficial

    Copy
    add :edgedb to mix.exs

Workflows
that work

One CLI
to rule them all

Use our all-encompassing CLI to spin up new instances, create and apply migrations, introspect schema, and scaffold EdgeDB-backed applications. Install it with one command.

$ 
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh
EdgeDB CLI installed.
$ 
edgedb project init
Do you want to initialize a new project? [Y/n]
> Y
$ 
edgedb
edgedb> select 2 + 2;
Learn more aboutCLI

Host on your
favorite cloud

While we develop a hosted version—more on that later—you can host EdgeDB with your cloud of choice or self-host with our official Docker image.

Click a logo for a step-by-step guide.
Coming Soon

EdgeDB Cloud

We're building an EdgeDB hosting platform that’s full-managed, auto-scaling, serverless-friendly, and tightly integrated with our CLI. Drop your email to hear when it's ready.

Under
the hood

Protocol

EdgeDB's binary protocol is designed to have minimal latency possible, fast data marshalling, and to survive network errors.

Optimizing Compiler

EdgeDB is analagous to "LLVM for data", in that it compiles its high-level schema and queries to low-level tables and optimized SQL. The result is great performance without sacrificing usability or functionality.

Built on PostgreSQL

EdgeDB uses PostgreSQL as its data storage and query execution engine, benefitting from its exceptional reliability.

Fast Queries

Convenience usually comes at the price of performance, but not this time. EdgeQL is compiled into Postgres queries that go head-to-head with the best handwritten SQL.

Fully Open-source

EdgeDB is 100% Open Source and is distributed under Apache 2.0 license, including the database core, the client libraries, the CLI, and many other upcoming libraries and services.

Check us out on GitHub!

Integration Platform

EdgeDB goes well beyond a typical feature set of a database. Features that are traditionally pushed to clients to deal with (HTTP API, GraphQL, observability) are implemented right in the core.

Asynchronous Core

EdgeDB server utilizes non-blocking IO to make client connections cheap and scalable, solving the connection overload problem that's increasingly prevalent in an auto-scaling, serverless deployments. The underlying PostgreSQL connection pool will be automatically scaled as needed.

Benchmarks

Normally convenience comes at the price of performance, but not this time. Under the hood, each EdgeQL query is compiled into a single, optimized Postgres query that goes to-head with the best handwritten SQL.

EdgeDB vs ORM benchmarks
Learn more aboutBenchmarks

FAQ

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;
  3. is less capable than the query language is abstracts away (usually SQL);
  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.

The graph-relational model is a new conceptual model for representing data. Under this model, data is represented as strongly-typed objects that contain set-valued scalar properties and links to other objects.

It takes the relational model and extends it in some key ways.

  1. All objects have a globally unique identity. In EdgeDB this is a readonly uuid property called id.
  2. Objects can be directly connected with links. No foreign keys required.
  3. Everything is a set. All values in EdgeDB are strongly-typed sets with an associated type and a cardinality constraint, eliminating SQL's distinction between "table-valued" and "scalar-valued" expressions.

For a more in-depth discussion of the graph-relational model, refer to this blog post.

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, computed 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.