Installations
npm install @webscopeio/react-health-check
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.6.0
NPM Version
8.13.2
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (92.05%)
JavaScript (7.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
webscopeio
Download Statistics
Total Downloads
28,961
Last Day
19
Last Week
201
Last Month
972
Last Year
6,827
GitHub Statistics
MIT License
36 Stars
147 Commits
9 Forks
4 Watchers
13 Branches
5 Contributors
Updated on Jan 26, 2025
Bundle Size
4.05 kB
Minified
1.63 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.1
Package Id
@webscopeio/react-health-check@3.0.1
Unpacked Size
13.84 kB
Size
5.04 kB
File Count
9
NPM Version
8.13.2
Node Version
18.6.0
Total Downloads
Cumulative downloads
Total Downloads
28,961
Last Day
-45.7%
19
Compared to previous day
Last Week
-28%
201
Compared to previous week
Last Month
326.3%
972
Compared to previous month
Last Year
-35.8%
6,827
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
21
React Health Check 🏥
Lightweight React hook for checking health of API services.
Installation 🧑🔧
npm i @webscopeio/react-health-check
or
yarn add @webscopeio/react-health-check
Examples 😲
Usage ❓
1const { available, refresh } = useHealthCheck({
2 service: {
3 name: 'auth',
4 url: 'https://example.com/auth/health',
5 },
6 onSuccess: ({ service, timestamp }) => {
7 console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`);
8 },
9 onError: ({ service, timestamp }) => {
10 console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`);
11 },
12});
You can also create a global configuration so you don't have to define services and callbacks every time:
1// App wrapper 2<HealthCheckConfig 3 value={{ 4 services: [ 5 { 6 name: 'auth', 7 url: 'https://example.com/auth/health', 8 }, 9 { 10 name: 'payment', 11 url: 'https://example.com/payment/health', 12 }, 13 ], 14 onSuccess: ({ service, timestamp }) => { 15 console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`); 16 }, 17 onError: ({ service, timestamp }) => { 18 console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`); 19 }, 20 }} 21> 22 <App /> 23</HealthCheckConfig>; 24 25// Later in some child component 26const { available } = useHealthCheck('auth');
Configuration 🛠
useHealthCheck()
hook accepts a configuration object with keys:
Key | Type | Description |
---|---|---|
service | Service<S = string> | Object defining an API service to be checked. |
onSuccess | (state: ServiceState<S>) => void; | Callback which should be called when API service becomes available again. |
onError | (state: ServiceState<S>) => void; | Callback which should be called when API service becomes unavailable. |
refreshInterval | number | Polling interval for health checks in milliseconds. Default value: 5000 |
refreshWhileHidden | boolean | Determines whether polling should be paused while browser window isn't visible. Default value: false |
Global configuration accepts the same keys as useHealthCheck()
hook with the exception of "service". You need to specify array of "services" when using global configuration.
License 💼
MIT | Developed by Webscope.io

No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/webscopeio/react-health-check/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/webscopeio/react-health-check/node.js.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
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
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Reason
54 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-7gc6-qh9x-w6h8
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-vxf5-wxwp-m7g9
- Warn: Project is vulnerable to: GHSA-25mp-g6fv-mqxx
- Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc
- Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-cwx2-736x-mf6w
- Warn: Project is vulnerable to: GHSA-v39p-96qg-c8rf
- Warn: Project is vulnerable to: GHSA-8v63-cqqc-6r2c
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-566m-qj78-rww5
- Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-x56p-c8cg-q435
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More