Redirect any npm package name to its source repository in one request.
When you visit pkgsource.ffflorian.dev/<packageName>, the server fetches the package metadata from the npm registry, extracts the repository, homepage, or url field, normalizes the URL (handling git+, git://, and ssh:// variants), and issues an HTTP redirect to the resolved source.
Visit pkgsource.ffflorian.dev/{packageName} in your browser, e.g. pkgsource.ffflorian.dev/nock.
Visit pkgsource.ffflorian.dev/{@scope}/{packageName}, e.g. pkgsource.ffflorian.dev/@nestjs/core.
Append @{version} to the package name, e.g.:
If no version is specified, the latest version is used.
Add ?raw to get a JSON response instead of a redirect, e.g. pkgsource.ffflorian.dev/commander?raw.
{"code": 200, "url": "https://github.com/tj/commander.js"}Add ?unpkg to redirect to the package's file tree on unpkg.com, e.g. pkgsource.ffflorian.dev/express@4.17.1?unpkg. Combine with ?raw to get the unpkg URL as JSON.
Prerequisites:
yarn
yarn start:dev
yarn
yarn dist
yarn start:prod
Open /_swagger-ui in the browser to explore the API interactively.
The image is published to the GitHub Container Registry.
docker pull ghcr.io/ffflorian/pkgsource:latest
docker run -p 3000:3000 ghcr.io/ffflorian/pkgsource:latestThe server listens on port 3000. Visit http://localhost:3000/<packageName> to use it.
docker build -t pkgsource .
docker run -p 3000:3000 pkgsource