# Set Up Aikido Artifacts

Configure your package manager to install through Aikido Artifacts, and to publish your private packages to it.

## Prerequisites

- Aikido Artifacts enabled for your workspace. It's in beta, so [contact Aikido](https://help.aikidogov.us/miscellaneous-info/contact-support.md) to turn it on.

## Open the instructions

Go to **Artifacts** in the Aikido app, open the **Instructions** tab, and choose **NPM**, **Maven**, **PyPi**, or **Go**. The snippets below the selector update to match.

The tab has two sections: **Publishing Instructions** for your private packages, and **Install Instructions** for installing through the registry.

## Install packages through the registry

Add the install configuration from the **Install Instructions** section to your project or user configuration. Copy it from the app: the registry URL contains a token that is specific to your workspace.

| Package manager | Config file | What it sets |
| --- | --- | --- |
| npm | `.npmrc` | `registry=<registry-url>` |
| pip | `pip.conf` | `index-url = <registry-url>` |
| Maven | `settings.xml` | A profile with the registry as a repository |
| Go | Environment variable | `GOPROXY=<registry-url>` |

> **Danger:** The registry URL contains a token that identifies your workspace. Anyone with the URL can install through your registry. Treat it like a secret and don't commit it to a public repository.

## Publish private packages

Publishing needs a [write token](https://help.aikidogov.us/aikido-artifacts/aikido-artifacts-overview/write-tokens.md). Create one first, then follow the **Publishing Instructions** for your package manager in the app. They already contain your registry URL, so you only need to replace `<write-token>` with your token.

For example, to publish a package and install it again:

### npm

In your project root, create a `.npmrc` file and publish. `<registry-host>` is the registry URL without `https://`.

**.npmrc**
```ini
//<registry-host>/:_authToken=<write-token>
registry=<registry-url>/
```

```shell
npm publish
```

To install it in another project, add the registry to its `.npmrc`, then run `npm install`:

**.npmrc**
```ini
registry=<registry-url>
```

```shell
npm install <package-name>
```

### PyPI

Create a `.pypirc` file, then build and upload with twine:

**.pypirc**
```ini
[distutils]
index-servers =
    aikido

[aikido]
repository = <registry-url>
username = __token__
password = <write-token>
```

```shell
python -m build
python -m twine upload --config-file .pypirc --repository aikido dist/*
```

To install it, add the registry to your `pip.conf`, then run `pip install`:

**pip.conf**
```ini
[global]
index-url = <registry-url>
extra-index-url = https://pypi.org/simple
```

```shell
pip install <package-name>
```

After you publish, the version appears in [My packages](https://help.aikidogov.us/aikido-artifacts/aikido-artifacts-overview/manage-your-packages.md).

## Related

- [Write Tokens](https://help.aikidogov.us/aikido-artifacts/aikido-artifacts-overview/write-tokens.md)

- [Manage Your Packages](https://help.aikidogov.us/aikido-artifacts/aikido-artifacts-overview/manage-your-packages.md)
