Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Artifact Management with Nexus and Artifactory

By Kokil Thapa | Last reviewed: September 2026

Your build breaks at 2 a.m. because Packagist timed out again. A teammate pinned a dependency locally, but nobody else can reproduce the release. Artifact Management with Nexus and Artifactory fixes that class of problem by giving your team a private, cached, versioned store for packages, containers, and build outputs. On production Linux system administration work and Laravel deployments I maintain, a local repository manager sits between the internet and every CI job — and the difference in reliability is immediate.

What is artifact management and why does CI/CD need it?

An artifact is any immutable build output you ship or depend on: a Composer package, an npm tarball, a Docker image layer, a Deployer release archive, or a Vite build bundle. Artifact management is the practice of storing, indexing, scanning, and serving those files through a controlled repository layer.

Without it, every pipeline run hits public registries directly. That creates three recurring failures I see on client projects:

  • Non-reproducible builds — upstream tags move, mirrors fail, or a semver range resolves to a different patch on Tuesday than on Monday.
  • Slow pipelines — downloading the same 400 MB Docker base image or 120 Composer packages on every job wastes minutes and bandwidth.
  • Supply-chain risk — a compromised public package lands in production because nobody cached or scanned dependencies centrally.

A repository manager sits in the middle. Developers and CI authenticate once. The manager proxies public feeds, caches responses, and hosts your private packages. That pattern pairs naturally with CI/CD secrets management best practices because tokens for the repository live in GitLab variables or Vault — not in committed config files.

Artifact Management PipelineDeveloperscomposer / npmGitLab CIbuild + testNexus / Artifactoryproxy + host + scanPublic feedsPackagist, npmjsPrivate packagesinternal libsDocker Hubcached layersDeployer releasesymlink deploy
Artifact management with Nexus and Artifactory centralises dependency pulls for developers, CI runners, and deployment tools.

The two dominant self-hosted options are Sonatype Nexus Repository and JFrog Artifactory. Both solve the same core problem. They differ in licensing, ecosystem depth, and how much security scanning you want baked in from day one.

How do Nexus Repository and JFrog Artifactory compare?

Teams usually pick one repository manager and standardise every language on it. Splitting Composer to Nexus and Docker to Artifactory doubles credential sprawl and audit work. Compare them on criteria that matter in small-to-mid production teams — not feature checklists you will never enable.

CriteriaSonatype Nexus RepositoryJFrog Artifactory
Core formatsComposer, npm, Maven, Docker, PyPI, raw, NuGetSame core set; strong universal repository model
Proxy + cacheExcellent; mature npm and Maven proxy reposExcellent; remote repos with smart checksum handling
Private hostingHosted repos per format; free tier on Nexus OSSLocal repos; free tier on Artifactory OSS
Security scanningNexus Firewall + Lifecycle (commercial)Xray integration (commercial); deep CVE graph
HA / scalingPro cluster with shared blob storeArtifactory HA with S3-backed storage
Learning curveSimpler UI for basic proxy/hosted setupMore concepts upfront; pays off at scale
Typical costOSS free; Pro from roughly USD 14k/year per instanceOSS free; Pro/Enterprise tiered by storage and features
Best fitTeams wanting fast OSS setup and Sonatype governanceTeams standardising many formats with Xray and HA

For a Laravel shop running GitLab CI and Deployer 7 on Ubuntu, either tool works. I have seen Nexus OSS adopted first because the Composer and npm proxy setup takes an afternoon. Artifactory wins when the same organisation already runs Xray for vulnerability management automation across Docker images and Maven artefacts.

Cloud-native alternatives exist — GitLab Package Registry, GitHub Packages, and Azure Artifacts — and they reduce ops overhead. Self-hosted Nexus or Artifactory still makes sense when you want one cache in Kathmandu or on a private VPC, air-gapped compliance, or unified storage across PHP, Node, and Docker without per-platform egress fees. Read the Azure Artifacts private package feeds guide if you are weighing cloud-only options.

Nexus vs Artifactory DecisionNeed private repo manager?Budget limited?small team, OSS okEnterprise scale?HA + deep scanNexus OSS / Profast proxy setupArtifactory + Xrayunified governanceBoth support Composer 2.x, npm 12, and Docker registries in 2026
Choose Nexus for quick OSS wins; choose Artifactory when HA, Xray scanning, and multi-format governance are mandatory.

How do you set up artifact management for PHP Composer and npm?

Most Laravel 12 and Laravel 13 projects pull PHP packages through Composer 2.10 and front-end assets through npm 12 with Vite 8.x. Point both at your repository manager using proxy repositories — not by mirroring the entire internet onto disk on day one.

