---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configure-npm.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/configure-npm.md
  - href: en/sourcecraft/operations/configure-npm.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Configuring npm to work with a SourceCraft registry

1. [Create](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/pat.md#create) a personal access token (PAT).
1. Open the `.npmrc` file in the project root.
1. Add the following lines to the previously created `.npmrc` file:

    ```text
    registry=https://pkg.sourcecraft.tech/npm/<organization_slug>/<registry_ID>/
    //pkg.sourcecraft.tech/npm/<organization_slug>/<registry_ID>/:_authToken=${NPM_AUTH_TOKEN}
    always-auth=true
    ```

    <!-- source: en/_includes/sourcecraft/get-slug-registry-id-notice.md -->
    {% note tip %}

    You can find the organization slug and registry ID on the registry page in the SourceCraft UI.

    {% endnote %}
    <!-- endsource: en/_includes/sourcecraft/get-slug-registry-id-notice.md -->

1. Create the `NPM_AUTH_TOKEN` environment variable containing the previously obtained personal access token:

    ```bash
    export NPM_AUTH_TOKEN=<personal_access_token>
    ```

#### Useful links {#see-also}

* [SourceCraft resource relationships](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md)
* [Creating a registry in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/packages-management.md)
* [Connecting a registry to a SourceCraft repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/connect-registry.md)
* [Configuring Maven to work with a SourceCraft registry](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configure-maven.md)
* [Configuring NuGet to work with a SourceCraft registry](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configure-nuget.md)
* [Configuring PyPI to work with the SourceCraft registry](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configure-pypi.md)
* [Configuring Docker to work with a SourceCraft registry](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configure-docker.md)
