Skip to main content
Gel (formerly EdgeDB) is a graph-relational database built on Postgres. It provides a declarative schema language, migrations system, and object-oriented query language, and also supports raw SQL queries. It solves object-relational mapping at the database layer, so your application code doesn’t need an ORM library.
First, install Gel if you haven’t already.

Use bun init to create a fresh project.
terminal

Initialize a Gel instance for the project with the Gel CLI. The gel project init command creates a gel.toml file in the project root.
terminal

To check that the database is running, open a REPL and run a query.
terminal
Then run \quit to exit the REPL.
terminal

Next, define a schema. The gel project init command already created a dbschema/default.esdl file to hold it.
File Tree

Open that file and paste the following contents.
default.esdl

Then generate and apply an initial migration.
terminal
terminal

With the schema applied, query the database with Gel’s JavaScript client library. Install the client library and Gel’s codegen CLI, then create a seed.ts file.
terminal

Paste the following code into seed.ts. The client auto-connects to the database. The script inserts a few movies with the .execute() method, using EdgeQL’s for expression to turn the bulk insert into a single query.
seed.ts

Then run this file with Bun.
terminal

Gel implements several code generation tools for TypeScript. To write typesafe queries against the seeded database, generate the EdgeQL query builder with @gel/generate.
terminal

In index.ts, import the generated query builder from ./dbschema/edgeql-js and write a select query.
index.ts

Run the file with Bun to see the movies you inserted.
terminal

See the Gel docs.