Repository types you need

  1. Proxy repository — forwards requests to Packagist or registry.npmjs.org and caches successful responses.
  2. Hosted repository — stores your internal packages, such as a shared validation library across legal-tech portals.
  3. Group repository — merges proxy and hosted repos behind one URL so clients need a single endpoint.

Nexus example: Composer proxy + group

After installing Nexus on Ubuntu 24.04, create these repositories in the admin UI or via REST API:

  • composer-proxy — remote URL https://repo.packagist.org
  • composer-hosted — for internal packages
  • composer-group — members: hosted first, then proxy

Point the project composer.json at the group URL. Use an auth token in CI, never in Git:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://nexus.example.com/repository/composer-group/"
    }
  ],
  "config": {
    "secure-http": true
  }
}

Set credentials through COMPOSER_AUTH in GitLab CI variables:

export COMPOSER_AUTH='{"http-basic":{"nexus.example.com":{"username":"ci-bot","password":"'"$NEXUS_PASSWORD"'"}}}'

The official Composer documentation describes repository types and authentication headers in detail — follow that spec rather than inventing custom download scripts.

Artifactory example: npm and Composer

Artifactory uses a similar model with remote, local, and virtual repositories. Create a virtual repo named npm-all that aggregates your cached npm remote and a local scope for private packages. For Composer, bind a Composer local repo and attach a remote pointing at Packagist.

Configure npm once per runner:

npm config set registry https://artifactory.example.com/artifactory/api/npm/npm-all/
npm config set //artifactory.example.com/artifactory/api/npm/npm-all/:_authToken "$ARTIFACTORY_TOKEN"

On a production Laravel application, commit composer.lock and package-lock.json. Run composer install --no-dev --prefer-dist and npm ci in CI so the repository manager serves exact versions from cache. That single habit eliminates an entire category of "works on my machine" deploy failures.

Repository TypesProxy repocache PackagistHosted repointernal packagesGroup / virtualsingle URLCI + Composer + npm clientsone authenticated endpointOrder group members: hosted before proxy for name conflicts
Proxy, hosted, and group repositories are the building blocks of artifact management with Nexus and Artifactory.

How do you wire Nexus or Artifactory into GitLab CI and Deployer?

Several sister sites I maintain share a GitLab CI plus Deployer 7 pipeline on shared EC2 infrastructure. The same pattern applies whether you cache dependencies or publish release bundles.

GitLab CI job skeleton

Cache Composer and npm directories on the runner, but still pull through the repository manager. Caches speed up jobs; the manager guarantees immutability when a cache is cold.

stages:
  - build

variables:
  COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/.composer-cache"

build:
  image: php:8.4-cli
  stage: build
  before_script:
    - apt-get update && apt-get install -y git unzip
    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    - export COMPOSER_AUTH="{\"http-basic\":{\"nexus.example.com\":{\"username\":\"$NEXUS_USER\",\"password\":\"$NEXUS_PASS\"}}}"
  script:
    - composer install --no-dev --prefer-dist --no-interaction
    - npm ci --prefer-offline
    - npm run build

Store NEXUS_USER and NEXUS_PASS as masked protected variables. Rotate them quarterly. Pair this with HashiCorp Vault secrets management if you already centralise credentials for multiple environments.

Publishing build artefacts back to the repository

Some teams push generic ZIP archives of Vite output or migration bundles to a raw repository for audit. Upload with a deterministic path that includes the Git commit SHA:

curl -u "$NEXUS_USER:$NEXUS_PASS" \
  --upload-file "./dist/release.zip" \
  "https://nexus.example.com/repository/raw-releases/myapp/${CI_COMMIT_SHA}/release.zip"

Deployer does not require this step for symlink releases. It helps when QA wants to diff exact asset trees between builds without redeploying. Treat published artefacts like test data management for pipelines — name clearly, expire deliberately, and never overwrite immutable paths.

Docker images through the same manager

Both Nexus and Artifactory run Docker registries. Configure the daemon or Kaniko to pull base images through your cache:

docker pull nexus.example.com:8082/library/php:8.4-fpm
docker tag nexus.example.com:8082/library/php:8.4-fpm php:8.4-fpm

On bandwidth-constrained hosting in Nepal, cached Docker layers alone can cut CI time by several minutes per job. That saving adds up across dozens of microservices or multi-tenant enterprise application development projects.

What security, retention, and backup policies actually matter?

