> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-alberto-router-651-remove-netpoll.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate

> Generate a protobuf definition for a gRPC service from a GraphQL schema

# wgc grpc-service generate

The `generate` command generates a protobuf definition and mapping file for a gRPC service from a GraphQL schema,
which can be used to implement a gRPC service and can be used for the composition.

## Usage

```bash theme={"system"}
wgc grpc-service generate [options] [service-name]
```

## Arguments

| Argument | Description | Default |
| - | - | - |
| `service-name` | Name of the gRPC service | `service.v1` |

## Options

| Option | Description | Default |
| - | - | - |
| `-i, --input <path-to-input>` | The GraphQL schema file to generate a protobuf schema from | Required |
| `-o, --output <path-to-output>` | The output directory for the protobuf schema | `.` |
| `-p, --package-name <name>` | The name of the proto package | `service.v1` |
| `-g, --go-package <name>` | Adds an `option go_package` to the proto file | None |

## Description

This command generates a protobuf definition for a gRPC service from a GraphQL schema.

## Examples

### Generate a protobuf definition for a gRPC service from a GraphQL schema

```bash theme={"system"}
wgc grpc-service generate -i ./schema.graphql -o ./service MyService
```

### Define a custom package name

```bash theme={"system"}
wgc grpc-service generate -i ./schema.graphql -o ./service MyService --package-name my.custom.package
```

### Define a custom go package name

```bash theme={"system"}
wgc grpc-service generate -i ./schema.graphql -o ./service MyService --go-package github.com/wundergraph/cosmo/service/my-service
```

## Output

The command generates multiple files in the output directory:

* `service.proto`: The protobuf definition for the gRPC service
* `service.mapping.json`: The mapping file for the gRPC service
* `service.proto.lock.json`: The lock file for the protobuf definition

The generated protobuf definition can be used to implement a gRPC service in any language that supports protobuf.

The mapping and the protobuf definition is needed for the composition part.

See also: [gRPC Services](/router/gRPC/grpc-services) · [GraphQL Support for gRPC Integration](/router/gRPC/graphql-support)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.