Introduction
EdgeDB is a modern database that combines the strengths of relational and graph databases. It simplifies managing complex data while delivering excellent performance. This tutorial guides you step by step through installing EdgeDB, creating your first schema, and running simple queries. Ideal for developers getting started with this tool in 2026.
Prerequisites
- Node.js 18 or higher
- Basic command-line knowledge
- A code editor like VS Code
Installing EdgeDB
curl https://www.edgedb.com/dist/install.sh | sh
edgedb --versionThis command downloads and installs EdgeDB on your machine. Then verify the version to confirm the installation succeeded.
Initializing the Project
mkdir edgedb-demo
cd edgedb-demo
edgedb project initCreate a dedicated folder and initialize an EdgeDB project. This generates the necessary configuration files.
Defining the Schema
module default {
type User {
required property name -> str;
required property email -> str {
constraint exclusive;
}
}
}This file describes the schema with a User type. The email field is unique thanks to the exclusive constraint.
Applying the Migration
edgedb migration create
edgedb migrateGenerate and apply the migration to create the structure in your EdgeDB database.
Inserting Data
edgedb query "INSERT User { name := 'Alice', email := 'alice@example.com' }"Insert your first user directly via the CLI to test your schema.
Best Practices
- Always use constraints to ensure data integrity
- Separate your schemas into logical modules
- Test migrations in a development environment before production
- Document every type and property
Common Mistakes to Avoid
- Forgetting to run the migrate command after modifying the schema
- Ignoring exclusive constraint errors on unique fields
- Not backing up your EdgeDB instance before major updates
Going Further
Deepen your knowledge with our Learni courses.