A repository manager becomes a single point of failure and a high-value target. Treat it as production infrastructure from the first install — not as a side experiment on a forgotten VM.

Authentication and network placement

  • Run Nexus or Artifactory behind HTTPS with a valid TLS certificate.
  • Restrict admin UI access by IP or VPN; CI bots get read-only or deploy-scoped tokens.
  • Disable anonymous write everywhere. Anonymous read is a trade-off — acceptable for internal LAN mirrors, risky on public subnets.
  • Enable cleanup policies on proxy repos so a disk full event does not take down every pipeline.

Align credential storage with your wider approach to multi-cloud secrets management. One CI token per project beats one shared admin password in a group variable.

Retention and cleanup

Proxy caches grow until you cap them. Set age-based or size-based cleanup tasks. For hosted releases, keep the last N semver tags and purge snapshot builds after 30 days unless compliance requires longer retention.

Document what you keep. Legal-tech portals and client document systems sometimes face audit questions about third-party library versions shipped on a given date. Your repository manager's browse UI and REST API become the evidence source — export SBOMs if you adopt Nexus Lifecycle or Artifactory Xray.

Backup strategy

Back up the blob store and database together. On Nexus, that means the sonatype-work directory and embedded DB or external PostgreSQL. On Artifactory, blob storage on disk or S3 plus the PostgreSQL metadata DB. Test restores — a tarball nobody has restored is not a backup.

This sits alongside normal Ubuntu repository management for OS packages. OS mirrors and application artefact caches solve different layers of the stack. Confusing apt caching with Composer proxying leads to odd troubleshooting sessions I would prefer you skip.

Repository Security LayersHTTPS + firewall + VPNRBAC tokens per CI projectCleanup + retention policiesBlob store + DB backupsDefence in depth for Nexus and Artifactory production instances
Layer TLS, scoped credentials, retention rules, and tested backups on every artifact management deployment.

Key Takeaways

  • Run a repository manager so Composer, npm, and Docker pulls are cached, authenticated, and reproducible across every CI job.
  • Start with proxy plus group repositories; add hosted repos only when you publish internal packages.
  • Nexus OSS fits fast setups; Artifactory plus Xray fits teams that need HA and deep CVE tracking on every format.
  • Wire GitLab CI through scoped tokens stored as masked variables — never commit credentials to composer.json or .npmrc.
  • Schedule cleanup and test blob-store restores before disk pressure becomes a production outage.
  • Commit lockfiles and use composer install plus npm ci so the manager serves exact versions, not floating semver ranges.

People Also Ask

Can Nexus or Artifactory replace Packagist and npm entirely?

No. They proxy and cache public registries; they do not replace them. Your proxy repository still resolves metadata from Packagist or registry.npmjs.org on first request. After that, builds hit local cache. If the upstream disappears, cached versions remain available — which is exactly why you run the manager.

Is Nexus OSS enough for a small Laravel team?

For many teams, yes. Nexus OSS supports Composer, npm, Docker, and Maven proxy and hosted repositories without license cost. You lose advanced firewall and lifecycle features, but you still get caching, private hosting, and RBAC on the commercial Pro tier if you upgrade later.

How does artifact management differ from GitLab Package Registry?

GitLab Package Registry integrates tightly with GitLab CI and project permissions. Nexus and Artifactory are format-agnostic hubs that serve many CI systems and many teams from one cache. Choose GitLab-native storage when you live entirely inside GitLab; choose Nexus or Artifactory when PHP, Java, Docker, and legacy pipelines must share one cache and one audit trail.

What PHP and Laravel versions work with private Composer repositories?

Composer 2.10 supports repository managers on any supported PHP version — PHP 8.2 or higher for Laravel 12, PHP 8.3 or higher for Laravel 13. The repository URL lives in composer.json; PHP runtime version does not change the integration pattern.

Ship reproducible builds with confidence

Artifact Management with Nexus and Artifactory turns fragile registry dependencies into infrastructure you control. Start with a Composer and npm proxy on Nexus OSS, connect GitLab CI with scoped tokens, commit your lockfiles, and add retention plus backups before the cache fills its first disk. If you want help wiring this into Deployer releases, Docker caching, or a multi-project GitLab pipeline, contact us or explore support and maintenance services. For proof this pipeline model runs in production, see the Translation Nepal portfolio entry and related sister-site deployments. Validate JSON config before paste-deploying with the JSON formatter tool, and read more on Terraform state management when infrastructure and application artefacts share the same ops mindset. Visit the home page or about page for broader context on how these systems are operated in production.

Frequently Asked Questions

