{"id":13425890,"url":"https://github.com/christian-fei/minimal-analytics","last_synced_at":"2026-02-16T09:32:17.783Z","repository":{"id":37404370,"uuid":"356911407","full_name":"christian-fei/minimal-analytics","owner":"christian-fei","description":"Read more at https://cri.dev/posts/2021-04-28-fullstack-nodejs-preact-minimal-web-analytics-introduction/","archived":false,"fork":false,"pushed_at":"2025-04-22T08:12:26.000Z","size":1844,"stargazers_count":62,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T18:43:09.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://s.cri.dev","language":"JavaScript","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/christian-fei.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-04-11T15:54:12.000Z","updated_at":"2025-08-02T19:15:55.000Z","dependencies_parsed_at":"2024-01-23T15:27:43.408Z","dependency_job_id":"9b624c13-3b51-4cd9-a206-8ba0b8dd9d9b","html_url":"https://github.com/christian-fei/minimal-analytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/christian-fei/minimal-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christian-fei%2Fminimal-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christian-fei%2Fminimal-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christian-fei%2Fminimal-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christian-fei%2Fminimal-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christian-fei","download_url":"https://codeload.github.com/christian-fei/minimal-analytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christian-fei%2Fminimal-analytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29504746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: 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-07-31T00:01:21.372Z","updated_at":"2026-02-16T09:32:17.758Z","avatar_url":"https://github.com/christian-fei.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# minimal-analytics\n\n[![minimal analytics dashboard](https://github.com/christian-fei/minimal-analytics/blob/main/.github/assets/dashboard.png?raw=true)](https://cri.dev/posts/2021-04-28-fullstack-nodejs-preact-minimal-web-analytics-introduction/)\n\nRead more about the project at [cri.dev - \"Making Minimal Analytics\"](https://cri.dev/posts/2021-04-28-fullstack-nodejs-preact-minimal-web-analytics-introduction/)\n\nSee [Minimal Analytics in action](https://s.cri.dev)\n\n# Table of contents\n\n- [requirements](#requirements)\n- [how to self-host](#how-to-self-host)\n- [local installation](#local-installation)\n- [tests](#tests)\n\n# requirements\n\n- node.js 16+ (16.16.0 lts recommended)\n\n# how to self-host\n\n## with docker\n\n```\ndocker run -p 8080:8080 \\\n -v /path/to/your/data/folder/for/persistence:/app/data \\\n -e STATS_BASE_URL=https://stats.example.com \\\n -e SITE_BASE_URL=https://example.com \\\n christianfei/minimal-analytics:latest\n```\n\n## manually\n\n## 1. clone the repo\n\n```\ngit clone https://github.com/christian-fei/minimal-analytics.git\n```\n\n## 2. create a production configuration for docker-compose\n\n```\ncp docker-compose.yml docker-compose.prod.yml\n```\n\nchange the environment variable `STATS_BASE_URL` to your own domain for minimal-analytics, e.g. `https://stats.example.com`\n\nchange the environment variable `SITE_BASE_URL` to your own domain for the site you want to track, e.g. `https://example.com`\n\n## 3. run the service\n\nrun the `update.sh` script to start the server\n\n## 4. include `client.js` in your site\n\nreplace `STATS_BASE_URL` with your own domain for minimal-analytics, e.g. `https://stats.example.com` and include the following in your site\n\n```\n\u003cscript async defer src=\"https://STATS_BASE_URL/client.js\"\u003e\u003c/script\u003e\n```\n\n## optional: 5. configure nginx\n\nconfigure the nginx reverse proxy like so:\n\n```\nsudo cp nginx.conf /etc/nginx/sites-available/minimal_analytics\n```\n\nchanging the placeholder `YOUR_STATS_DOMAIN` to e.g. `stats.example.com`, in the `/etc/nginx/sites-available/minimal_analytics` file.\n\nthen link to the enabled sites\n\n```\nsudo ln -s /etc/nginx/sites-available/minimal_analytics /etc/nginx/sites-enabled/minimal_analytics\n```\n\nand reload nginx\n\n```\nsudo systemctl reload nginx\n# or\nsudo nginx -s reload\n```\n\n\n# local installation\n\ninstall the server dependencies with\n\n```\nnpm i\n```\n\nand then install the client dependencies in the `dashboard` directory\n\n```\ncd dashboard\nnpm i\n```\n\n## build client\n\nthe client uses `parcel` as a asset bundler.\n\nyou can run a build of the dashboard, the output will be in `dashboard/dist` and served from `http://127.0.0.1:8080` when starting the server\n\n```\ncd dashboard\nnpm run build\n```\n\n# start minimal-analytics - with npm\n\nRun `touch data/data.ljson` to create an empty file used to keep track of pageviews.\n\nSet the environment variables `STATS_BASE_URL` and `SITE_BASE_URL` and run `npm start`, e.g.\n\n```bash\nSITE_BASE_URL=http://127.0.0.1:8081 STATS_BASE_URL=http://127.0.0.1:8080 npm start\n```\n\nalternatively, using [direnv](https://direnv.net/), create a `.env` file by copying the example file: `cp .env.example .env` and configure the variables.\n\nThe configured site to track is running on `http://127.0.0.1:8081`, described by `SITE_BASE_URL` \n\nThe minimal-analytics server runs at `STATS_BASE_URL` `http://127.0.0.1:8080`\n\n# start minimal-analytics - with docker-compose\n\nconfigure the environment variables in `docker-compose.yml` regarding `STATS_BASE_URL` and `SITE_BASE_URL`.\n\n`STATS_BASE_URL` is the location where the minimal-analytics is running, e.g. `https://stats.example.com`\n\n`SITE_BASE_URL` is the location of the site you want to allow tracking, e.g. `https://example.com`\n\nRun the service with\n\n```\ndocker-compose up -d --build --remove-orphans --renew-anon-volumes\n```\n\n\n# tests\n\nRun `touch data/test.ljson` to create an empty file used for tests\n\nRun `npm t` in the root of the project to run the server tests. \n\nIf you want to run the client dashboard tests, `npm t` in the `dashboard` directory\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristian-fei%2Fminimal-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristian-fei%2Fminimal-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristian-fei%2Fminimal-analytics/lists"}