{"id":19343245,"url":"https://github.com/swashcap/fastify-als-demo","last_synced_at":"2026-05-04T12:36:38.135Z","repository":{"id":42852945,"uuid":"261243191","full_name":"swashcap/fastify-als-demo","owner":"swashcap","description":"A demo with Fastify and Node.js's AsyncLocalStorage","archived":false,"fork":false,"pushed_at":"2022-03-26T15:44:43.000Z","size":463,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T03:04:26.612Z","etag":null,"topics":["fastify","nodejs"],"latest_commit_sha":null,"homepage":null,"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/swashcap.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":"2020-05-04T16:51:54.000Z","updated_at":"2020-11-17T07:44:22.000Z","dependencies_parsed_at":"2022-09-22T03:11:34.162Z","dependency_job_id":null,"html_url":"https://github.com/swashcap/fastify-als-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/swashcap/fastify-als-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashcap%2Ffastify-als-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashcap%2Ffastify-als-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashcap%2Ffastify-als-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashcap%2Ffastify-als-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swashcap","download_url":"https://codeload.github.com/swashcap/fastify-als-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashcap%2Ffastify-als-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32607926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"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":["fastify","nodejs"],"created_at":"2024-11-10T03:37:49.384Z","updated_at":"2026-05-04T12:36:38.119Z","avatar_url":"https://github.com/swashcap.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-als-demo\n\nA demo with [Fastify](https://www.fastify.io) and Node.js's\n[`AsyncLocalStorage`](https://nodejs.org/api/async_hooks.html#async_hooks_class_asynclocalstorage).\n\n## Performance comparison:\n\nSome basic metrics when running locally on the dev machine:\n\n```shell\nab -n 1000 -c 10 \"http://127.0.0.1:3000/\"\n```\n\n### async-local-storage\n\n* Maximum MEM (via `top`): 23M\n* Requests (via `ab`):\n\n    ```\n    Requests per second:    93.49 [#/sec] (mean)\n    Time per request:       106.967 [ms] (mean)\n    Time per request:       10.697 [ms] (mean, across all concurrent requests)\n    ```\n\n### logger-passing\n\n* Maximum MEM (via `top`): 27M\n* Requests (via `ab`):\n\n    ```\n    Requests per second:    93.56 [#/sec] (mean)\n    Time per request:       106.880 [ms] (mean)\n    Time per request:       10.688 [ms] (mean, across all concurrent requests)\n    ```\n\n## Setup\n\nWith [Node.js](https://nodejs.org/en/) (\u003e=14.1.x) and\n[yarn](https://yarnpkg.com) (\u003e=1.22.x) installed:\n\n1. Install dependencies:\n\n    ```shell\n    yarn\n    ```\n2. Build the project:\n\n    ```shell\n    yarn build\n    ```\n3. Run the server:\n\n    ```shell\n    yarn start\n    ```\n4. Send a request:\n\n    ```shell\n    curl localhost:3000\n    {\"data\":{\"mock\":\"mock\"}}\n    ```\n\nYou should see trace-able `requestId` properties on log events. For example,\nwith `yarn --silent start | jq`:\n\n```shell\n{\n  \"level\": 30,\n  \"time\": 1588610966799,\n  \"pid\": 5721,\n  \"hostname\": \"swash.local\",\n  \"reqId\": 1,\n  \"req\": {\n    \"method\": \"GET\",\n    \"url\": \"/\",\n    \"hostname\": \"localhost:3000\",\n    \"remoteAddress\": \"127.0.0.1\",\n    \"remotePort\": 54634\n  },\n  \"requestId\": \"382a4b0b-fc29-4e12-9862-10bc300ce2bb\",\n  \"msg\": \"incoming request\"\n}\n{\n  \"level\": 30,\n  \"time\": 1588610966902,\n  \"pid\": 5721,\n  \"hostname\": \"swash.local\",\n  \"mockApi\": \"1.0.0\",\n  \"message\": \"end\",\n  \"requestId\": \"382a4b0b-fc29-4e12-9862-10bc300ce2bb\"\n}\n{\n  \"level\": 30,\n  \"time\": 1588610966907,\n  \"pid\": 5721,\n  \"hostname\": \"swash.local\",\n  \"reqId\": 1,\n  \"res\": {\n    \"statusCode\": 200\n  },\n  \"responseTime\": 108.17437699995935,\n  \"requestId\": \"382a4b0b-fc29-4e12-9862-10bc300ce2bb\",\n  \"msg\": \"request completed\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswashcap%2Ffastify-als-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswashcap%2Ffastify-als-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswashcap%2Ffastify-als-demo/lists"}