Skip to the content.

A zero-dependency, schema-less GraphQL query builder for .NET. Compose queries and mutations from C# with a fluent API, merge fragments at runtime, and extract subsets via field-path or LINQ expression — without an SDL or codegen step.

NuGet Downloads Build Line coverage Branch coverage License

dotnet add package NGql.Core

What you get


Quick taste

using NGql.Core;
using NGql.Core.Builders;

var idVar = new Variable("$id", "ID!");

var query = QueryBuilder.CreateDefaultBuilder("GetUser")
    .AddField("user",
        new Dictionary<string, object?> { ["id"] = idVar },
        new[] { "id", "name", "email" });

Console.WriteLine(query);
query GetUser($id:ID!){
    user(id:$id){
        email
        id
        name
    }
}

Mutations use CreateMutationBuilder("Op") with the same fluent surface. Inline fragments use b.OnType("Repository", r => …) for union narrowing. Field preservation uses PreservationBuilder.Create(src).Preserve("user.name").Build().


Where to next

   
Install NuGet package, optional CLI tool, optional Claude Code skill — pick what you need.
Skill The companion Claude Code skill that translates “build me a query for X” → working NGql code. Two channels in the dolifer plugin marketplace: stable (ngql) (coming soon) · preview (ngql-preview) (live).
Coverage Full coverage report for the Core namespace. Currently ~99.9% line / 99% branch.
CHANGELOG What’s in 2.1, what changed from 2.0.
README on GitHub Long-form docs with runnable examples for every API.
Source Issues, PRs, the codebase itself.

Status

   
Latest stable See the NuGet badge above. The library uses GitVersion-driven SemVer; previews ship as <X.Y.Z>-preview.N.
Companion tool dotnet-ngql — compiles a snippet, renders the GraphQL, optionally executes against a live endpoint.
Companion skill ngql (stable, coming soon) and ngql-preview (preview, live) — Claude Code skills in the dolifer plugin marketplace. Both can coexist in one session.
Min runtime .NET 8.0

License: MIT.