npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsdexcom

v2.2.0

Published

Node.js library for accessing Dexcom Share API with international support

Readme

Visitor Count

npm version License: MIT

Language EN

Author: faymaz

@faymaz/jsdexcom

Node.js library for accessing Dexcom Share API with international support. This library allows you to fetch real-time CGM (Continuous Glucose Monitor) data from Dexcom Share servers.

This extension is not affiliated, funded, or in any way associated with Dexcom.

Requirements

  • Node.js 18 or higher
  • Active Dexcom Share account
  • Share feature enabled in Dexcom mobile app

Installation

npm install @faymaz/jsdexcom

Usage

Basic Usage - Latest Version

import JSDexcom from '@faymaz/jsdexcom';

async function monitorGlucose() {
   
    const dexcom = new JSDexcom('USERNAME', 'PASSWORD', 'ous');

    try {
       
        const result = await dexcom.getLatestGlucoseWithDelta();

        console.log(`Current: ${result.current._value} mg/dL ${result.current._trend_arrow}`);
        console.log(`Change: ${result.current._delta} mg/dL`);
        console.log(`Trend: ${result.current._trend_description}`);
        console.log(`Rate: ${result.current._rate_of_change.toFixed(2)} mg/dL/min`);
        console.log(`Status: ${result.current._status}`);

    } catch (error) {
        console.error('Error:', error.message);
    }
}

Package.json Configuration

{
  "type": "module",
  "dependencies": {
    "@faymaz/jsdexcom": "*"
  }
}

Detailed Example with Delta Analysis

import JSDexcom from '@faymaz/jsdexcom';

async function getDexcomData() {
    try {
       
        const dexcom = new JSDexcom('USERNAME', 'PASSWORD', 'ous');
        
       
        const result = await dexcom.getLatestGlucoseWithDelta();
        
       
        console.log('\nCurrent Reading:');
        console.log(`Value: ${result.current._value} mg/dL ${result.current._trend_arrow}`);
        console.log(`Time: ${result.current._datetime.toLocaleString()}`);
        console.log(`Status: ${result.current._status}`);
        
       
        if (result.current._delta !== null) {
            console.log('\nTrend Analysis:');
            console.log(`Change: ${result.current._delta > 0 ? '+' : ''}${result.current._delta} mg/dL`);
            console.log(`Rate: ${result.current._rate_of_change.toFixed(2)} mg/dL/min`);
            console.log(`Trend: ${result.current._trend_description}`);
            
            console.log('\nPrevious Reading:');
            console.log(`Value: ${result.previous._value} mg/dL ${result.previous._trend_arrow}`);
            console.log(`Time: ${result.previous._datetime.toLocaleString()}`);
        }

    } catch (error) {
        handleError(error);
    }
}

function handleError(error) {
    if (error.message.includes('No readings available')) {
        console.error('No recent glucose readings found');
    } else if (error.message.includes('Invalid credentials')) {
        console.error('Check your Dexcom Share username and password');
    } else if (error.message.includes('Authentication failed')) {
        console.error('Could not connect to Dexcom. Check your internet connection');
    } else {
        console.error('Error:', error.message);
    }
}

Continuous Monitoring Example

async function monitorGlucose(intervalMinutes = 5) {
    try {
        const dexcom = new JSDexcom('USERNAME', 'PASSWORD', 'ous');
        
        setInterval(async () => {
            try {
                const result = await dexcom.getLatestGlucoseWithDelta();
                
               
                console.log('\nNew Reading:');
                console.log(`Time: ${result.current._datetime.toLocaleString()}`);
                console.log(`Value: ${result.current._value} mg/dL ${result.current._trend_arrow}`);
                console.log(`Status: ${result.current._status}`);
                
                if (result.current._delta !== null) {
                    console.log(`Change: ${result.current._delta > 0 ? '+' : ''}${result.current._delta} mg/dL`);
                    console.log(`Rate: ${result.current._rate_of_change.toFixed(2)} mg/dL/min`);
                    console.log(`Trend: ${result.current._trend_description}`);
                }
                
               
                if (result.current._status === 'LOW') {
                    console.error('⚠️ LOW GLUCOSE ALERT!');
                } else if (result.current._status === 'HIGH') {
                    console.error('⚠️ HIGH GLUCOSE ALERT!');
                }
                
                if (Math.abs(result.current._rate_of_change) > 3) {
                    console.warn('⚠️ Rapid glucose change detected!');
                }
                
            } catch (error) {
                console.error('Monitoring error:', error.message);
            }
        }, intervalMinutes * 60 * 1000);
        
    } catch (error) {
        console.error('Failed to start monitoring:', error.message);
    }
}

// Start monitoring every 5 minutes
monitorGlucose(5);

Region-Specific Usage

// For US users
const dexcomUS = new JSDexcom('USERNAME', 'PASSWORD', 'us');

// For International users (default)
const dexcomOUS = new JSDexcom('USERNAME', 'PASSWORD', 'ous');

// For Japan users
const dexcomJP = new JSDexcom('USERNAME', 'PASSWORD', 'jp');

Response Format

{
    current: {
        _json: {
            WT: "Date timestamp",
            ST: "Date timestamp",
            DT: "Date timestamp",
            Value: 120,
            Trend: "Flat"
        },
        _value: 120,               
        _trend_direction: "Flat",  
        _trend_arrow: "→",        
        _datetime: Date,          
        _status: "IN RANGE",      
        _delta: 5,                
        _delta_time: 5,           
        _rate_of_change: 1.0,     
        _trend_description: "Rising slowly"
    },
    previous: {
       
    }
}

Trend Arrows

| Trend | Arrow | Description | | -------------- | ----- | ---------------------- | | None | → | No trend | | DoubleUp | ↑↑ | Rising quickly | | SingleUp | ↑ | Rising | | FortyFiveUp | ↗ | Rising slowly | | Flat | → | Stable | | FortyFiveDown | ↘ | Falling slowly | | SingleDown | ↓ | Falling | | DoubleDown | ↓↓ | Falling quickly | | NotComputable | ? | Cannot determine trend | | RateOutOfRange | ⚠️ | Rate of change unknown |

Trend Descriptions

| Delta Range (mg/dL) | Description | | ------------------ | ---------------- | | > +15 | Rising quickly | | +7 to +15 | Rising | | +3 to +7 | Rising slowly | | -3 to +3 | Stable | | -7 to -3 | Dropping slowly | | -15 to -7 | Dropping | | < -15 | Dropping quickly |

Environment Variables

You can use environment variables for configuration:

DEXCOM_USERNAME=your-username
DEXCOM_PASSWORD=your-password
DEXCOM_REGION=ous  # or 'us' or 'jp'

Command Line Testing

# Create test file (test.js)
import JSDexcom from '@faymaz/jsdexcom';

async function test() {
    const dexcom = new JSDexcom(
        process.env.DEXCOM_USERNAME,
        process.env.DEXCOM_PASSWORD,
        process.env.DEXCOM_REGION || 'ous'
    );
    
    const result = await dexcom.getLatestGlucoseWithDelta();
    console.log(JSON.stringify(result, null, 2));
}

test();

# Run test
DEXCOM_USERNAME=xxx DEXCOM_PASSWORD=yyy node test.js

License

MIT

Author

faymaz - GitHub

Disclaimer

This project is not affiliated with Dexcom, Inc. Use at your own risk. Always verify glucose values using your official Dexcom receiver or app.