Skip to content

pekkah/tanka-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tanka GraphQL

A comprehensive .NET GraphQL library providing a complete GraphQL implementation for .NET applications.

✨ Features

  • 🚀 Execute queries, mutations and subscriptions - Full GraphQL operation support
  • 🔍 Comprehensive validation - Built-in GraphQL specification compliance
  • ⚡ Source code generation - Generate schema types from C# classes with source generators
  • 📝 Modern GraphQL parser - Fast parser for executable and type system documents
  • 🔗 Delegate-based resolvers - Clean resolver implementation with middleware support
  • 🏗️ Middleware pipeline architecture - Modular schema building with extensible middleware stages
  • 🌐 ASP.NET Core server - HTTP/WebSocket transport with real-time subscriptions
  • 🔄 Apollo Federation v2.3 - Full spec compliance with @link directive and type aliasing support
  • 📡 Real-time subscriptions - graphql-ws compatible WebSocket server
  • ⏭️ Incremental delivery - @defer and @stream directives for progressive data loading
  • 🎯 @oneOf directive - Polymorphic input types support (Stage 3 RFC)
  • 🔗 Schema composition - @link directive processing for modular schema development

📖 Documentation

📦 Packages

Nuget Nuget (with prereleases)

Package Description
Tanka.GraphQL Core execution engine
Tanka.GraphQL.Language Parser and AST
Tanka.GraphQL.Server ASP.NET Core server
Tanka.GraphQL.Server.SourceGenerators Code generation

🎯 Examples

Quick Server Setup:

var builder = WebApplication.CreateBuilder(args);

builder.AddTankaGraphQL()
    .AddHttp()
    .AddWebSockets()
    .AddSchema("MyAPI", schema => {
        schema.Add("Query", new FieldsWithResolvers {
            { "hello: String!", () => "Hello World!" }
        });
    });

var app = builder.Build();
app.UseWebSockets();
app.MapTankaGraphQL("/graphql", "MyAPI");
app.Run();

Advanced Examples:

🚀 Quick Start

Installation

Essential packages:

dotnet add package Tanka.GraphQL          # Core GraphQL execution
dotnet add package Tanka.GraphQL.Server   # ASP.NET Core server

Optional packages:

dotnet add package Tanka.GraphQL.Server.SourceGenerators    # Code generation
dotnet add package Tanka.GraphQL.Extensions.ApolloFederation # Federation support

Basic Usage

  1. Create a simple GraphQL server:

    var builder = WebApplication.CreateBuilder(args);
    
    builder.AddTankaGraphQL()
        .AddHttp()
        .AddSchema("Demo", schema => {
            schema.Add("Query", new FieldsWithResolvers {
                { "greeting(name: String!): String!", (string name) => $"Hello, {name}!" }
            });
        });
    
    var app = builder.Build();
    app.MapTankaGraphQL("/graphql", "Demo");
    app.Run();
  2. Test your GraphQL endpoint:

    curl -X POST http://localhost:5000/graphql \
      -H "Content-Type: application/json" \
      -d '{"query": "{ greeting(name: \"World\") }"}'

🏋️ Performance

Run benchmarks to see Tanka GraphQL performance:

cd benchmarks/GraphQL.Benchmarks
dotnet run --configuration Release --framework net9.0

🔧 Requirements

  • .NET 9.0 or later
  • ASP.NET Core 9.0 (for server features)

🤝 Contributing

We welcome contributions! Please see our contribution guidelines for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

GraphQL server and execution libraries

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

Languages