Canonical Resource Management Infrastructure Implementation Guide, published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 2.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/crmi-ig/ and changes regularly. See the Directory of published versions
| Page standards status: Informative | 
An authoring client creates a tarball, and the either uses an npm client, or the NPM APIs to upload the package to a Knowledge Artifact Repository as follows:
1. Create a package tarball
This tarball must contain at least:
And then additional FHIR Resources as part of the packagte.
NOTE: This is compatiable with the generated ./output/package.tgz generated by IGPublisher
2. Use NPM API to publish
A simple way is to use an npm client:
npm --registry=http://registry publish package.tgz
Or using the npm APIs directly:
PUT /{packageId}
Host: registry
Content-Type: application/json
{MULTILE-VERSION-PACKAGE-MANIFEST}
Where MULTILE-VERSION-PACKAGE-MANIFEST is the NPM form of a multiple-version package manifest:
{
    "_id": "packge.id",
    "name": "packge.id",
    "dist-tags": [ "current", "1.1" ],
    "versions": {
        "1.1": {
            "name": "package.id",
            "version": "1.1",
            // The rest of package.json from package.tgz
            "dist": {
                "integrity": "sha512-xxxx",
                "shasum" "4c4dxxxx",
                "tarball": "http://127.0.0.1/package.id-1.1.tgz"
            }
        }
    },
    "_attachments": {
        "package.id-1.1.tgz": {
            "content-type": "appliation/octet-stream",
            "data": "H4sIAHe" // Base64 encoded package.tgz
        }
    }
}
The server keeps a copy of the multiple-version package manifest for each package, as shown in the previous section. Upon receiving the PUT request from the client, the server should create-or-append the published version to the multiple-version manifest, including the attachments.
NOTE: It might be convienent to extract, decode, and store the actual tarball data in the attachment in a blob store or file system. And a server MAY rewrite the tarball location in the versions section to match implementation details.
If the version of the package already exists, the sever returns error 422, otherwise the server returns 201.
A client system can use npm pack command to download a FHIR package from a Knowledge Artifact Repository:
npm --registry=http://registry pack package.id[@version]
A client system could also use the NPM APIs directly, as shown in the next section.
To implement dowloading a NPM FHIR Package, the knowledge artifact repository must implement 3 endpoints:
GET http://regsitry/{packageId} => Multiple-version Pacakge ManifestGET http://registry/{packageId}/{version} => Package Manifest (version specific)GET http://registry/{tarball-location-from-package-manifest}.tgz => Package tarball