{"id":21277638,"url":"https://github.com/voltstro/verdaccio-downloads-count","last_synced_at":"2026-02-26T03:01:53.819Z","repository":{"id":255656808,"uuid":"852193945","full_name":"Voltstro/verdaccio-downloads-count","owner":"Voltstro","description":"Tracks daily downloads count for packages. Data is stored in a Postgres database.","archived":false,"fork":false,"pushed_at":"2024-11-14T11:54:46.000Z","size":77,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T19:38:02.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/verdaccio-downloads-count","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Voltstro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2024-09-04T11:46:36.000Z","updated_at":"2024-11-14T11:45:51.000Z","dependencies_parsed_at":"2025-07-11T08:36:36.525Z","dependency_job_id":"d12261ec-9da5-4879-8c90-f025ccfeb599","html_url":"https://github.com/Voltstro/verdaccio-downloads-count","commit_stats":null,"previous_names":["voltstro/verdaccio-downloads-count"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Voltstro/verdaccio-downloads-count","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voltstro%2Fverdaccio-downloads-count","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voltstro%2Fverdaccio-downloads-count/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voltstro%2Fverdaccio-downloads-count/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voltstro%2Fverdaccio-downloads-count/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voltstro","download_url":"https://codeload.github.com/Voltstro/verdaccio-downloads-count/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voltstro%2Fverdaccio-downloads-count/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29848637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-21T10:06:35.342Z","updated_at":"2026-02-26T03:01:53.802Z","avatar_url":"https://github.com/Voltstro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# verdaccio-downloads-count\n\n[![License](https://img.shields.io/github/license/voltstro/verdaccio-downloads-count.svg)](https://github.com/Voltstro/verdaccio-downloads-count/blob/master/LICENSE.md)\n[![NPM](https://img.shields.io/npm/v/verdaccio-downloads-count)](https://www.npmjs.com/package/verdaccio-downloads-count)\n[![Discord](https://img.shields.io/badge/Discord-Voltstro-7289da.svg?logo=discord)](https://discord.voltstro.dev) \n[![YouTube](https://img.shields.io/badge/Youtube-Voltstro-red.svg?logo=youtube)](https://www.youtube.com/Voltstro)\n\nTracks daily downloads count for packages. Data is stored in a Postgres database.\n\n## Features\n\n- Tracks daily and total downloads count for packages\n- Stores data in a Postgres database\n\nThere is currently no web UI or endpoints for retrieving downloads count stats, the only way is via running queries on the database.\n\n## Getting Started\n\n### Prerequisites\n\n- Postgres Database (Tested on Postgres 15)\n- Verdaccio 5\n\n### Install\n\nInstall like any other Verdaccio middleware.\n\n```\nnpm install verdaccio-downloads-count\n```\n\n### Configuration\n\nTo use the middleware, you will need to add the middleware to your verdaccio's config `middleware` option.\n\n```yaml\nmiddlewares:\n  downloads-count:\n    # (Required) Connection string to the database. Postgres connection URI. Can also be set by VDC_DB_CONNECTION_STRING env\n    connectionString: \u003cPostgres Connection String\u003e\n\n    # (Optional) Automatically migrates the database. Uses the postgres-migrations package for handling migrations. \n    migrate: true\n\n```\n\n### Database Configuration\n\nYou will need to configure a database for this middleware to use. You should create a standalone database for this middleware to use.\n\nThe connection string is a Postgres URI connection string. It is parsed by [pg-connection-string](https://github.com/brianc/node-postgres/blob/master/packages/pg-connection-string/README.md).\n\nGenerally, the format will look like:\n\n```\npostgres://someuser:somepassword@somehost:5432/somedatabase\n```\n\nYou can set the connection string either in the config, or by setting the `VDC_DB_CONNECTION_STRING` environment variable.\n\nFor creating the schema, it is recommended to use the auto-migrations that this middleware has built in by enabling the `migrate` option in the config, otherwise the SQL migration scripts can be found in the `migrations/` directory within the package (or repo). You will need to grant the user that the middleware is using permissions to insert, create and update. If you are also using auto-migrate, you will also need to grant permissions to create tables and procedures to the user.\n\nCurrently, everything needs to be on the `public` schema.\n\n## Querying\n\nSince there is currently no way of getting the tracked download counts through either an API endpoint or a web interface, you will need to query the database manually (or through a dashboard/BI tool). Some example SQL queries are below.\n\n```sql\n-- Total Download Counts\nSELECT * FROM public.package_total_count WHERE package_id = '\u003cPackageId\u003e';\n\n-- Daily Download Counts for a Package Version\nSELECT * FROM public.package_count WHERE package_id = '\u003cPackageId\u003e@\u003cVersion\u003e';\n```\n\n## Why?\n\nWhy use Postgres as the datastore for storing package downloads count? Simple, currently all other packages use a different datastore for storing the data, and I already use Postgres in my stack, but not the others, and I don't currently want to introduce another one of these solutions just for storing downloads count.\n\nOther solutions include:\n\n- [verdaccio-install-counts](https://www.npmjs.com/package/verdaccio-install-counts) - Uses Redis\n- [@xlts.dev/verdaccio-prometheus-middleware](https://www.npmjs.com/package/@xlts.dev/verdaccio-prometheus-middleware) - Uses prometheus\n\n## Authors\n\n* **Voltstro** - *Initial work* - [Voltstro](https://github.com/Voltstro)\n\n## Thanks\n\n- [verdaccio-install-counts](https://www.npmjs.com/package/verdaccio-install-counts) - Provided base example on tracking downlands count. `parseVersionFromTarballFilename` method comes from here too.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltstro%2Fverdaccio-downloads-count","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoltstro%2Fverdaccio-downloads-count","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltstro%2Fverdaccio-downloads-count/lists"}