DEV Community

Alex Spinov
Alex Spinov

Posted on

EdgeDB Has a Free API You've Never Heard Of

EdgeDB is a next-generation database built on PostgreSQL. It replaces SQL with EdgeQL — a composable query language that eliminates JOINs, makes nested queries natural, and provides full type safety.

What Makes EdgeDB Special?

  • EdgeQL — no JOINs, composable, type-safe
  • Schema-first — declare types, get migrations auto-generated
  • Built on Postgres — production-proven storage engine
  • Built-in auth — OAuth, email/password out of the box
  • Free tier — EdgeDB Cloud free tier available

The Hidden API: EdgeQL

# Schema definition
type User {
  required name: str;
  required email: str { constraint exclusive; };
  multi posts: Post;
  multi followers: User;
  created_at: datetime { default := datetime_current(); };
}

type Post {
  required title: str;
  required content: str;
  required author: User;
  multi tags: Tag;
  published: bool { default := false; };
  views: int64 { default := 0; };
}

# Query — no JOINs needed!
select Post {
  title,
  content,
  author: { name, email },
  tags: { name },
  views
}
filter .published = true and .author.name = 'Alice'
order by .views desc
limit 10;

# Insert with nested data
insert Post {
  title := 'EdgeDB is Amazing',
  content := 'Here is why...',
  author := (select User filter .email = 'alice@example.com'),
  tags := (select Tag filter .name in {'database', 'edgeql'})
};
Enter fullscreen mode Exit fullscreen mode

TypeScript Client — Full Type Safety

import { createClient } from 'edgedb';
import e from './dbschema/edgeql-js';

const client = createClient();

// Fully typed — autocomplete for schema and return types
const posts = await e.select(e.Post, (post) => ({
  title: true,
  content: true,
  author: { name: true },
  tags: { name: true },
  filter: e.op(post.published, '=', true),
  order_by: { expression: post.views, direction: e.DESC },
  limit: 10
})).run(client);

// posts is fully typed: { title: string; content: string; author: { name: string }; ... }[]
Enter fullscreen mode Exit fullscreen mode

Built-in Auth API

// EdgeDB Cloud includes authentication
const auth = createAuth(client, {
  baseUrl: 'https://your-app.edgedb.cloud'
});

// Email/password signup
await auth.emailPasswordSignUp({ email: 'user@example.com', password: 'secret' });

// OAuth — built-in providers
await auth.signInWithOAuth('github');
Enter fullscreen mode Exit fullscreen mode

Quick Start

curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh
edgedb project init
edgedb migration create && edgedb migrate
Enter fullscreen mode Exit fullscreen mode

Why Teams Choose EdgeDB

A developer shared: "We had 15 SQL JOINs in one query. In EdgeQL, it's a simple nested select. Our query code went from 80 lines of SQL to 12 lines of EdgeQL, and it's actually readable now."


Need database tools? Email spinov001@gmail.com or check my solutions.

SQL or EdgeQL? How do you handle complex queries?

Top comments (0)