{"id":30309549,"url":"https://github.com/lukehagar/pypistats.dev","last_synced_at":"2025-08-17T13:46:00.046Z","repository":{"id":309575461,"uuid":"1036798196","full_name":"LukeHagar/pypistats.dev","owner":"LukeHagar","description":"On-demand PyPI download analytics (BigQuery → Postgres) with a SvelteKit UI and JSON API. Per‑package incremental ingestion, Redis‑backed dedupe, and Docker Compose stack (Postgres + Redis + app). Dev Container included. Replacement for pypistats.org at pypistats.dev.","archived":false,"fork":false,"pushed_at":"2025-08-12T15:56:14.000Z","size":249,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-12T17:34:05.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/LukeHagar.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,"zenodo":null}},"created_at":"2025-08-12T15:43:58.000Z","updated_at":"2025-08-12T15:56:17.000Z","dependencies_parsed_at":"2025-08-12T17:34:15.711Z","dependency_job_id":"4f75c96c-86dc-4f19-be55-079298f7e3c7","html_url":"https://github.com/LukeHagar/pypistats.dev","commit_stats":null,"previous_names":["lukehagar/pypistats.dev"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/LukeHagar/pypistats.dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeHagar%2Fpypistats.dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeHagar%2Fpypistats.dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeHagar%2Fpypistats.dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeHagar%2Fpypistats.dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LukeHagar","download_url":"https://codeload.github.com/LukeHagar/pypistats.dev/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeHagar%2Fpypistats.dev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856593,"owners_count":24657693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"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":"2025-08-17T13:45:58.950Z","updated_at":"2025-08-17T13:46:00.016Z","avatar_url":"https://github.com/LukeHagar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyPIStats.dev\n\nPyPIStats.dev is an open-source, SvelteKit-based replacement for PyPI Stats. It provides fast, on-demand Python package download analytics sourced from BigQuery, backed by PostgreSQL and Redis. The platform exposes a clean web UI and a standards-friendly JSON API suitable for programmatic use.\n\nKey features:\n- On-demand per-package ingestion from BigQuery (no cron required)\n- Idempotent database writes with Prisma and per-day/per-package dedupe locks (Redis)\n- Recent (day/week/month) stats computed on-demand from overall series\n- Additional dimensions: system, Python versions, installer tool\n- Single Docker Compose stack for Postgres + Redis + app\n\n## Deploy and run with Docker Compose (self-contained)\n\nThis repository is designed to deploy with `docker compose` as the primary (and only) method. The stack includes the web app, Postgres, and Redis.\n\n1) Provide environment variables\n\n- Recommended via a `.env` file at repo root (or in your platform’s UI — Coolify supports adding envs/secrets directly):\n\n```\nDATABASE_URL=postgresql://pypistats:pypistats@db:5432/pypistats?schema=public\nREDIS_URL=redis://redis:6379\n\n# BigQuery\nGOOGLE_PROJECT_ID=your-project\n# Prefer JSON for container environments\nGOOGLE_APPLICATION_CREDENTIALS_JSON={\"type\":\"service_account\",\"project_id\":\"...\",\"private_key_id\":\"...\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\\\n...\\\\n-----END PRIVATE KEY-----\\\\n\",\"client_email\":\"...\",\"client_id\":\"...\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\":\"...\"}\n```\n\n2) Start the stack locally\n\n```\ndocker compose up --build\n```\n\nThe app will be available at http://localhost:3000\n\n3) Running in Coolify\n\n- Add this repository as an application in Coolify and choose Docker Compose.\n- In the service configuration, add your environment variables (DATABASE_URL, REDIS_URL, GOOGLE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS_JSON) via Coolify’s UI. Coolify will inject them for you — no file changes needed.\n- Deploy. The app will run the database migrations on startup and serve on port 3000.\n\n## API overview\n\nAll endpoints return JSON. Examples (for package `numpy`):\n- GET `/api/packages/numpy/recent?period=month`\n- GET `/api/packages/numpy/overall?mirrors=false`\n- GET `/api/packages/numpy/python_major?version=3`\n- GET `/api/packages/numpy/python_minor?version=3.11`\n- GET `/api/packages/numpy/system?os=Linux`\n- GET `/api/packages/numpy/installer`\n\nEach API request triggers on-demand ingestion if the package is missing or stale (up to yesterday), then serves from the database and cache.\n\n## Development with Compose\n\n- Dev server (hot reload) using the included dev override:\n\n```\ndocker compose -f docker-compose.yml -f docker-compose.dev.yml up --build\n# App at http://localhost:5173\n```\n\n- Prisma migrations during development:\n\n```\ndocker compose -f docker-compose.yml -f docker-compose.dev.yml exec web pnpm prisma migrate dev\n```\n\n## Contributing\n\nIssues and PRs are welcome. Please ensure:\n- Type-safe changes (Prisma and TypeScript) with clean lints\n- No secrets committed; configure via `.env`/`env_file`\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehagar%2Fpypistats.dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukehagar%2Fpypistats.dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehagar%2Fpypistats.dev/lists"}