# spaansba/ForesightJS

Lightweight JavaScript library that predicts user intent based on mouse movements and keyboard navigation. Perfect for smart prefetching. Also works for mobile!

Repository: https://github.com/spaansba/ForesightJS
Canonical: https://ross.abutalabs.com/products/spaansba-foresightjs
Homepage: https://foresightjs.com/
Language: TypeScript
License: MIT
License Family: permissive
Topics: mouse-tracking, prefetching, keyboard-tracking, performance-optimization
Last push: 2026-07-27T07:33:56+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 94, release rhythm 92, longevity 34
- inputs: {"age_days": 482, "days_push": 37, "days_rel": 56, "gap_med": 3, "n_releases_24m": 26}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1803, forks 40 (observed 2026-08-28T04:05:38.269923+00:00)

## What it is
ForesightJS is a lightweight, framework-agnostic JavaScript library that predicts user intent from mouse trajectory, keyboard navigation, scroll, and touch cues to trigger prefetching before a user reaches a link or element. It ships official integrations for React, Vue, Angular, and Astro, plus devtools for visual debugging.

## Use cases
- prefetch links before the user hovers them
- predict user intent from mouse movement
- prefetch on keyboard tab navigation
- smart prefetching for mobile touch devices
- reduce perceived page load times
- prefetch content when user scrolls toward an element
- respect data-saver and slow connections when prefetching

## When to choose
- you want intent-based prefetching that works out of the box with zero configuration
- you need framework-agnostic prefetching with official React, Vue, Angular, or Astro adapters
- you want to support both desktop (mouse/keyboard) and mobile (touch/viewport) prediction strategies
- you need to avoid wasting bandwidth on slow connections or data-saver mode

## When to avoid
- you only need simple hover or click prefetching without intent prediction
- your app is not browser-based (e.g., server-side or native-only)
- you cannot tolerate any client-side JavaScript overhead for tracking user input

## Facets
- artifact type: library
- maturity: active
- function: caching, developer-tools, middleware
- domain: web-development, frontend, performance
- platform: browser, cross-platform
- tags: prefetching, intent-prediction, mouse-trajectory, keyboard-navigation, smart-prefetch, react, vue, angular, astro, typescript, web-server

## Member repositories
- spaansba/ForesightJS (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:38.269923+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:21:53.024350+00:00, confidence not recorded.
  - readme: https://github.com/spaansba/ForesightJS (fetched 2026-08-28T04:05:38.269923+00:00, sha 8dffe521fe43)
  - homepage: https://foresightjs.com/ (fetched 2026-08-29T11:01:05.042560+00:00, sha 842bbc84ea7f)
  - site_page: https://foresightjs.com/docs/getting-started/what-is-foresightjs (fetched 2026-08-29T11:01:05.045233+00:00, sha 27b2bf0176af)
  - site_page: https://foresightjs.com/docs/3.5/getting-started/what-is-foresightjs (fetched 2026-08-29T11:01:05.047274+00:00, sha 1c6729133bcc)
  - site_page: https://foresightjs.com/docs/debugging/devtools (fetched 2026-08-29T11:01:05.049071+00:00, sha c6fc0295ef3f)
  - site_page: https://foresightjs.com/docs/getting-started/quick-start (fetched 2026-08-29T11:01:05.050737+00:00, sha 99c41389dafd)
  - site_page: https://foresightjs.com/docs/configuration/global-settings (fetched 2026-08-29T11:01:05.052250+00:00, sha 2949c734fcd0)
- Data as of 2026-08-30T08:39:29.467469+00:00.
