{"id":21083304,"url":"https://github.com/mudafar/predictive-prefetch","last_synced_at":"2025-08-31T04:06:59.559Z","repository":{"id":57329676,"uuid":"376917462","full_name":"mudafar/predictive-prefetch","owner":"mudafar","description":"A JavaScript client-side predictive prefetch solution for Webpack and SPAs. An alternative to Guess.js.","archived":false,"fork":false,"pushed_at":"2021-06-21T00:41:01.000Z","size":155,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T09:43:07.825Z","etag":null,"topics":["javascript","prediction","predictive","predictive-prefetching","prefetching","react","spa","webpack"],"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/mudafar.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":"2021-06-14T18:17:34.000Z","updated_at":"2025-04-29T09:34:28.000Z","dependencies_parsed_at":"2022-09-26T16:31:18.439Z","dependency_job_id":null,"html_url":"https://github.com/mudafar/predictive-prefetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mudafar/predictive-prefetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudafar%2Fpredictive-prefetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudafar%2Fpredictive-prefetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudafar%2Fpredictive-prefetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudafar%2Fpredictive-prefetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mudafar","download_url":"https://codeload.github.com/mudafar/predictive-prefetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudafar%2Fpredictive-prefetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272936421,"owners_count":25018160,"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-31T02:00:09.071Z","response_time":79,"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":["javascript","prediction","predictive","predictive-prefetching","prefetching","react","spa","webpack"],"created_at":"2024-11-19T20:17:31.922Z","updated_at":"2025-08-31T04:06:59.530Z","avatar_url":"https://github.com/mudafar.png","language":"JavaScript","readme":"# Predictive Prefetch js \u0026middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mudafar/predictive-prefetch/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/predictive-prefetch.svg?style=flat)](https://www.npmjs.com/package/predictive-prefetch)  ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)\n\n100% client side, out of the box predictive prefetch solution for webpack and modern SPAs, based on **[alz-predictor](https://github.com/mudafar/alz-predictor/)**. \n\n\n* **Webpack:** Learn, predict and prefetch JavaScript modules or [chunks](https://webpack.js.org/guides/code-splitting) and other supported assets in runtime.    \n\n\n* **SPA:** Predict and prefetch user's next Route or URL, e.g: from [React Router](https://reactrouter.com/).\n\n* Unlike [Guess.js](https://github.com/guess-js/guess), Predictive Prefetch **doesn't** require any third party data analytics sources.\n\n\n## Why?\n  - Speed up user future navigation.\n  - 100% frontend AI solution. \n  - Privacy, data is stored and kept locally. \n\n\n## FAQ      \n\n## How it works?\n- Monitor any [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) change in the document object looking for JavaScript tags and other supported assets.\n\n- Intercept [history](https://developer.mozilla.org/en-US/docs/Web/API/History) pushState looking for changes in routes.\n\n- Train **[ALZ Predictor](https://github.com/mudafar/alz-predictor/)** and predict next asset or route.\n\n- Add link tag with **[prefetch](https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ)** rel for the previous prediction.\n\n\n## Installation\n```bash\n# Yarn\nyarn add predictive-prefetch\n\n# NPM\nnpm install --save predictive-prefetch\n\n```\n\n\n## Usage\n\n```js\nimport PredictivePrefetch from 'predictive-prefetch'\n\nPredictivePrefetch();\n\n```\n\n\n## Configuration\nPredictive Prefetch includes options for:\n- assets: disable script and/or other resources monitoring.\n- urls: disable url intercepting.\n- predictor: calibrate prefetch minimum probability.\n\n### Default options\n```js\nimport PredictivePrefetch from 'predictive-prefetch'\n\nconst options = {\n    assets: {\n        scriptsDisabled: false, \n        resourcesDisabled: true,\n        };\n    urls: {\n        disabled: false,\n    };\n    predictos: {\n        minProbability: 0.7,\n    };\n};\n\nPredictivePrefetch(options);\n```\n\n\n\n## License\nPredictive Prefetch is [MIT licensed](./LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudafar%2Fpredictive-prefetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmudafar%2Fpredictive-prefetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudafar%2Fpredictive-prefetch/lists"}