It means running a private repository that proxies, caches, and hosts Composer, npm, Maven, Docker, and generic files so CI builds pull known versions from your network instead of the public internet every time.

No. They proxy and cache public registries, not replace them. First requests still resolve metadata from Packagist or registry.npmjs.org; after that, builds hit local cache. If upstream disappears, cached versions remain available.

Both offer free OSS tiers. Nexus Pro starts around USD 14,000 per year per instance. Artifactory Pro and Enterprise are tiered by storage and features. Many Laravel teams start on OSS without license cost.

Direct public pulls cause three recurring failures: non-reproducible builds when semver ranges resolve differently, slow pipelines from re-downloading the same packages and Docker layers every job, and supply-chain risk when compromised packages land in production without central caching or scanning. A repository manager sits between the internet and every CI job, giving authenticated, cached, versioned pulls.

Both support Composer, npm, Maven, Docker, PyPI, raw, and NuGet with strong proxy and cache capabilities. Nexus OSS has a simpler UI and fast basic setup; Pro adds Sonatype Firewall and Lifecycle. Artifactory has more concepts upfront but pays off at scale with HA, S3-backed storage, and Xray CVE scanning. Pick one tool and standardise every language on it to avoid credential sprawl.

Choose Nexus for quick OSS wins — Composer and npm proxy setup can take an afternoon on Ubuntu 24.04. Choose Artifactory when HA, Xray scanning, and multi-format governance are mandatory, especially if the organisation already runs Xray for vulnerability management across Docker images and Maven artefacts.

For many teams, yes. Nexus OSS supports Composer, npm, Docker, and Maven proxy and hosted repositories without license cost. You lose advanced Firewall and Lifecycle features, but you still get caching, private hosting, and the option to upgrade to Pro for RBAC later.

GitLab Package Registry integrates tightly with GitLab CI and project permissions. Nexus and Artifactory are format-agnostic hubs serving many CI systems and teams from one cache. Choose GitLab-native storage when you live entirely inside GitLab; choose Nexus or Artifactory when PHP, Java, Docker, and legacy pipelines must share one cache and one audit trail.

Point both at your repository manager using proxy repositories, not by mirroring the entire internet on day one. On Nexus, create composer-proxy pointing at repo.packagist.org, composer-hosted for internal packages, and composer-group merging both. Set the group URL in composer.json and pass credentials via COMPOSER_AUTH in GitLab CI variables, never in Git. On Artifactory, create virtual repos aggregating remote and local stores for each format.

A proxy repository forwards requests to public feeds like Packagist or registry.npmjs.org and caches successful responses. A hosted repository stores your internal packages, such as a shared validation library. A group repository merges proxy and hosted repos behind one URL so clients need a single endpoint. Artifactory uses the same model with remote, local, and virtual repositories.

Store NEXUS_USER and NEXUS_PASS as masked protected variables and export COMPOSER_AUTH in before_script. Run composer install --no-dev --prefer-dist and npm ci so the manager serves exact versions from cache. Cache Composer and npm directories on the runner for speed, but rely on the manager for immutability when cache is cold. Some teams upload Vite output ZIPs to a raw repository with the Git commit SHA for QA audit, though Deployer symlink releases do not require this step.

Both run Docker registries. Configure the daemon or Kaniko to pull base images through your cache, for example pulling php:8.4-fpm via your Nexus proxy port and retagging locally. On bandwidth-constrained hosting in Nepal, cached Docker layers alone can cut CI time by several minutes per job across dozens of pipeline runs.

Run behind HTTPS with valid TLS. Restrict admin UI by IP or VPN; give CI bots read-only or deploy-scoped tokens. Disable anonymous write everywhere. Use one CI token per project instead of a shared admin password. Enable cleanup policies on proxy repos so a full disk does not take down every pipeline. Align credential storage with wider secrets management using GitLab variables or HashiCorp Vault.

Set age-based or size-based cleanup on proxy caches. For hosted releases, keep the last N semver tags and purge snapshot builds after 30 days unless compliance requires longer retention. Back up the blob store and database together — sonatype-work plus embedded or external PostgreSQL on Nexus, blob storage plus PostgreSQL on Artifactory. Test restores regularly; a tarball nobody has restored is not a backup.

Composer 2.10 supports repository managers on any supported PHP version — PHP 8.2 or higher for Laravel 12, PHP 8.3 or higher for Laravel 13. Front-end assets typically use npm 12 with Vite 8.x. The repository URL lives in composer.json; PHP runtime version does not change the integration pattern. Commit composer.lock and package-lock.json for reproducible builds.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: