Welcome to UNPKG!
UNPKG is a fast, global content delivery network for everything on npm. Use it to quickly and easily load any file from npm using a URL like:
https://unpkg.com/:package@:version/:file
Where :package is the package name, :version is the version range, and :file is the path to the file in the package.
You can learn more about UNPKG on the website.
This repository contains the production source for UNPKG. There are 4 packages:
unpkg-appis the UNPKG web app (file browser)unpkg-filesis the file server backend that fetches tarballs from npm and extracts their contentsunpkg-workeris a shared set of utilites between the web apps (Cloudflare workers)unpkg-wwwis the main UNPKG app
We use Node.js in development, as well as pnpm. Install these first.
Next, install all dependencies and run the tests:
pnpm install
pnpm testThen start the file server and each worker along with its assets server (you'll need 5 terminal tabs):
cd packages/unpkg-files && pnpm dev
cd packages/unpkg-www && pnpm dev
cd packages/unpkg-www && pnpm dev:assets
cd packages/unpkg-app && pnpm dev
cd packages/unpkg-app && pnpm dev:assetsThe dev server will be listening on http://localhost:3000.
UNPKG now supports an all-in-one worker deployment from packages/unpkg-www that serves:
unpkg.comandwww.unpkg.com(main app)app.unpkg.com(file browser app)files.unpkg.com(file backend API)
The worker selects behavior by incoming hostname.
You'll need a Cloudflare account.
Adjust packages/unpkg-www/wrangler.json (routes and vars) and deploy:
cd packages/unpkg-www && pnpm run deployFor staging:
cd packages/unpkg-www && pnpm run deploy:stagingPlease see LICENSE for more information.