VOOZH about

URL: https://www.nuget.org/packages/FSharp.Grpc.Tools/

⇱ NuGet Gallery | FSharp.Grpc.Tools 0.1.9




FSharp.Grpc.Tools 0.1.9

dotnet add package FSharp.Grpc.Tools --version 0.1.9
 
 
NuGet\Install-Package FSharp.Grpc.Tools -Version 0.1.9
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.Grpc.Tools" Version="0.1.9" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FSharp.Grpc.Tools" Version="0.1.9" />
 
Directory.Packages.props
<PackageReference Include="FSharp.Grpc.Tools" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FSharp.Grpc.Tools --version 0.1.9
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FSharp.Grpc.Tools, 0.1.9"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FSharp.Grpc.Tools@0.1.9
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FSharp.Grpc.Tools&version=0.1.9
 
Install as a Cake Addin
#tool nuget:?package=FSharp.Grpc.Tools&version=0.1.9
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FSharp.Grpc

F# code generation from .proto files. Generates F# records, enums, and discriminated unions with binary and JSON serialization. Generates gRPC server and client stubs.

Documentation

  • — setup, type mapping, JSON, examples
  • — setup, handler signatures, all streaming patterns, testing
  • — setup, client creation, all streaming patterns

Overview

syntax = "proto3";
package example;

message Person {
 string name = 1;
 int32 age = 2;
}
open Example

let alice = { Person.empty with Name = "Alice"; Age = 30 }

let bytes = Person.encode alice
let decoded = Person.decode bytes

let json = Person.encodeJson alice
// {"name":"Alice","age":30}

Getting started

dotnet new console -lang F# -n MyApp
cd MyApp
dotnet add package FSharp.Grpc.Tools.Codegen

Add a proto file and register it in your .fsproj:

<ItemGroup>
 <Protobuf Include="protos/person.proto"/>
</ItemGroup>

Build and use the generated types:

dotnet build
open Example

let request = { Person.empty with Name = "World"; Age = 30 }
let bytes = Person.encode request
let json = Person.encodeJson request

Features

Proto feature F# representation
Scalar fields Record fields
message fields TypeName option
optional scalars scalar option
repeated fields type list
map<K, V> fields Map<K, V>
enum F# enum + companion module
oneof Discriminated union
Well-known types Google.Protobuf.WellKnownTypes
Wrapper types Unwrapped option
Binary serialization encode / decode
JSON serialization encodeJson / decodeJson
gRPC services Server + client stubs

gRPC services

Set GrpcServices metadata to generate server and client stubs:

<Protobuf Include="protos/greeter.proto" GrpcServices="Both"/>

Server

open Greeter
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.DependencyInjection

let handlers: GreeterHandlers =
 { SayHello =
 fun req ctx ->
 task { return { HelloReply.empty with Message = $"Hello {req.Name}!" } } }

let builder = WebApplication.CreateBuilder()
builder.Services.AddGrpc() |> ignore
builder.Services.AddSingleton(GreeterService(handlers)) |> ignore
let app = builder.Build()
app.MapGrpcService<GreeterService>() |> ignore
app.Run()

Client

open Greeter

let run () = task {
 let client = GreeterClient.create "https://localhost:5001"
 let! reply = client.SayHello { HelloRequest.empty with Name = "World" }
 printfn "%s" reply.Message
}

Supported patterns: unary, server streaming, client streaming, bidirectional streaming.

GrpcServices value Messages Server stubs Client stubs
None (default) Yes No No
Server Yes Yes No
Client Yes No Yes
Both Yes Yes Yes

Wire compatibility

Generated code produces the same wire format as C#, Go, Java, Python, and other protobuf implementations. Tested with 50 cross-language serialization tests and 10 cross-language gRPC tests (F# server + C# client, C# server + F# client).

Benchmarks

Apple M3 Max, .NET 10.0:

Binary

Person (2 fields):

Method Mean Allocated
C# Encode 23.26 ns 112 B
F# Encode 22.27 ns 112 B
C# Decode 38.94 ns 256 B
F# Decode 26.86 ns 248 B

ScalarTypes (15 fields):

Method Mean Allocated
C# Encode 111.0 ns 200 B
F# Encode 168.8 ns 264 B
C# Decode 129.2 ns 424 B
F# Decode 139.1 ns 448 B

UserProfile (enum, nested message, repeated, maps, oneof):

Method Mean Allocated
C# Encode 446.9 ns 496 B
F# Encode 442.3 ns 504 B
C# Decode 616.2 ns 2,640 B
F# Decode 546.0 ns 2,752 B

UserProfile, high cardinality (1,000 repeated ints + 100 nested messages — exercises the sub-message decode path):

Method Mean Allocated
C# Decode 6.79 µs 24.95 KB
F# Decode 12.72 µs 82.3 KB

JSON

Person (2 fields):

Method Mean Allocated
C# JSON Encode 124.39 ns 568 B
F# JSON Encode 99.51 ns 944 B
C# JSON Decode 202.54 ns 560 B
F# JSON Decode 186.27 ns 216 B

ScalarTypes (15 fields):

Method Mean Allocated
C# JSON Encode 1,233.0 ns 3.2 KB
F# JSON Encode 659.9 ns 6.91 KB
C# JSON Decode 1,938.9 ns 3.45 KB
F# JSON Decode 1,129.7 ns 1.27 KB

UserProfile (enum, nested message, repeated, maps, oneof):

Method Mean Allocated
C# JSON Encode 1,704.0 ns 4.56 KB
F# JSON Encode 931.8 ns 7.69 KB
C# JSON Decode 2,712.5 ns 6.42 KB
F# JSON Decode 2,153.9 ns 4.28 KB

Requirements

  • .NET 8.0 SDK or later
  • protoc is resolved automatically from the Grpc.Tools NuGet package

Limitations

  • Proto3 only. Proto2 syntax is not supported.
  • The deprecated group field type is rejected.

License

MIT. See .


Developed with Claude Code.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.9 98 5/25/2026
0.1.7 101 5/24/2026
0.1.6 90 5/23/2026
0.1.5 91 5/23/2026
0.1.4 103 5/23/2026
0.1.3 117 3/22/2026
0.1.2 123 3/22/2026
0.1.1 131 3/15/2026
0.1.0 114 3/15/2026