Description
This is an implementation of Facebook's GraphQL in .NET.
This project uses a lexer/parser originally written by Marek Magdziak and released with a MIT license. Thank you Marek!
GraphQL for .NET alternatives and similar packages
Based on the "API" category.
Alternatively, view GraphQL for .NET alternatives based on common mentions on social networks and blogs.
-
NancyFx
DISCONTINUED. Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono. Note: This project is no longer maintained and has been archived. -
Hot Chocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE. -
WexFlow
DISCONTINUED. An easy and fast way to build automation and workflows on Windows, Linux, macOS, and the cloud. -
Xamarin.Essentials
DISCONTINUED. Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials. -
FFImageLoading - Fast & Furious Image Loading
Image loading, caching & transforming library for Xamarin and Windows -
JsonApiDotNetCore
A framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core. -
SapphireDb
SapphireDb Server, a self-hosted, easy to use realtime database for Asp.Net Core and EF Core -
🎨 Awesome .Net Core Education
DISCONTINUED. A curated list of awesome articles and resources for learning and practicing .Net Core and its related technologies. -
Lib.AspNetCore.ServerSentEvents
Lib.AspNetCore.ServerSentEvents is a library which provides Server-Sent Events (SSE) support for ASP.NET Core -
EISK Web API
Project based on latest .NET (v6.0) technologies for building scalable web api, along with clean architecture patterns. -
RedditSharp
DISCONTINUED. C# Implementation of the Reddit API. This is an ("unofficial") Fork of SirCmpwn/RedditSharp with Nuget package/support. -
CommandQuery
Command Query Separation for 🌐ASP.NET Core ⚡AWS Lambda ⚡Azure Functions ⚡Google Cloud Functions -
Cloud Storage
Storage library provides a universal interface for accessing and manipulating data in different cloud blob storage providers -
Lib.Web.Mvc
Lib.Web.Mvc is a library which contains some helper classes for ASP.NET MVC such as strongly typed jqGrid helper, attribute and helper providing support for HTTP/2 Server Push with Cache Digest, attribute and helpers providing support for Content Security Policy Level 2, FileResult providing support for Range Requests, action result and helper providing support for XSL transformation and more. -
FileUltimate
FileUltimate is an ASP.NET File Manager and an ASP.NET File Uploader which supports ASP.NET Core 5.0+, ASP.NET Core 2.1+, ASP.NET MVC 3.0+ and ASP.NET WebForms 4.7.2+ web applications/web sites. -
Juka
🥣 Juka Programming Language - Fast Portable Programming Language. Run code anywhere without complicated installations and admin rights. Simple, yet powerful new programming language [Easy to code and run on any system] IOT devices supported! -
ابزار Persian Tools
Persian Tools for .NET Framework and .NET Core: Shamsi date convertor, All Iranian calendar holidays. Iranian City and provinces, Iranian national ID verification. -
Gamepad-Controller-Test
Gamepads are often used as replacements for Mouse / Keyboard. While it is not possible to use them with every game, there are several games available that support gamepad controls, especially console ports of PC titles or even games designed for gamepad controls in the first place. To ensure maximum compatibility, Windows uses a default gamepad driver which supports a wide variety of gamepads. The most notable exception is the Xbox controllers, which still use XBCD for their enhanced features (e.g., force feedback). Therefore I have decided to make an easy test for gamers to test their gamepad controller devices on the go online without wasting any time trying to install third-party softwares which are usually out of order on their PCs to get the job done. This project is inspired by the work of @greggman and tweaks his work a little bit for a better user experience, all credit goes to him for this amazing work and for making my job easy. -
How to Create Interactive Table View in SwiftUI
This is as example app for demonstration of latest 'Table' view api of SwiftUI -
Developer Exception Json Response Middleware
Http Middleware Extensions for ASP.NET Core application -
VideoUltimate
VideoUltimate is a .NET Video Reader and a .NET Video Thumbnailer which can read any video file format on the planet. It supports .NET 5.0+ or .NET Core 2.0+ and .NET Framework 4.7.2+ web/console/desktop applications. -
ASP.NET Web API
Framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices -
ASP.NET WebAPI
Framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of GraphQL for .NET or a related project?
README
GraphQL for .NET
This is an implementation of Facebook's GraphQL in .NET.
Now the specification is being developed by the GraphQL Foundation.
This project uses a lexer/parser originally written by Marek Magdziak and released with a MIT license. Thank you Marek!
Provides the following packages:
Package | Downloads | NuGet Latest |
---|---|---|
GraphQL | ||
GraphQL.SystemTextJson | ||
GraphQL.NewtonsoftJson | ||
GraphQL.MemoryCache | ||
GraphQL.DataLoader | ||
GraphQL.MicrosoftDI |
You can get all preview versions from GitHub Packages. Note that GitHub requires authentication to consume the feed. See here.
Documentation
- http://graphql-dotnet.github.io - documentation site that is built from the docs folder in the
master
branch. - https://graphql.org/learn - learn about GraphQL, how it works, and how to use it.
Debugging
All packages generated from this repository come with embedded pdb and support Source Link. If you are having difficulty understanding how the code works or have encountered an error, then it is just enough to enable Source Link in your IDE settings. Then you can debug GraphQL.NET source code as if it were part of your project.
Installation
1. GraphQL.NET engine
This is the main package, the heart of the repository in which you can find all the necessary classes for GraphQL request processing.
> dotnet add package GraphQL
2. Serialization
For serialized results, you'll need an IGraphQLSerializer
implementation.
We provide several serializers (or you can bring your own).
> dotnet add package GraphQL.SystemTextJson
> dotnet add package GraphQL.NewtonsoftJson
Note: You can use
GraphQL.NewtonsoftJson
with .NET Core 3+, just be aware it lacks async writing capabilities so writing to an ASP.NET Core 3.0HttpResponse.Body
will require you to setAllowSynchronousIO
totrue
as per this announcement; which isn't recommended.
3. Document Caching
The recommended way to setup caching layer (for caching of parsed GraphQL documents) is to
inherit from IConfigureExecution
interface and register your class as its implementation.
We provide in-memory implementation on top of Microsoft.Extensions.Caching.Memory
package.
> dotnet add package GraphQL.MemoryCache
For more information see Document Caching.
4. DataLoader
DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.
> dotnet add package GraphQL.DataLoader
For more information see DataLoader.
Note: Prior to version 4, the contents of this package was part of the main GraphQL.NET package.
5. Subscriptions
DocumentExecuter
can handle subscriptions as well as queries and mutations.
For more information see Subscriptions.
6. Advanced Dependency Injection
Also we provide some extra classes for advanced dependency injection usage on top of
Microsoft.Extensions.DependencyInjection.Abstractions
package.
> dotnet add package GraphQL.MicrosoftDI
For more information see Thread safety with scoped services.
Examples
https://github.com/graphql-dotnet/examples
You can also try an example of GraphQL demo server inside this repo - [GraphQL.Harness](src/GraphQL.Harness/GraphQL.Harness.csproj). It supports the popular IDEs for managing GraphQL requests and exploring GraphQL schema:
Training
- API Development in .NET with GraphQL - Glenn Block demonstrates how to use the GraphQL.NET framework to build a fully functional GraphQL endpoint.
- Building GraphQL APIs with ASP.NET Core by Roland Guijt
Upgrade Guides
You can see the changes in public APIs using fuget.org.
Basic Usage
Define your schema with a top level query object then execute that query.
Fully-featured examples can be found here.
Hello World
using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Types;
using GraphQL.SystemTextJson; // First add PackageReference to GraphQL.SystemTextJson
var schema = Schema.For(@"
type Query {
hello: String
}
");
var root = new { Hello = "Hello World!" };
var json = await schema.ExecuteAsync(_ =>
{
_.Query = "{ hello }";
_.Root = root;
});
Console.WriteLine(json);
Schema First Approach
This example uses the GraphQL schema language. See the documentation for more examples and information.
public class Droid
{
public string Id { get; set; }
public string Name { get; set; }
}
public class Query
{
[GraphQLMetadata("droid")]
public Droid GetDroid()
{
return new Droid { Id = "123", Name = "R2-D2" };
}
}
var schema = Schema.For(@"
type Droid {
id: ID
name: String
}
type Query {
droid: Droid
}
", _ => {
_.Types.Include<Query>();
});
var json = await schema.ExecuteAsync(_ =>
{
_.Query = "{ droid { id name } }";
});
Parameters
public class Droid
{
public string Id { get; set; }
public string Name { get; set; }
}
public class Query
{
private List<Droid> _droids = new List<Droid>
{
new Droid { Id = "123", Name = "R2-D2" }
};
[GraphQLMetadata("droid")]
public Droid GetDroid(string id)
{
return _droids.FirstOrDefault(x => x.Id == id);
}
}
var schema = Schema.For(@"
type Droid {
id: ID
name: String
}
type Query {
droid(id: ID): Droid
}
", _ => {
_.Types.Include<Query>();
});
var json = await schema.ExecuteAsync(_ =>
{
_.Query = $"{{ droid(id: \"123\") {{ id name }} }}";
});
Roadmap
Grammar / AST
- Grammar and AST for the GraphQL language should be compatible with the October 2021 specification.
Operation Execution
- [x] Scalars
- [x] Objects
- [x] Lists of objects/interfaces
- [x] Interfaces
- [x] Unions
- [x] Arguments
- [x] Variables
- [x] Fragments
- [x] Directives
- [x] Include
- [x] Skip
- [x] Custom
- [x] Enumerations
- [x] Input Objects
- [x] Mutations
- [x] Subscriptions
- [x] Async execution
Validation
- [x] Arguments of correct type
- [x] Default values of correct type
- [x] Fields on correct type
- [x] Fragments on composite types
- [x] Known argument names
- [x] Known directives
- [x] Known fragment names
- [x] Known type names
- [x] Lone anonymous operations
- [x] No fragment cycles
- [x] No undefined variables
- [x] No unused fragments
- [x] No unused variables
- [x] Overlapping fields can be merged
- [x] Possible fragment spreads
- [x] Provide non-null arguments
- [x] Scalar leafs
- [x] Unique argument names
- [x] Unique directives per location
- [x] Unique fragment names
- [x] Unique input field names
- [x] Unique operation names
- [x] Unique variable names
- [x] Variables are input types
- [x] Variables in allowed position
- [x] Single root field
Schema Introspection
GraphQL.NET supports introspection schema from October 2021 spec with some additional experimental introspection extensions.
Publishing NuGet packages
The package publishing process is automated with GitHub Actions.
After your PR is merged into master
or develop
, preview packages are published to GitHub Packages.
Stable versions of packages are published to NuGet when a release is created.
Contributors
This project exists thanks to all the people who contribute.
PRs are welcome! Looking for something to work on? The list of open issues is a great place to start. You can help the project simply respond to some of the asked questions.
The default branch is master
. It is designed for non-breaking changes, that is to publish versions 7.x.x.
If you have a PR with some breaking changes, then please target it to the develop
branch that tracks changes for v8.0.0.
Backers
Thank you to all our backers! 🙏 Become a backer.
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Become a sponsor.
*Note that all licence references and agreements mentioned in the GraphQL for .NET README section above
are relevant to that project's source code only.