{"id":19237165,"url":"https://github.com/epicweb-dev/remember","last_synced_at":"2026-03-05T22:08:12.070Z","repository":{"id":193799154,"uuid":"689524762","full_name":"epicweb-dev/remember","owner":"epicweb-dev","description":"Simple, type-safe, \"singleton\" implementation.","archived":false,"fork":false,"pushed_at":"2025-10-23T00:05:10.000Z","size":10,"stargazers_count":134,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-23T02:17:03.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/@epic-web/remember","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/epicweb-dev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-10T04:46:47.000Z","updated_at":"2025-10-23T00:05:10.000Z","dependencies_parsed_at":"2026-01-19T06:04:28.435Z","dependency_job_id":null,"html_url":"https://github.com/epicweb-dev/remember","commit_stats":null,"previous_names":["epicweb-dev/remember"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/epicweb-dev/remember","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epicweb-dev%2Fremember","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epicweb-dev%2Fremember/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epicweb-dev%2Fremember/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epicweb-dev%2Fremember/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epicweb-dev","download_url":"https://codeload.github.com/epicweb-dev/remember/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epicweb-dev%2Fremember/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30152075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T21:15:50.531Z","status":"ssl_error","status_checked_at":"2026-03-05T21:15:11.173Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-11-09T16:25:07.270Z","updated_at":"2026-03-05T22:08:12.044Z","avatar_url":"https://github.com/epicweb-dev.png","language":"JavaScript","readme":"\u003cdiv\u003e\n  \u003ch1 align=\"center\"\u003e\u003ca href=\"https://npm.im/@epic-web/remember\"\u003e🤔 @epic-web/remember\u003c/a\u003e\u003c/h1\u003e\n  \u003cstrong\u003e\n    Simple, type-safe, \"singleton\" implementation.\n  \u003c/strong\u003e\n  \u003cp\u003e\n    For when your \"hot module replacement\" involves re-evaluating a module, but\n    you don't want to actually re-evaluate a portion of it.\n  \u003c/p\u003e\n\u003c/div\u003e\n\n```\nnpm install @epic-web/remember\n```\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca\n    alt=\"Epic Web logo\"\n    href=\"https://www.epicweb.dev\"\n  \u003e\n    \u003cimg\n      width=\"300px\"\n      src=\"https://github-production-user-asset-6210df.s3.amazonaws.com/1500684/257881576-fd66040b-679f-4f25-b0d0-ab886a14909a.png\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003chr /\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[![Build Status][build-badge]][build]\n[![GPL 3.0 License][license-badge]][license]\n[![Code of Conduct][coc-badge]][coc]\n\u003c!-- prettier-ignore-end --\u003e\n\n## The problem\n\nYou're using a framework like Remix with\n[`--manual` mode](https://remix.run/docs/en/guides/manual-mode) and\nre-evaluating your modules on every change. But you have some state that you\ndon't want to lose between changes. For example:\n\n- Database connections\n- In-memory caches\n\n## This solution\n\nThis was copy/paste/modified/tested from\n[@jenseng's `abuse-the-platform` demo](https://github.com/jenseng/abuse-the-platform/blob/2993a7e846c95ace693ce61626fa072174c8d9c7/app/utils/singleton.ts)\n(ISC). It's basically a type-safe singleton implementation that you can use to\nkeep state between module re-evaluations.\n\n## Usage\n\n```tsx\nimport { remember } from '@epic-web/remember'\n\nexport const prisma = remember('prisma', () =\u003e new PrismaClient())\n```\n\nKeep in mind that any changes you make within that callback will not be\nreflected when the module is re-evaluated (that's the whole point). So if you\nneed to change the callback, then you'll need to restart your server.\n\n#### Forget a value\n\nIt might be required to explicitly forget a value if it gets outdated, a memorized\nconnection gets lost or memorized instance closes/errors/etc.\n\n```tsx\nimport { remember, forget } from '@epic-web/remember'\n\nexport const server = remember('server', () =\u003e\n    http.createServer().listen('8080')\n        .on('close', () =\u003e forget('server')))\n```\n\n## License\n\nMIT\n\n## Credit\n\nThe original code was written by [@jenseng](https://github.com/jenseng) and then\nI modified it and published it to fit my needs.\n\n\u003c!-- prettier-ignore-start --\u003e\n[build-badge]: https://img.shields.io/github/actions/workflow/status/epicweb-dev/remember/release.yml?branch=main\u0026logo=github\u0026style=flat-square\n[build]: https://github.com/epicweb-dev/remember/actions?query=workflow%3Arelease\n[license-badge]: https://img.shields.io/badge/license-GPL%203.0%20License-blue.svg?style=flat-square\n[license]: https://github.com/epicweb-dev/remember/blob/main/LICENSE\n[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square\n[coc]: https://kentcdodds.com/conduct\n\u003c!-- prettier-ignore-end --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepicweb-dev%2Fremember","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepicweb-dev%2Fremember","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepicweb-dev%2Fremember/lists"}