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.
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});
Write complex queries at the speed of thought.
Fully type-safe query language and schema.
Learn once and build with any software stack.
EdgeDB's client libraries, network protocol, and query language are designed for performance.
EdgeDB fixes fundamental flaws of SQL and legacy DBs in serverless. The perfect fit for Next.js and Vercel.
EdgeDB's powerful querying is what we wanted to build into Firebase and never got there. I'm excited!
The most high tech companies in the world run graph architectures on top of SQL. Now you, too, can be high tech.
I've been continually impressed by both the ideas behind EdgeDB and the way they've been brought to life.
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!
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.
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.
Store and query your application and vector data in one database.
Use the full RAG or only the deferred AI index functionality.
Chat with your database via the built-in graphical UI.
EdgeDB comes with a complete built-in auth solution. OAuth, passwords, passwordless, email, notifications — all covered.
Enable the built-in login UI flow, or craft your own with our SDK.
Auth works with Schema Access Policies for robust data security.
Included in the core with no hidden charges — support unlimited users.
EdgeDB sends emails for password resets, registration, and more.
Passkeys, WebAuthn, magic links... we've got it all.
EdgeDB Cloud is designed alongside both EdgeDB and its tooling to deliver the very best cloud database experience.
EdgeDB, its core tools, SDKs, and our Cloud are designed to function cohesively.
Includes performance metrics, schema browser, REPL, query IDE, and a data editor for your app.
TLS is seamless and enabled by default. We handle certificates and connection strings for you.
Auto-configure Vercel and enable preview deployments for GitHub PRs.
Create read-only copies in various regions and route queries to the nearest replica.
Slow query log, automatic EXPLAIN, and tailored optimization advice.