# Setup To develop with Hero's Elements, you will need to be provided with a **Personal Access Token (PAT)** and an **API key**. To request, please contact Hero support - make sure to specify your use case to enable us to apply the correct scopes to your key. For more information on how to authenticate an Element using your API key, see our [Auth](/pages/elements/authentication) section. ## Guide: Configuring `.npmrc` to Access HeroHealth packages Once you receive your PAT token, you need to configure your `.npmrc` file to authenticate and access the private packages. Follow these steps: ### 1. Edit the `.npmrc` file You should create or modify the `.npmrc` file in the root of your project (or globally in your user directory for broader use). In the `.npmrc` file, add the following configuration: ``` # Use the registry for the @herohealthsoftware scope @herohealthsoftware:registry=https://npm.pkg.github.com/ # Authentication: Use the environment variable for the PAT //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} ``` ### 2. How this works - The `@herohealthsoftware:registry` line tells npm to fetch packages for the `@herohealthsoftware` scope from GitHub's npm registry at `https://npm.pkg.github.com/`. - The `_authToken=${NODE_AUTH_TOKEN}` line instructs npm to use the `NODE_AUTH_TOKEN` environment variable (which contains the PAT) for authentication when accessing this registry. ### 3. Set the `NODE_AUTH_TOKEN` environment variable For this to work, you need to set the `NODE_AUTH_TOKEN` environment variable in your system to the provided PAT. Follow the instructions below to set the environment variable based on your operating system. #### For Linux/macOS 1. Open the terminal. 2. Set the environment variable temporarily: ```bash export NODE_AUTH_TOKEN=YOUR_PAT_HERE ``` 3. To make the change permanent (so it's available for all future terminal sessions), you can add this line to your shell configuration file: - For **bash**, add it to `~/.bashrc`: ```bash echo 'export NODE_AUTH_TOKEN=YOUR_PAT_HERE' >> ~/.bashrc \`` ``` - For **zsh**, add it to `~/.zshrc`: ```bash echo 'export NODE_AUTH_TOKEN=YOUR_PAT_HERE' >> ~/.zshrc ``` 4. After modifying the shell configuration file, reload the shell to apply the changes: ```bash source ~/.bashrc # for bash users source ~/.zshrc # for zsh users ``` #### For Windows 1. Open a Command Prompt or PowerShell window. 2. Set the environment variable temporarily for the current session: ```powershell $env:NODE_AUTH_TOKEN="YOUR_PAT_HERE" ``` 3. To make the change permanent (so the token is available in all sessions), follow these steps: - Press **Win + R**, type `sysdm.cpl`, and press Enter. - Go to the **Advanced** tab, then click **Environment Variables**. - In the **User variables** section, click **New**. - Set the **Variable name** to `NODE_AUTH_TOKEN` and the **Variable value** to your provided PAT. - Click **OK** to save. ### 4. Install packages Once your `.npmrc` file is configured and the PAT is set in your environment, you can now run the following command to install the private package: ```bash npm install @herohealthsoftware/elements npm install @herohealthsoftware/your-package-name ``` This command will authenticate via the `NODE_AUTH_TOKEN` and fetch the package from the GitHub registry.