---
title: How to generate client libraries
llmstxt: true
---

import { ClientTabs, ClientTabItem } from "@components/client-tabs";

This page outlines the steps to build a client library based on your TypeSpec specification. It provides a guide for the whole process from initial API design to the release of SDKs. please visit https://aka.ms/azsdk/dpcodegen.

The best documentation on how to generate can be found using those links:

- https://aka.ms/azsdk/dpcodegen/net
- https://aka.ms/azsdk/dpcodegen/python
- https://aka.ms/azsdk/dpcodegen/java
- https://aka.ms/azsdk/rlc/js (do not use unless for backward compatible or told to do so by the archboard)
- https://aka.ms/azsdk/dpcodegen/js
- https://aka.ms/azsdk/dpcodegen/go

At a glance, add your emitter name to your `package.json`, along with the right options in the `tspconfig.yaml`.

> **NOTE:** Generating all languages from the same folder may be complicated due to the preview status of the emitters and TypeSpec libraries, such as `typespec-azure-core` and `typespec-azure-resource-manager`.
> It is recommended to have a unique language emitter in each `package.json` to avoid conflicts until all emitters and the TypeSpec libraries reach their first stable release.

Modify your `package.json` to include the necessary dependencies for the language emitter(s). Remember to run `npm install` after making changes to the file:

```json
{
  "name": "clients",
  "dependencies": {
    "@typespec/compiler": "latest",
    "@typespec/rest": "latest",
    "@typespec/http": "latest",
    "@azure-tools/typespec-azure-core": "latest",
    "@azure-tools/typespec-autorest": "latest",
    "@azure-tools/typespec-python": "latest",
    "@azure-tools/typespec-java": "latest",
    "@azure-tools/typespec-csharp": "latest",
    "@azure-tools/typespec-ts": "latest",
    "@azure-tools/typespec-go": "latest"
  },
  "private": true
}
```

Always update your `tspconfig.yaml` file rather than passing options through the command line.

```yaml
emit:
  # Emitter for Swagger files with Autorest Extensions
  - "@azure-tools/typespec-autorest"
  # add "@azure-tools/typespec-python" to your package.json to generate Python code
  - "@azure-tools/typespec-python"
  # add "@azure-tools/typespec-java" to your package.json to generate Java code
  - "@azure-tools/typespec-java"
  # add "@azure-tools/typespec-csharp" to your package.json to generate C# code
  - "@azure-tools/typespec-csharp"
  # add "@azure-tools/typespec-ts" to your package.json to generate Typescript code
  - "@azure-tools/typespec-ts"
  # add "@azure-tools/typespec-go" to your package.json to generate Go code
  - "@azure-tools/typespec-go"
options:
  "@azure-tools/typespec-python":
    flavor: azure
  "@azure-tools/typespec-java":
    flavor: azure
  "@azure-tools/typespec-csharp":
    flavor: azure
  "@azure-tools/typespec-ts":
    flavor: azure
  "@azure-tools/typespec-go":
    flavor: azure
```

Several language repositories utilize the `tsp-client` tool to simplify generating client libraries. For more information on the tool, see [Getting started with `tsp-client`](<./../Generate with tsp-client/intro_tsp_client.md>).
