{"id":25031861,"url":"https://github.com/lgraubner/true-micro-analytics","last_synced_at":"2026-01-22T05:02:00.782Z","repository":{"id":57380188,"uuid":"79095451","full_name":"lgraubner/true-micro-analytics","owner":"lgraubner","description":"Simple analytics server using micro.","archived":false,"fork":false,"pushed_at":"2017-01-16T08:06:08.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T12:15:13.501Z","etag":null,"topics":["analytics-server","micro","micro-analytics","microservice","node"],"latest_commit_sha":null,"homepage":"","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/lgraubner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-16T07:53:14.000Z","updated_at":"2019-06-11T17:38:48.000Z","dependencies_parsed_at":"2022-08-28T22:01:08.969Z","dependency_job_id":null,"html_url":"https://github.com/lgraubner/true-micro-analytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lgraubner/true-micro-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgraubner%2Ftrue-micro-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgraubner%2Ftrue-micro-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgraubner%2Ftrue-micro-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgraubner%2Ftrue-micro-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lgraubner","download_url":"https://codeload.github.com/lgraubner/true-micro-analytics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgraubner%2Ftrue-micro-analytics/sbom","scorecard":{"id":587093,"data":{"date":"2025-08-11","repo":{"name":"github.com/lgraubner/true-micro-analytics","commit":"a8203329e6317b311248b9ed082e70e8e8923fb3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T20:49:46.080Z","repository_id":57380188,"created_at":"2025-08-20T20:49:46.081Z","updated_at":"2025-08-20T20:49:46.081Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28655022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["analytics-server","micro","micro-analytics","microservice","node"],"created_at":"2025-02-05T22:45:23.460Z","updated_at":"2026-01-22T05:02:00.767Z","avatar_url":"https://github.com/lgraubner.png","language":"JavaScript","readme":"# true-micro-analytics\n\nSimple analytics server using [`micro`](https://github.com/zeit/micro). Track views and more by performing a plain `get` request. Heavily inspired by [`micro-analytics`](https://github.com/mxstbr/micro-analytics) from Max Stoiber.  \n\n## Get started\n\nSimply install `true-micro-analytics` globally and start it using `true-micro-analytics` command.\n\n```\nnpm install -g true-micro-analytics\ntrue-micro-analytics\n```\n\nYour server is now listening for requests. To keep the server running without having the shell open all the time you can use [pm2](http://pm2.keymetrics.io/) or [forever](https://github.com/foreverjs/forever)\n\nAll cli arguments are passed through to [`micro`](https://github.com/zeit/micro). That said you can set a different host or port.\n\n### Make it available\n\nIn production you should set up a Nginx Reverse Proxy (or something similar) to make the Node server public. Digital Ocean has a splendid tutorial on [how to set up a server](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04) with Node.js, Nginx, and pm2.\n\n## How to Track Data\n\nTo track a page view, command execution or anything else just make a get request to the corresponding path.\n\n```JavaScript\nfetch(http://example.com/mypage)\n  .catch((err) =\u003e {\n    console.error('Could not track view.', err);\n    });\n```\n\nThe request will return a `204` HTTP status code without any content.\n\n### Get page count\n\nTo get the page view count of any endpoint call the same URL as above followed by `?count`.\n\n```\nhttp://example.com/mypage?count\n```\n\nThis will return a JSON object containing the accumulated views.\n\n```JavaScript\n{\"views\": 236}\n```\n\n### Get page views\n\nTo get the page view data for a specific path call the same URL again with `?views` at the end.\n\n```\nhttp://example.com/page?views\n```\n\nThe response is a JSON object containing an object for every view. For now the timestamp of the view is included. This can be expanded with more stats in the future.\n\n```JavaScript\n{\"views\":[{\"ts\":1484323190294}]}\n```\n\n### Get views for all paths\n\nCalling the root URL will return data for all tracked paths.\n\n```\nhttp://example.com/\n```\n\n## Motivation \u0026 goals\n\nMax Stoiber came up with the awesome idea of some minimal analytics Node server. As I dived into the code I came across some things I would have done different. Therefore I wanted to make something very similar that suits my needs. The following were the goals I wanted to achieve.\n\n### True micro\n\nI wanted to make a really small and consistent module. That means get along with a single file but keep it easily readable. The result are less than 100 LoC (with comments!) in a single file.\n\n**Note:** *Neither the original module nor my implementation are real microservices. Per definition microservices have to be stateless. The analytics servers are persisting data in a databases and are therefore stateful.*\n\n### Consistent URL structure\n\nI wanted to have a consisten and easy to remember URL structure. Firstly the server only accepts `get` requests. There is no need to allow more methods. Otherwise you might have to enable CORS features to enable cross-origin requests.\nTo utilize the root path it returns all data. For path specific data there are query args (see above).\n\n### Return value of tracking URLs\n\nThe tracking URLs are returning HTTP status code `204`. This tells us the server processed the request and doesn't return any data. To get the views we call the URL next off `?count`. This makes it very clear which url is tracking the view by calling it and which is not.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgraubner%2Ftrue-micro-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flgraubner%2Ftrue-micro-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgraubner%2Ftrue-micro-analytics/lists"}