---
description:
  Easily generate executable schema for Apache Thrift services with GraphQL Mesh Thrift handler.Get
  started by installing `@graphql-mesh/thrift`.
---

import { Callout } from '@theguild/components'

# Apache Thrift

This handler allows you to consume [Apache Thrift](https://thrift.apache.org) `.thrift` files and
generate a remote executable schema for those services.

To get started, install the handler library:

```sh npm2yarn
npm i @omnigraph/thrift
```

## How to use?

Then you can import the library in your configuration file, and define your Thrift source;

```ts filename="mesh.config.ts" {2,7-13}
import { defineConfig } from '@graphql-mesh/compose-cli'
import { loadThriftSubgraph } from '@omnigraph/thrift'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadThriftSubgraph('Calculator', {
        idl: './src/thrift/calculator.thrift',
        hostName: 'localhost',
        port: 8080,
        path: '/thrift',
        serviceName: 'calculator-service'
      })
    }
  ]
})
```

<Callout>
  [You can find a working example here](
  https://github.com/ardatan/graphql-mesh/tree/main/examples/v1-next/thrify-calculator )
</Callout>
