{"id":17026455,"url":"https://github.com/zapthedingbat/npm-dependencies","last_synced_at":"2026-04-16T11:35:16.337Z","repository":{"id":40407994,"uuid":"226997342","full_name":"zapthedingbat/npm-dependencies","owner":"zapthedingbat","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T11:37:00.000Z","size":28,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T11:58:42.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zapthedingbat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-10T00:50:15.000Z","updated_at":"2019-12-10T00:53:34.000Z","dependencies_parsed_at":"2024-10-14T07:43:01.265Z","dependency_job_id":null,"html_url":"https://github.com/zapthedingbat/npm-dependencies","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zapthedingbat/npm-dependencies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fnpm-dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fnpm-dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fnpm-dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fnpm-dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zapthedingbat","download_url":"https://codeload.github.com/zapthedingbat/npm-dependencies/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fnpm-dependencies/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T07:32:47.163Z","updated_at":"2026-04-16T11:35:16.323Z","avatar_url":"https://github.com/zapthedingbat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NPM Dependencies\n\nRecursively lists all dependencies of a given NPM package.\n\n## Usage\n\n### CLI\n\nLink the package with `npm link`\n\n```\nnpm-dependencies \u003cpackage\u003e \u003csemver range\u003e\n```\n\n### Server\n\n```\nnode src/server.js\n```\n\nYou can then access the server on port 3000. E.g http://localhost:3000/react/16\n\n## Architecture\n\nTha application is currently architected to query the npmjs.com package registry\nabout each package that it hasn't cached. We're interogating a master dataset\nthat's not optimised for our needs. While this works on a small scale, with\ngreater load it might make more sense to move to a CQRS approach where we\nmaintain a seperate materialized view of the dependency graph of packages; A\nwrite-model that's easy to update and traverse (maybe a graph database) and a\nread-model that's optimised for lookups (maybe a KV store).\n\nWe'd need to start by enumerating all packages in the registry onto an event\nstream and then continuing to publish events from the\n[Replication API](https://github.com/npm/registry/blob/master/docs/REPLICATE-API.md).\nApplying each event to our write-model and then projecting this to our\nread-model would give us an eventually-consistant architecture that would scale\nhorizontally.\n\n## Optimisations\n\nEven without a distributed, event-based architecture, there are things that\ncould be done to improve the application in it's current state.\n\n- The application has an in-process cache (just a Map) to cache HTTP requests to\n  the package registry. This should probably be moved out of process to a shared\n  KV store to make it more resiliant and provice automatic cache eviction. Right\n  now it will leak memory as the map glows in size.\n\n- NodeJS dosn't nativly cache DNS or respect TTLs, so every single HTTP request\n  initiates a new DNS lookup. To get a performance lift and avoid hammering the\n  local DNS resolver it might be good to cache DNS in-process given that we're\n  always going to the same host. This package might be a good option -\n  https://www.npmjs.com/package/lookup-dns-cache\n\n- The service only supports semver version ranges however NPM supports other\n  references like git repositories. Support for this could be added by\n  introducing additional logic when fetching package metadata.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzapthedingbat%2Fnpm-dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzapthedingbat%2Fnpm-dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzapthedingbat%2Fnpm-dependencies/lists"}