---
updatedAt: 2026-11-04T11:57:20.000Z
agentTools:
  siteIndex: https://docs.jfrog.com/llms.txt
  projectIndex: https://docs.jfrog.com/artifactory/llms.txt
---

# Hex Repositories

The JFrog Artifactory integration with Hex allows you to manage Hex packages in Artifactory. Hex is a package manager for the BEAM ecosystem. It supports any programming language that compiles to run on the BEAM VM, such as Elixir and Erlang. For more information, see <Anchor label="Hex documentation" target="_blank" href="https://hex.pm/docs/usage">Hex documentation</Anchor>.

![art-hex-package-10-13.png](https://files.readme.io/34c390df12cd1898d31854fb56505eb8974d15acbf6a1036a1577b82feefd17f-uuid-af080f74-07b5-df48-ad0a-38c7890d5542.png)

Artifactory fully supports Hex repositories, including the following capabilities:

* **RSA Key Pair Management**: Secure protobuf-encoded package transfer between Artifactory, upstream Hex registries, and the Mix client using configurable RSA key pairs.
* **Unified Repository Management**: Consolidate Hex packages with local repositories for first- and second-party packages, remote repositories that proxy `hex.pm` or self-hosted Hex servers, and virtual repositories that aggregate multiple sources behind a single URL.
* **Mix Client Integration**: Connect the Mix client to local, remote, and virtual Hex repositories to deploy and resolve Elixir and Erlang packages.
* **Upstream Registry Proxy and Caching**: Proxy the public Hex.pm registry or private self-hosted Hex servers through remote repositories, with automatic population of the upstream registry public key for `hex.pm`.
* **Fine-Grained Access Control**: Apply permissions to Hex repository layout folders (installs, packages, tarballs) using include and exclude patterns.

## Get Started with Hex

To get started working with Hex, complete the following main steps:

1. <Anchor label="Generate and Upload RSA Key Pair" title="Generate and Upload RSA Key Pair" href="#generate-and-upload-rsa-key-pair">Generate and Upload RSA Key Pair</Anchor>
2. <Anchor label="Create a Hex Repository" title="Create a Hex Repository" href="#create-a-hex-repository">Create a Hex Repository</Anchor>
3. [Download Public Key to Hex Project Folder](#download-public-key-to-hex-project-folder)
4. [Connect Mix to Artifactory](#connect-mix-to-artifactory)
5. [Deploy](#deploy-hex-packages) and <Anchor label="Resolve" title="Resolve Hex Packages" href="#resolve-hex-packages">Resolve</Anchor> Hex Packages

   ![](https://files.readme.io/f7349811befa0f7e78d4f6a5f1668c36b4c8c0cd108b51676d32279565e6266f-uuid-f5cd2df9-324a-b14b-1c57-01c1b390e41e.png)

## Hex Repository Prerequisites

The Hex package manager is unique as it uses protobuf encoding for efficient binary sizing and performance. This means that every Hex package is encrypted by the server and decrypted by the client/proxy server using an RSA public key.

**[Generate and upload RSA key pair to Artifactory](#generate-and-upload-rsa-key-pair)**: These RSA keys will be assigned to your Hex repositories to encode the content for transfer to the Mix client.

For Artifactory to support the following you must meet the above prerequisite before proceeding with creating repositories:

* **<Anchor label="Provide the Hex upstream registry public key" title="Create a Hex Repository" href="#create-a-hex-repository">Provide the Hex upstream registry public key</Anchor>**

  This is entered during the remote repository creation and used to decrypt the package content being downloaded from the upstream registry to Artifactory.

<Callout icon="📘" theme="info">
  **Note**

  When using the Hex.pm public registry we auto-populate this value for you. For self-hosted Hex servers, you are required to provide the public key manually in the repository setup.
</Callout>

* **<Anchor label="Place the Artifactory public key within your Hex Project" title="Download Public Key to Hex Project Folder" href="#download-public-key-to-hex-project-folder">Place the Artifactory public key within your Hex Project</Anchor>**

  This is required according to the Mix client specification to allow the Mix client to validate and decrypt the package content from Artifactory.

### Generate and Upload RSA Key Pair

This topic describes generating and uploading an RSA key pair to Artifactory. RSA keys are used for secure authentication when interacting with repositories, ensuring encrypted communication between clients and the artifactory.

Generate an RSA key pair, upload the public key to Artifactory, and configure it to streamline your development and deployment workflows.

To use the mix client with Artifactory, you must authenticate the client using an RSA key.

#### Understanding RSA Key Pairs in Hex Package Management

![RSAKeyPairs.png](https://files.readme.io/505bd35ee382d7f0866f8b032aa126bafcde54deb4531e9437b5c5efc663a9d4-uuid-5b85ce84-2a6c-c4eb-d694-d1df7280dd7e.png)

Hex uses Protobuf encoding for efficient binary sizing and performance. To download Hex packages, you must provide a public key in your project. This key allows the Mix client to validate the content from the registry and is used to encrypt and decrypt the data.

When using Artifactory as a middleman for Hex packages, you need two sets of RSA key pairs:

* **External Keys**: These keys are required to access the remote Hex registry (public, private, or self-hosted hex server). Each Hex registry has its own public and private key pair. You must enter the public key while creating the remote repository in Artifactory.
* **Internal Keys**: These keys allow the mix client to access Artifactory, which acts as a Hex server. You can set up the internal keys in Artifactory under **Security** | **Keys Management** | **RSA Key Pair**. Assign this key pair to the remote repository.

By using two sets of keys, we ensure secure communication between your project, Artifactory, and the external Hex registry.

To learn how to generate and upload an RSA key pair, refer to the [Setting Up RSA Key Pairs](/installation/docs/rsa-key-pairs#setting-up-rsa-key-pairs)

To learn more, refer to the [RSA Key Pairs](/installation/docs/rsa-key-pairs).

**Next steps**

* [Create a Hex Repository](#create-a-hex-repository) .

## Create a Hex Repository

This topic describes how to create a Hex Repository. This is required before publishing and installing Hex packages. There are three primary types of repositories:

* **Local repositories**: Where you store and share 1st and 2nd party packages with your organization
* **Remote repositories**: Enable you to download from any remote location including external package registries or other Artifactory instances
* **Virtual repositories**: Enable aggregating remote and local repositories enabling your organization to scale by providing a single URL that provides access to multiple repositories and types

For more information on JFrog repositories, see [Repository Management](https://docs.jfrog.com/artifactory/docs/repository-management).

**Prerequisite**: You need Admin or Project Admin permissions to create a Hex repository. If you don't have Admin permissions, the option will not be available.

**To create a Hex repository**:

1. In the **Administration** tab, click **Repositories | Create a Repository**

   ![CreateAnsibleLocal1.png](https://files.readme.io/b02eb36eb4afad9821c963279b44bd3db6e080afe847bb6a99b57bcd0b35e4de-uuid-ae0a9517-c524-8487-f4f9-315e244ac422.png)
2. Select the repository type you want to create, configure the required fields:

   * For **Local Repositories**, in the **Repository Key** field type a meaningful name for the repository. For example, `hex-local-repository-1`. For more information on local repositories and all their possible settings, see <Anchor label="Local Repositories" target="_blank" href="/artifactory/docs/local-repositories">Local Repositories</Anchor>.
   * For **Remote Repositories**, additionally verify the **Repository URL** and update if needed. For more information on Remote Repositories and all its possible settings, see <Anchor label="Remote Repositories" target="_blank" href="/artifactory/docs/remote-repositories">Remote Repositories</Anchor>.
   * For **Virtual Repositories**, additionally **select one or more local or remote repository types** to include in the virtual repository. For more information on virtual repositories and all its possible settings, see <Anchor label="Virtual Repositories" target="_blank" href="/artifactory/docs/virtual-repositories">Virtual Repositories</Anchor>.
3. For **RSA Key Pair**, select the RSA key you would like to use from the drop-down menu. This key is used for the protobuf encoding to communicate with your mix client.
4. Click **Create Repository**. The repository is created, and the Repositories window is displayed.

**Next steps**

* [Connect Mix to Artifactory](#connect-mix-to-artifactory)

## Connect Mix to Artifactory

This topic provides details on configuring Hex to work with Artifactory using the Mix client. To get up and running quickly to use Hex see <Anchor label="Get Started with Hex" title="Get Started with Hex" href="#get-started-with-hex">Get Started with Hex</Anchor>.

Mix is the Artifactory-supported build tool for Elixir and OTP projects. `rebar3` is not supported.

**Prerequisites**:

* An existing Hex repository in Artifactory. For more information, see <Anchor label="Create a Hex Repository" title="Create a Hex Repository" href="#create-a-hex-repository">Create a Hex Repository</Anchor>.
* The Artifactory Public Key downloaded to your project folder. For more information, see [Download Public Key to Hex Project Folder](#download-public-key-to-hex-project-folder).
* Make sure the `publickey.pem` key is pointing to the correct location in your project.

**Supported Versions**:

To ensure a successful connection, your environment must meet the following version requirements:

* Hex versions 2.1.1 and above
* Elixir versions 1.16 and above
* Open Telecom Platform (OTP) versions 26.2.5.6 and above
* One of the following Artifactory versions:
  * SaaS versions 7.152.2 or 7.153.3 and above
  * Self-Managed version 7.146.13 and above

<Callout icon="⚠️" theme="warning">
  **Warning**

  In earlier versions of Artifactory, an unannounced change to the Hex registry metadata format causes dependency resolution from remote and virtual repositories backed by `repo.hex.pm` to fail. Local repositories are unaffected. For more information, see [Hex Limitations in Artifactory](#hex-limitations-in-artifactory).

  For full functionality of all repository types, use a supported version of Artifactory.
</Callout>

**Logged in vs. Anonymous User**: You can work with Artifactory as either a logged in user or as an anonymous user. To work with Artifactory using Anonymous Access. You need to configure that access under **Admin > Security > General**. For more information, see [Allow Anonymous Access](/administration/docs/security-configuration).

To connect Mix to Artifactory, see the following instructions:

* [Add Local Repository to Mix](#add-local-repository-to-mix)
* [Add Remote Repository to Mix](#add-remote-repository-to-mix)
* [Add Virtual Repository to Mix](#add-virtual-repository-to-mix)

<Callout icon="⚠️" theme="info">
  **Note**

  Hex 2.4.0 introduces an OAuth authentication flow that causes connection issues with remote and virtual Artifactory repositories proxying `https://repo.hex.pm`.

  To restore connectivity, run `mix hex.repo set <REPO_NAME> --no-oauth-exchange` to disable the OAuth exchange. Note that a known issue in Hex 2.4.0 may cause private package downloads from [https://repo.hex.pm](https://repo.hex.pm) to fail, even with OAuth disabled.

  Local and self-managed repositories are not affected.
</Callout>

### Add Local Repository to Mix

**To add a local repository to your Mix client:**

Run the following command in the Hex project directory:

```shell
mix hex.repo add <REPOSITORY_NAME> https://<JFrogPlatformURL>/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem
```

Where:

* `<JFrogPlatformURL>`: Your JFrog Platform URL
* `<REPOSITORY_NAME>`: The name of the target repository
* `<TOKEN>`: Your Artifactory identity token

For example:

```shell
mix hex.repo add hex-local https://company.jfrog.io/artifactory/api/hex/hex-local --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem
```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

### Add Remote Repository to Mix

**To add a remote repository to your Mix client:**

Run one of the following commands in the Hex project directory to connect your Mix client to the public registry or a private organization within `hex.pm`:

* **Hex.pm hosted**:
  ```shell
  mix hex.repo set hexpm --url https://<JFrogPlatformURL>/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem
  ```
  Where:
  * `<JFrogPlatformURL>`: Your JFrog Platform URL
  * `<REPOSITORY_NAME>`: The name of the target repository
  * `<TOKEN>`: Your Artifactory identity token For example:
  ```shell
  mix hex.repo set hexpm --url https://company.jfrog.io/artifactory/api/hex/hex-remote --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem
  ```
* **Self-hosted Hex server**:
  ```
  mix hex.repo add <REPOSITORY_NAME> https://<JFrogPlatformURL>/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem
  ```
  Where:
  * `<REPOSITORY_NAME>`: The name of the target repository
  * `<JFrogPlatformURL>`: Your JFrog Platform URL
  * `<TOKEN>`: Your Artifactory identity token\
    For example:
  ```shell
  mix hex.repo add hex-remote https://company.jfrog.io/artifactory/api/hex/hex-remote --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem
  ```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

### Add Virtual Repository to Mix

**To add a virtual repository to the Mix client**:

Run the following command:

```shell
mix hex.repo set hexpm --url https://<JFrogPlatformURL>/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem
```

Where:

* `<REPOSITORY_NAME>`: The name of the target repository
* `<JFrogPlatformURL>`: Your JFrog Platform URL
* `<TOKEN>`: Your Artifactory identity token

For example:

```shell
mix hex.repo set hexpm --url https://company.jfrog.io/artifactory/api/hex/hex-virtual --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem
```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

**Next Steps:**

* <Anchor label="Deploy Hex Packages" title="Deploy Hex Packages" href="#deploy-hex-packages">Deploy Hex Packages</Anchor>
* <Anchor label="Resolve Hex Packages" title="Resolve Hex Packages" href="#resolve-hex-packages">Resolve Hex Packages</Anchor>

## Deploy Hex Packages

Deploying Hex packages makes them available to other users. The following options are available for deploying Hex packages:

* <Anchor label="Deploy Hex Packages via the UI" title="Deploy Hex Packages via the UI" href="#deploy-hex-packages-via-the-ui">Deploy Hex Packages via the UI</Anchor>
* <Anchor label="Deploy Hex Packages via API" title="Deploy Hex Packages via API" href="#deploy-hex-packages-via-api">Deploy Hex Packages via API</Anchor>

### Deploy Hex Packages via the UI

**To deploy a Hex package via Artifactory UI**:

1. In the **Platform** tab, click **Artifactory | Artifacts**, then click **Deploy**. Deploy options are displayed.

   ![art-hex-package-deploy-10-13.png](https://files.readme.io/3a80af101e789b3c54a59497fe59a33018b77f2b504b5b0bccd14d1edc0c14d7-uuid-c13428d0-3dc9-2c94-337d-0e7b5073f554.png)
2. Verify the deploy options, then click **Deploy**.

   The package is deployed.

### Deploy Hex Packages via API

You can publish packages via the REST API.

**To deploy Hex package via cURL**:

```shell
curl -L -u<USER>:<TOKEN> -XPUT https://[JFrogPlatformURL]/artifactory/<REPOSITORY_NAME>/tarballs/ -T <HEX_PACKAGE_TAR_FILE_PATH>
```

Where:

* `<USER>`: Name of the repository/repository key
* `<TOKEN>`: Your JPD access token
* `<JFrogPlatformURL>`: URL of your JPD
* `<REPOSITORY_NAME>`: Name of the repository/repository key
* `<HEX_PACKAGE_TAR_FILE_PATH>`: This specifies the local file to upload

**For example:**

```shell
curl -L -uadmin:cmVmdGtuOjAxOj05KMzNiZnVxMFFj -XPUT https://company.jfrog.io/artifactory/hex-virtual/tarballs/ -T my_package-0.1.0.tar
```

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see <Anchor label="Use Artifactory Set Me Up for Configuring Package Manager Clients" title="Use Artifactory Set Me Up for Configuring Package Manager Clients" href="/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients">Use Artifactory Set Me Up for Configuring Package Manager Clients</Anchor>.

## Resolve Hex Packages

This topic describes how to resolve Hex packages using the `mix.exs` file:

* [Resolve from a Local Hex Repository](#resolve-from-a-local-hex-repository)
* [Resolve from a Remote Hex Repository](#resolve-from-a-remote-hex-repository)
* [Resolve from a Virtual Hex Repository](#resolve-from-a-virtual-hex-repository)

### Resolve from a Local Hex Repository

**To resolve Hex packages using the mix.exs file**:

To resolve dependencies from a Local Artifactory Hex repository, add the package names, versions, and repository name to your `mix.exs` file:

```
defp deps do
[
  {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", repo: "REPOSITORY_NAME"}
]
```

Where:

* `<PACKAGE_NAME>`: Name of the package
* `<PACKAGE_VERSION>`: Version of the package
* `<REPOSITORY_NAME>`: Name of the repository
* `<HEX_ORGANIZATION_NAME>`: Name of the organization

For example:

```
defp deps do
[
  {:jason, "1.4.4", repo: "hex-local"}
]
```

Run the command.

```
mix deps.get
```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

### Resolve from a Remote Hex Repository

Artifactory supports the following options for resolving a Hex package from Remote repository:

* **Resolve from hex.pm**

  * Public packages

    To resolve your public Hex dependencies, add the package names and versions to your `mix.exs` file:

    ```
    defp deps do
    [
      {:<PACKAGE_NAME>, "<PACKAGE_VERSION>"}
    ]
    ```

    For example:

    ```
    defp deps do
    [
      {:jason, "1.4.4"}
    ]
    ```

    Run the command.

    ```
    mix deps.get
    ```
  * Private packages (Organization)

    To resolve your hex dependencies from a private organization in `hex.pm`, add the package names, versions, and organization name to your `mix.exs` file:

    ```
    defp deps do
    [
      {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", organization: "<HEX_ORGANIZATION_NAME>"}
    ]
    ```

    For example:

    ```
    defp deps do
    [
      {:jason, "1.4.4", repo: "hex-remote", , organization: "acme"}
    ]
    ```

    Run the command.

    ```
    mix deps.get
    ```

<Callout icon="📘" theme="info">
  **Note**

  Hex 2.6.0 and later can fail to install private organization packages when the Mix client authenticates to Artifactory with the repository key only. Add your Artifactory authentication information to `~/.netrc`. For more information, see [Hex Limitations in Artifactory](#hex-limitations-in-artifactory).
</Callout>

* **Resolve from a private Hex server**

  To resolve your Hex dependencies from a private Hex server, add the package names, versions, and repository name to your `mix.exs` file:

  ```
  defp deps do
  [
    {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", repo: "REPOSITORY_NAME"}
  ]
  ```

  For example:

  ```
  defp deps do
  [
    {:jason, "1.4.4", repo: "hex-remote"}
  ]
  ```

<Callout icon="📘" theme="info">
  **Note**

  Organizations are not supported in private Hex server.
</Callout>

Run the command.

```
mix deps.get
```

### Resolve from a Virtual Hex Repository

Artifactory supports the following options for resolving a Hex package from Virtual repository:

* Public packages

  To resolve your public Hex dependencies, add the package names and versions to your `mix.exs` file:

  ```
  defp deps do
  [
    {:<PACKAGE_NAME>, "<PACKAGE_VERSION>"}
  ]
  ```

  For example:

  ```
  defp deps do
  [
    {:jason, "1.4.4"}
  ]
  ```

  Run the command.

  ```
  mix deps.get
  ```
* Private packages (Organization)

  To resolve your hex dependencies from a private organization in `hex.pm`, add the package names, versions, and organization name to your `mix.exs` file:

  ```
  defp deps do
  [
    {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", organization: "<HEX_ORGANIZATION_NAME>"},
  ]
  ```

  For example:

  ```
  defp deps do
  [
    {:jason, "1.4.4", repo: "hex-remote", , organization: "acme"}
  ]
  ```

  Run the command.

  ```
  mix deps.get
  ```

<Callout icon="📘" theme="info">
  **Note**

  Hex 2.6.0 and later can fail to install private organization packages when the Mix client authenticates to Artifactory with the repository key only. Add your Artifactory authentication information to `~/.netrc`. For more information, see [Hex Limitations in Artifactory](#hex-limitations-in-artifactory).
</Callout>

## Additional Hex Actions

The following additional actions are available with Hex repositories:

* <Anchor label="Download Public Key to Hex Project Folder" title="Download Public Key to Hex Project Folder" href="#download-public-key-to-hex-project-folder">Download Public Key to Hex Project Folder</Anchor>
* <Anchor label="Hex Repository Layout and Permission" title="Hex Repository Layout and Permission" href="#hex-repository-layout-and-permission">Hex Repository Layout and Permission</Anchor>
* <Anchor label="Hex Supported Commands" title="Hex Supported Commands" href="#hex-supported-commands">Hex Supported Commands</Anchor>

### Download Public Key to Hex Project Folder

This topic describes how to download the public key to your project folder to work with Hex repositories in Artifactory. It provides instructions to download the public key using curl or wget.

The Mix client requires that you host your Hex repository RSA public key in your project folder to verify the index signature.

First, generate a user token using the Set Me Up dialog. This token will auto-populate in all relevant placeholders within the set-me-up instructions.

**To configure the Mix client, follow these steps:**

Copy the `publickey.pem` key hosted in Artifactory to your Mix project folder using the following curl or Wget commands:

* **Curl**

  ```
  curl -u<USER>:<TOKEN> -o publickey.pem https://[JFrogPlatformURL]/artifactory/api/security/keypair/public/repositories/<REPOSITORY_NAME>
  ```

  Where:

  * `<USER>`: Name of the repository/repository key
  * `<TOKEN>`: Your JPD access token
  * `<JFrogPlatformURL>`: URL of your JPD
  * `<REPOSITORY_NAME>`: Name of the repository/repository key

  **For example:**

  ```
  curl -uadmin:cmVmdGtuOjAxOj45NTgLXlYaFVCYXZYOONaY2dRUEJioEVpNFpT -o publickey.pem https://company.jfrog.io/artifactory/api/security/keypair/public/repositories/hex-remote
  ```
* **Wget**

  ```
  wget -O publickey.pem https://<USER>:<TOKEN>@[JFrogPlatformURL]/artifactory/api/security/keypair/public/repositories/<REPOSITORY_NAME>
  ```

  **For example:**

  ```
  wget -O publickey.pem https://admin:cmVmdGtuOjAxOj45NTgLXlYaFVCYXZYOONaY2dRUEJioEVpNFpT@company.jfrog.io/artifactory/api/security/keypair/public/repositories/hex-remote
  ```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

### Hex Repository Layout and Permission

This topic describes the Hex local and remote repositories layout and permissions you can apply.

* [Hex Local Repository Layout](https://docs.jfrog.com/artifactory/docs/hex-repositories#hex-local-repository-layout)
* [Hex Remote Repository Layout](https://docs.jfrog.com/artifactory/docs/hex-repositories#hex-remote-repository-layout)

#### Hex Local Repository Layout

The following is the Hex Local Repository Layout.

<Callout icon="📘" theme="info">
  **Note**

  All the uploaded `tar` files must be under the tarballs directory as `tarballs/[name]-[version].tar`.
</Callout>

```
<repository name>
  ├── names
  ├── versions  
  ├── installs
      |-- hex-1.x.csv
  ├── packages
      |-- <package-name>
  ├── tarballs
      |-- <package-name>-<package-version>.tar
```

* **repository name** - Name of the repository
* **names** - Name details of a package
* **versions** - Version details of a package
* **installs** - Metadata uploaded for the package
* **packages** - Metadata of packages uploaded in the local
* **tarballs** - Packages uploaded in the local repository

#### Hex Remote Repository Layout

```
<REPOSITORY_NAME> 
 ├── installs
      |-- hex-1.x.csv  
 ├── packages
      |-- <package-name>
 ├── tarballs
      |-- <package-name>-<package-version>.tar
```

* **Installs** - Metadata pulled from the remote
* **packages** -  The package metadata pulled from the remote
* **tarballs** - Redistributable binaries for each package pulled from the remote

#### Permissions on Hex Remote Repository Directories

You can provide granular permissions for users to specific packages. To limit access, apply permissions to each of the layout folders.

For example, to exclude packages that start with abc in the hex repository, add Exclude Patterns for each layout folder as:

* installs/abc\*
* tarballs/abc\*
* packages/abc\*

To learn more, refer to the following:

* <Anchor label="Include/Exclude Patterns" target="_blank" href="https://jfrog.com/help/r/how-to-use-include-exclude-patterns/how-to-use-include/exclude-patterns">Include/Exclude Patterns</Anchor>
* [Add Repositories](/administration/docs/permissions)

#### Hex Virtual Repository Layout

```
<repository name>
  ├── names
  ├── versions  
  ├── packages
      |-- <package-name>
  ├── tarballs
      |-- <package-name>-<package-version>.tar
```

* **repository name** - Name of the repository
* **names** - Name details of a package
* **versions** - Version details of a package
* **packages** - Metadata of packages
* **tarballs** - Packages uploaded

#### Private Packages

```
<repository name>
  ├── repos
  │   ├── <org-name>
  │   │   ├── packages
  │   │   │   └── <package-name>
```

* **repository name** - Name of the repository
* **repos** - A folder that holds multiple sub-repositories
* **org-name** - Name of the organization
* **packages** - List of packages

### Hex Supported Commands

This topic describes the hex supported commands in Artifactory.

* `mix deps.get --verbose`
* `mix deps.update --all`
* `mix hex.outdated <packageName>`
* `mix hex.repo list`

## Hex Limitations in Artifactory

The following are the limitations of Hex in Artifactory:

* **Hex.pm Registry Compatibility:** Due to an unannounced change to the Hex registry metadata format, remote and virtual repositories backed by `repo.hex.pm` may fail to resolve packages and return a 404 "package not found" error. Dependency resolution through Artifactory can fail intermittently, especially for Elixir packages such as `plug`, `cowboy`, `phoenix`, and `ecto`. For full remote and virtual repository functionality against `repo.hex.pm`, use a supported version of Artifactory as documented in [Connect Mix to Artifactory](#connect-mix-to-artifactory).

* **Mix Client**:

  * **Single Repository Limitation:** The Mix client allows only one repository to point to `repo.hex.pm`. As a result, you can only set one Artifactory endpoint as the default repository that connects to the public `hex.pm` registry.
  * **Repository Naming:** The name of your self-hosted Hex repository in the Mix client must exactly match the full URL of the Artifactory remote repository.
  * **Private organization packages in Hex 2.6.0 and later:** Hex 2.6.0 and later can fail to install private organization packages when the Mix client authenticates to Artifactory with the repository key only.

    Add the following snippet with your Artifactory authentication information to your `~/.netrc` file.

    ```text
    machine <JFROG_HOSTNAME>
    login <USERNAME>
    password <TOKEN>
    ```

    Where:

    <ul>
      <li><code>&lt;JFROG_HOSTNAME&gt;</code>: The host name of your JFrog Platform</li>
      <li><code>&lt;USERNAME&gt;</code>: Your Artifactory username</li>
      <li><code>&lt;TOKEN&gt;</code>: Your Artifactory identity token</li>
    </ul>

    For example:

    ```text
    machine company.jfrog.io
    login admin
    password example-identity-token
    ```

    If Hex asks whether you want to authenticate now, enter `n`. You don't need to change `mix.exs` or `mix.lock`.

* **Hex Server**:

  * **Private Package Support:** Self-hosted Hex servers do not support private organizations or private packages. This feature is only available through the public `hex.pm` registry, which offers private hosted repositories.

* **Hex Local Repository**:
  * Parsing any info related to docs, tests, etc.; from `mix.exs` is not supported.
  * `mix hex.publish` command to publish packages to local repository is not supported. **Workaround:**<Anchor label="Deploy Hex Packages via API" title="Deploy Hex Packages via API" href="#deploy-hex-packages-via-api">Deploy Hex Packages via API</Anchor> to local repository.
  * Deploying packages under any other directory except `tarballs` is not supported. To learn more, see <Anchor label="Hex Repository Layout and Permission" title="Hex Repository Layout and Permission" href="#hex-repository-layout-and-permission">Hex Repository Layout and Permission</Anchor>.

* **Repository Browsing**: Artifactory does not support browsing Hex remote registries. The artifact tree only shows packages explicitly pulled into Artifactory, not the contents of the remote registry.

* **Hex Virtual Repository**: A single Mix client can link to only one Hex virtual repository.