Skip to content
Docs

Getting Started

Create a new ASP.NET Core project and add the BifrostQL packages:

Terminal window
dotnet new web -n MyBifrostApi
cd MyBifrostApi
dotnet add package BifrostQL.Server
dotnet add package BifrostQL.SqlServer # or BifrostQL.Ngsql, BifrostQL.MySql

Add your connection string and BifrostQL settings to appsettings.json:

{
"ConnectionStrings": {
"bifrost": "Server=localhost;Database=mydb;User Id=sa;Password=xxx;TrustServerCertificate=True"
},
"BifrostQL": {
"Path": "/graphql",
"Playground": "/graphiql",
"DisableAuth": true,
"Provider": "sqlserver"
}
}

Replace sqlserver with postgres or mysql if you’re using a different database.

Replace the contents of Program.cs:

using BifrostQL.Server;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBifrostQL(o => o.BindStandardConfig(builder.Configuration));
builder.Services.AddCors();
var app = builder.Build();
app.UseCors(x => x.AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin());
app.UseBifrostQL();
await app.RunAsync();

That’s the entire application. BifrostQL reads your database schema at startup and generates the complete GraphQL API.

Terminal window
dotnet run

Open http://localhost:5000/graphiql for the GraphQL playground. The API endpoint is at http://localhost:5000/graphql.

If your database has a users table, you can query it immediately:

{
users(limit: 10, sort: [name_asc]) {
data {
userId
name
email
}
}
}

Every query uses the paged format: the table name takes limit, offset, sort, and filter arguments, and results are nested inside a data field.

BifrostQL also ships as a standalone CLI tool for quick schema inspection and local serving:

Terminal window
dotnet tool install -g BifrostQL.Tool
bifrost serve --connection "Server=localhost;Database=mydb;..."
bifrost schema --connection "..."
bifrost config generate --connection "..."

bifrost serve starts a local GraphQL server without writing any project files. Useful for exploring a database schema before committing to a project structure.

  • Schema Generation — how BifrostQL maps database types to GraphQL
  • Queries — filtering, sorting, and pagination
  • Joins — automatic and explicit table joins
  • Mutations — insert, update, upsert, delete