lib2dex
v1.0.3
Published
Synchronize glucose data from FreeStyle Libre (LibreView/LibreLinkUp) to Dexcom Share accounts
Downloads
372
Maintainers
Readme
Lib2Dex
Synchronize glucose readings from FreeStyle Libre (via LibreView/LibreLinkUp) to Dexcom Share accounts.
Why Lib2Dex?
Some diabetes management apps and smartwatch applications only support Dexcom Share as a data source. If you use a FreeStyle Libre CGM but want to use these apps, Lib2Dex bridges the gap by mirroring your Libre glucose data to a Dexcom Share account.
Use Cases
- Smartwatch Apps: Access Libre data on watch faces and apps that only support Dexcom Share
- Family Monitoring: Share Libre data with family members using Dexcom Follow app
- Third-Party Apps: Use Libre data with apps that integrate with Dexcom Share API
- Backup Monitoring: Mirror data to multiple platforms for redundancy
Features
- Real-time glucose data synchronization
- Support for all LibreView regions (auto-detection)
- Support for US and international (OUS) Dexcom Share regions
- Daemon mode for continuous background sync
- Duplicate reading prevention
- Automatic session renewal
- Minimal dependencies (only
dotenv) - Pure Node.js implementation
Prerequisites
Before using Lib2Dex, you need:
LibreLinkUp Follower Account
- LibreLinkUp requires a separate follower account (you cannot use the primary Libre account directly)
- Set up follower sharing in the LibreLinkUp mobile app
- Invite yourself or create a second account to follow the primary account
Dexcom Share Account
- Create a Dexcom account at dexcom.com
- Enable Dexcom Share in the Dexcom app settings
- Note: You don't need a physical Dexcom device
Installation
From npm
npm install -g lib2dexFrom source
git clone https://github.com/faymaz/lib2dex.git
cd lib2dex
npm install
npm link # Optional: makes 'lib2dex' command available globallyConfiguration
- Copy the example configuration:
cp .env.example .env- Edit
.envwith your credentials:
# Source account (LibreView/LibreLinkUp - where data is read from)
[email protected]
SOURCE_PASSWORD=your_libre_password
SOURCE_REGION=eu
# Destination account (Dexcom Share - where data is written to)
DEST_USERNAME=your_dexcom_username
DEST_PASSWORD=your_dexcom_password
DEST_REGION=ous
# Sync settings
SYNC_INTERVAL_MINUTES=5
MAX_READINGS_PER_SYNC=12Usage
Test Connections
Verify your credentials are correct:
lib2dex --testSingle Sync
Run one sync operation and exit:
lib2dex --onceDaemon Mode (Recommended)
Run continuous synchronization:
lib2dex --daemonOr simply:
lib2dexVerify Data
Check that data was uploaded correctly:
lib2dex --verifyHelp
lib2dex --helpRunning as a Service
Using systemd (Linux)
Create /etc/systemd/system/lib2dex.service:
[Unit]
Description=Lib2Dex - LibreView to Dexcom Sync
After=network.target
[Service]
Type=simple
User=your-username
WorkingDirectory=/path/to/lib2dex
ExecStart=/usr/bin/node index.js --daemon
Restart=always
RestartSec=10
EnvironmentFile=/path/to/lib2dex/.env
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable lib2dex
sudo systemctl start lib2dexUsing PM2
npm install -g pm2
pm2 start index.js --name lib2dex -- --daemon
pm2 save
pm2 startupUsing Docker
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
CMD ["node", "index.js", "--daemon"]docker build -t lib2dex .
docker run -d --env-file .env --name lib2dex lib2dexConfiguration Options
| Variable | Description | Default |
|----------|-------------|---------|
| SOURCE_EMAIL | LibreLinkUp follower email | Required |
| SOURCE_PASSWORD | LibreLinkUp password | Required |
| SOURCE_REGION | LibreView region (eu, us, de, etc.) | Auto-detect |
| DEST_USERNAME | Dexcom Share username | Required |
| DEST_PASSWORD | Dexcom Share password | Required |
| DEST_REGION | Dexcom region: us or ous | ous |
| SYNC_INTERVAL_MINUTES | Sync frequency in minutes | 5 |
| MAX_READINGS_PER_SYNC | Max readings per sync cycle | 12 |
| SERIAL_NUMBER | Virtual receiver ID | Auto-generated |
| LOG_LEVEL | Logging level: info, debug | info |
How It Works
┌─────────────────┐ ┌─────────────┐ ┌──────────────────┐
│ FreeStyle │ ──────► │ LibreView │ ──────► │ Lib2Dex │
│ Libre Sensor │ │ Cloud │ │ (this app) │
└─────────────────┘ └─────────────┘ └────────┬─────────┘
│
▼
┌─────────────────┐ ┌─────────────┐ ┌──────────────────┐
│ Dexcom Follow │ ◄────── │ Dexcom │ ◄────── │ Virtual │
│ Apps, Loop, │ │ Share │ │ Receiver │
│ Omnipod 5 │ │ Cloud │ │ (LB-XXXXXX) │
└─────────────────┘ └─────────────┘ └──────────────────┘- Read: Fetches glucose readings from LibreView/LibreLinkUp API
- Transform: Converts LibreView format to Dexcom format (including trend arrows)
- Deduplicate: Filters out already-synced readings
- Upload: Posts readings to Dexcom Share as a virtual receiver
- Repeat: Runs continuously in daemon mode
Trend Arrow Mapping
| LibreView | Description | Dexcom | |-----------|-------------|--------| | 1 | Falling quickly | ↓↓ (DoubleDown) | | 2 | Falling | ↓ (SingleDown) | | 3 | Falling slowly | ↘ (FortyFiveDown) | | 4 | Stable | → (Flat) | | 5 | Rising slowly | ↗ (FortyFiveUp) | | 6 | Rising | ↑ (SingleUp) | | 7 | Rising quickly | ↑↑ (DoubleUp) |
Troubleshooting
"No LibreLinkUp connections found"
- Make sure you've set up follower sharing in the LibreLinkUp mobile app
- Use a follower account, not the primary Libre account
- The person you're following must have shared their data with you
"Account authentication failed"
- Verify your credentials in the
.envfile - For LibreView: Use the email/password from the LibreLinkUp app (not FreeStyle Libre app)
- For Dexcom: Use the same credentials as dexcom.com or the Dexcom app
"Session expired"
This is normal and handled automatically. The app will re-authenticate and retry.
Rate Limiting (429 errors)
If you see rate limiting errors, increase SYNC_INTERVAL_MINUTES to reduce API calls.
Related Projects
- dex2com - Sync between Dexcom Share accounts
- jsdexcom - Pure JS Dexcom Share client
- libre3view - GNOME Shell extension for Libre
Security Notes
- Credentials are stored locally in your
.envfile - Never commit your
.envfile to version control - All API communication uses HTTPS
- No data is stored except temporary timestamps for deduplication
Disclaimer
This project is not affiliated with, endorsed by, or connected to Abbott (FreeStyle Libre) or Dexcom. Use at your own risk. This is an unofficial tool that uses undocumented APIs which may change at any time.
This software is not intended for use in any medical decision-making. Always rely on your actual CGM device for treatment decisions.
License
MIT License - see LICENSE file.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
