New Vercel integration has just launched! Read more

Turbocharged Postgres

data layer

We wanted a database with hierarchical queries, advanced data modeling, and great DX. There were none, so we built EdgeDB, based on PostgreSQL, 100% open source.

It's become so much more.

N+1, solved

EdgeDB solves the problems that ORMs exist to workaround.

A comparison that speaks for itself:

SELECT
  movie.title,
  (
    SELECT avg(rating)
    FROM reviews
    WHERE movie_id = movie.id
  ) AS avg_rating,
  (SELECT
    array_agg(q.v)
    FROM
      (SELECT
        person.name AS v
      FROM
        actors
        INNER JOIN persons AS person
          ON (actors.person_id = person.id)
      WHERE
        actors.movie_id = movie.id
      ) AS q
    WHERE q.v IS NOT NULL
  ) AS actors
FROM
  movies AS movie
WHERE
  id = $1;
const movieRatingQuery = db
  .select({
    id: schema.reviews.movieId,
    avgRating: avg(schema.reviews.rating).mapWith(Number),
  })
  .from(schema.reviews)
  .groupBy(schema.reviews.movieId)
  .where(eq(schema.reviews.movieId, sql.placeholder("movieId")))
  .prepare("movieRating");

const movieQuery = db.query.movies
  .findFirst({
    columns: {
      title: true
    },
    extras: {
      avg_rating: sql`${sql.placeholder("avgRating")}`.as("avg_rating"),
    },
    with: {
      actors: {
        columns: {
          name: true
        }
      }
    },
    where: eq(schema.movies.id, sql.placeholder("movieId")),
  }).prepare('movie');

const result = await db.transaction(async () => {
  const rating = await movieRatingQuery.execute({ id });
  return await movieQuery.execute({
    id,
    avgRating: rating[0].avgRating
  });
});
const _result = await client.$transaction([
  client.movies.findUnique({
    where: {
      id: id,
    },
    select: {
      title: true,
      actors: {
        select: {
          person: {
            select: {
              name: true
            }
          }
        }
      }
  }),
  client.reviews.aggregate({
    _avg: {
      rating: true,
    },
    where: {
      movie: {
        id: id,
      },
    },
  }),
]);

_result[0].avg_rating = _result[1]._avg.rating;
const result = _result[0];
# assuming "Movie model" is defined with this
# "expression column":
#
#   avg_rating = orm.column_property(
#       select(func.avg(Review.rating))
#          .where(Review.movie_id == id)
#          .correlate_except(Review)
#          .scalar_subquery()
#)

stmt = (
  sa.select(m.Movie)
  .options(
      orm.selectinload(m.Movie.actors_rel).joinedload(
        m.Actors.person_rel
      ),
  )
  .filter_by(id=id)
)

movie = session.scalars(stmt).first()
actors = [rel.person_rel for rel in movie.actors_rel]

result = {
  "title": m.title,
  "actors": [
    [{"name": a.name} for a in actors]
  ],
  "avg_rating": avg_rating
}
# EdgeQL is the main query language of EdgeDB.

select Movie {
  title,
  actors: {
    name
  },
  rating := math::mean(.reviews.score)
} filter .id = <uuid>$id
const query = e.params({id: e.uuid}, ($) =>
  e.select(e.Movie, (movie) => ({
    title: true,
    actors: {
      name: true
    },
    rating: e.math.mean(movie.reviews.score),
    filter: e.op(movie.id, '=', $.id),
  }));
);

const result = await query.run(client, {id});

Composable

Write complex queries at the speed of thought.

Ergonomic

Fully type-safe query language and schema.

Universal

Learn once and build with any software stack.

Fast

EdgeDB's client libraries, network protocol, and query language are designed for performance.

DB / backend latency:
EdgeDB
Drizzle
Sequelize
SQLAlchemy
Prisma
Django
0
100
200
300
400
500
600
700
Requests per second. More is better.
Guillermo Rauch, Vercel, Founder & CEO

EdgeDB fixes fundamental flaws of SQL and legacy DBs in serverless. The perfect fit for Next.js and Vercel.

James Tamplin, Firebase, Founder

EdgeDB's powerful querying is what we wanted to build into Firebase and never got there. I'm excited!

David Cramer, Sentry, Founder

The most high tech companies in the world run graph architectures on top of SQL. Now you, too, can be high tech.

Charlie Marsh, Astral, Founder

I've been continually impressed by both the ideas behind EdgeDB and the way they've been brought to life.

Theo - t3.gg

As a long time hater of MongoDB, I'm pumped to see a real challenger for SQL that goes the other direction. Relations are good!

Sebastián Ramírez, FastAPI

If you want to use a relational database but you wish there was something beyond SQL, you should check out EdgeDB. As it generates strict types, has async drivers, and has great performance, it's a great DB option for FastAPI apps. And it's built by the same people that created the async Python underpinnings that enable things like FastAPI.

AI-Ready

EdgeDB can automatically generate embeddings for your data.
Works with OpenAI, Mistral AI, and Anthropic.

Ship AI-enabled apps in three steps.

Drop this line into your schema:

using extension ai;

Add an AI index to your type:

type Astronomy {
  content: str;
  deferred index
    ext::ai::index(...) on (.content);
}

Configure which LLM you want to use.

Query your new RAG endpoint via HTTP or our client SDKs. EdgeDB will handle the rest.

Simple Stack

Store and query your application and vector data in one database.

Flexible

Use the full RAG or only the deferred AI index functionality.

Graphical UI

Chat with your database via the built-in graphical UI.

Seamless Auth

EdgeDB comes with a complete built-in auth solution. OAuth, passwords, passwordless, email, notifications — all covered.

Login UI

Enable the built-in login UI flow, or craft your own with our SDK.

Access Policies

Auth works with Schema Access Policies for robust data security.

Free

Included in the core with no hidden charges — support unlimited users.

OAUTH

EMAIL

EdgeDB sends emails for password resets, registration, and more.

Passwordless

Passkeys, WebAuthn, magic links... we've got it all.

Cloud

EdgeDB Cloud is designed alongside both EdgeDB and its tooling to deliver the very best cloud database experience.

Vertically integrated

EdgeDB, its core tools, SDKs, and our Cloud are designed to function cohesively.

Admin panel

Includes performance metrics, schema browser, REPL, query IDE, and a data editor for your app.

Secure by default

TLS is seamless and enabled by default. We handle certificates and connection strings for you.

Vercel & GitHub integration

Auto-configure Vercel and enable preview deployments for GitHub PRs.

Soon

Regional replicas

Create read-only copies in various regions and route queries to the nearest replica.

Soon

Performance insights

Slow query log, automatic EXPLAIN, and tailored optimization advice.

A screenshot of EdgeDB Cloud dashboard