Build a gRPC router plugin
build
command generates gRPC code based on your GraphQL schema and compiles your plugin into platform-specific binaries.
Argument | Description | Default |
---|---|---|
directory | Directory of the plugin | . (current directory) |
Option | Description | Default |
---|---|---|
--generate-only | Generate only the proto and mapping files, do not compile the plugin | false |
--go-module-path <path> | Go module path to use for the plugin | github.com/wundergraph/cosmo/plugin |
--debug | Build the binary with debug information for use with debuggers | false |
--platform [platforms...] | Platform-architecture combinations (e.g., darwin-arm64 linux-amd64) | Host platform |
--all-platforms | Build for all supported platforms | false |
--skip-tools-installation | Skip tool installation | false |
--force-tools-installation | Force tools installation regardless of version check or confirmation | false |
--generate-only
flag.
--skip-tools-installation
and --force-tools-installation
flags.
For debugging your plugin, use the --debug
flag to build with debug symbols. This enables debugging with tools like Delve, GoLand, or VS Code. See the debugging guide for detailed instructions.
You can also install the dependencies manually and use an IDE with Go support. The following table shows the current versions and download links for the required tools:
Tool | Version | Installation Link |
---|---|---|
Go | >=1.22.0 (Last 2 versions) | Releases |
Protocol Buffers (protoc) | ^29.3 | Releases |
protoc-gen-go | ^1.34.2 | GitHub Releases |
protoc-gen-go-grpc | ^1.5.1 | GitHub Releases |
Platform | Description | When to use |
---|---|---|
linux-amd64 | Linux on 64-bit Intel/AMD processors | Most Linux servers, including AWS EC2, Google Cloud, Azure VMs |
linux-arm64 | Linux on 64-bit ARM processors | ARM-based servers, AWS Graviton instances, Raspberry Pi 4 |
darwin-amd64 | macOS on Intel processors | Intel-based Mac development machines |
darwin-arm64 | macOS on Apple Silicon (M1/M2) | Apple Silicon Mac development machines |
windows-amd64 | Windows on 64-bit Intel/AMD processors | Windows servers or development machines |
--all-platforms
flag, binaries for all of the above platforms will be built.
generated/
directorybin/
directory, named according to the target platform (e.g., my-plugin-darwin-arm64
, my-plugin-linux-amd64
)--platform linux-amd64
during the build process. Using an incompatible plugin binary will result in runtime errors when the router attempts to load the plugin.