
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@profullstack/fasting
Advanced tools
A comprehensive CLI and Node.js module for 16:8 intermittent fasting with meal tracking, weight monitoring, and fast history with visual charts
A comprehensive CLI and Node.js module for 16:8 intermittent fasting with meal tracking, weight monitoring, and fast history with visual charts.
pnpm install
pnpm link --global
fasting setup
The setup command will prompt you for your OpenAI API key and save it securely to ~/.config/fasting/config.json.
Alternative: You can also set the OPENAI_API_KEY environment variable if you prefer.
fasting setup --supabase
This will prompt you for your Supabase configuration and enable cloud storage for your data.
To run the CLI locally during development:
# Option 1: Direct execution
node bin/cli.js summary
node bin/cli.js fast start
node bin/cli.js meal "Chicken salad" --calories 350
# Option 2: After linking globally
pnpm link --global
fasting summary
fasting fast start
# Option 3: Using pnpm exec
pnpm exec fasting summary
# Start a fast (uses current time)
fasting fast start
# Start a fast at a specific time
fasting fast start --time "18:00"
fasting fast start --time "2023-12-01 18:00"
# End a fast (uses current time)
fasting fast end
# End a fast at a specific time
fasting fast end --time "10:00"
# Calories are automatically estimated using AI
fasting meal "Grilled chicken breast with quinoa"
fasting drink "Orange juice"
# Specify portion sizes for more accurate estimates
fasting meal "Pizza" --size "2 slices"
fasting drink "Orange juice" --size "32oz"
fasting meal "Salad" -s "large"
# Calories burned are automatically estimated using AI and your weight
fasting exercise "Running" 30
fasting exercise "Weight lifting" 45
fasting exercise "Yoga" 60
# Override automatic estimation with manual calories
fasting exercise "Swimming" 30 --calories 400
fasting weight 200
fasting summary # Comprehensive dashboard with charts
fasting summary --weight-chart # Show only weight chart
fasting summary --fast-chart # Show only fast duration chart
fasting summary --calorie-chart # Show only daily calorie chart
fasting summary --exercise-chart # Show only exercise calories burned chart
# Override automatic estimation with manual calories
fasting meal "Chicken Salad" -c 450
fasting drink "Black Coffee" -c 5
# Combine size specification with manual override
fasting drink "Smoothie" --size "16oz" --calories 350
fast <start|end> - Start or end a fast with optional custom timingmeal <description> - Log a meal with automatic calorie estimationdrink <description> - Log a drink with automatic calorie estimationexercise <description> <duration> - Log exercise with automatic calorie burn estimationweight <value> - Log weight in poundssummary - Show comprehensive dashboard with current status, charts, and historysetup - Configure OpenAI API key for automatic calorie estimationsetup --supabase - Configure Supabase cloud storagesetup --local - Switch to local file storageclean - Delete all stored data (meals, weight, fasts, exercises)Fast Command:
-t, --time <time> - Specify start/end time
Meal/Drink Commands:
-c, --calories <number> - Override automatic calorie estimation with manual value-s, --size <size> - Specify portion size for more accurate calorie estimation
Exercise Command:
-c, --calories <number> - Override automatic calorie burn estimation with manual value<duration> - Duration in minutes (required)Summary Command:
--weight-chart - Show only weight trend chart--fast-chart - Show only fast duration chart--calorie-chart - Show only daily calorie intake chart--exercise-chart - Show only daily exercise calories burned chartClean Command:
--config - Also delete API key configurationfasting-app/
├── bin/
│ └── cli.js
├── lib/
│ ├── index.js
│ ├── fasting.js
│ ├── weight.js
│ ├── calorie-estimator.js
│ └── config.js
├── .env.example
└── README.md
~/.config/fasting/
├── config.json # API key and settings
├── meals.json # Meal and drink logs
├── weight.json # Weight history
├── fasts.json # Fast tracking history
└── exercises.json # Exercise logs
The app tracks your intermittent fasting periods:
Automatic calorie estimation using OpenAI's GPT-4o model:
--size for more accurate estimates-c flag if neededThe app estimates calories burned using OpenAI's GPT-4o model and your current weight:
-c flag to specify exact calories burned if neededThe app supports optional cloud storage using Supabase for data synchronization across devices:
fasting setup --supabase to configure cloud storagefasting setup --localRequired Supabase Configuration:
Environment Variables (optional):
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
FASTING_STORAGE_MODE=supabase # or 'local'
The app stores all data in ~/.config/fasting/ for secure, persistent access:
fasting setup to configure or update your API keyOPENAI_API_KEY as an alternative (takes precedence)fasting clean to delete meals/weight datafasting clean --config to delete everything including API key# Delete meals, weight, and fast data (keeps API key)
fasting clean
# Delete everything including API key configuration
fasting clean --config
If the OpenAI API is unavailable, the app falls back to default estimates (200 calories for meals, 50 for drinks).
This package can also be used as a Node.js module in your own applications:
import {
logMeal, logDrink, getTodaysEntries, getCalorieHistory,
logWeight, getWeightHistory,
startFast, endFast, getCurrentFast, getFastHistory, getFastStats,
logExercise, getTodaysExercises, getExerciseHistory
} from 'fasting-app';
// Fast tracking
startFast(); // Start fast now
startFast('2023-12-01 18:00'); // Start fast at specific time
const currentFast = getCurrentFast(); // Get active fast
const completedFast = endFast(); // End current fast
// Log meals and drinks programmatically
logMeal('Grilled chicken breast', 350);
logDrink('Orange juice', 120);
// Get today's entries
const todaysEntries = getTodaysEntries();
console.log(todaysEntries);
// Weight tracking
logWeight(175.5);
const weightHistory = getWeightHistory();
// Fast history and statistics
const fastHistory = getFastHistory(); // Completed fasts only
const fastStats = getFastStats(); // Statistics summary
// Calorie history
const calorieHistory = getCalorieHistory(); // Daily calorie totals
// Exercise tracking
logExercise('Running', 30, 300); // description, duration (min), calories burned
const todaysExercises = getTodaysExercises(); // Today's exercises
const exerciseHistory = getExerciseHistory(); // Daily exercise calorie totals
Fast Tracking:
startFast(startTime?) - Start a new fast (optional custom start time)endFast(endTime?) - End current fast (optional custom end time)getCurrentFast() - Get active fast or nullgetFastHistory() - Get all completed fastsgetFastStats() - Get fast statistics (average, longest, etc.)Meal & Weight Tracking:
logMeal(description, calories) - Log a meal with description and calorie countlogDrink(description, calories) - Log a drink with description and calorie countgetTodaysEntries() - Get all meals and drinks logged todaygetCalorieHistory() - Get daily calorie totals grouped by datelogWeight(weight) - Log weight in poundsgetWeightHistory() - Get complete weight history with timestampsExercise Tracking:
logExercise(description, duration, caloriesBurned) - Log exercise with description, duration (minutes), and calories burnedgetTodaysExercises() - Get all exercises logged todaygetExerciseHistory() - Get daily exercise calorie totals grouped by dateNote: When using the module API, you need to provide calorie counts manually. Automatic calorie estimation via OpenAI is only available through the CLI commands.
The project includes comprehensive unit tests for all functionality:
# Run all tests
pnpm test
# Run specific test suites
pnpm test:fast # Fast tracking tests
pnpm test:charts # Chart generation tests
pnpm test:fasting # Meal/drink logging tests
pnpm test:weight # Weight tracking tests
pnpm test:calorie-chart # Calorie chart tests
pnpm test:exercise # Exercise tracking tests
All tests use isolated temporary directories to avoid interfering with real user data.
The project includes a git pre-commit hook that runs syntax checks before allowing commits:
# The hook runs automatically on git commit
git commit -m "Your commit message"
# To manually run the pre-commit check
pnpm run pre-commit
The pre-commit hook performs:
To bypass the pre-commit hook (not recommended):
git commit --no-verify -m "Your commit message"
The project includes example scripts demonstrating usage:
# Run CLI usage example
pnpm example
# Run API usage example
pnpm example:api
Example Files:
examples/basic-usage.js - Demonstrates CLI commands and workflowexamples/api-usage.js - Shows programmatic Node.js module usage# Patch version (bug fixes): 1.0.2 -> 1.0.3
pnpm version patch
# Minor version (new features): 1.0.2 -> 1.1.0
pnpm version minor
# Major version (breaking changes): 1.0.2 -> 2.0.0
pnpm version major
# Specific version
pnpm version 1.2.3
# Complete workflow
pnpm test # Run tests first
pnpm version patch # Bump version
pnpm publish --access public # Publish to npm
git push && git push --tags # Push to git
# Dry run to see what would be published
pnpm publish --dry-run
FAQs
A comprehensive CLI and Node.js module for 16:8 intermittent fasting with meal tracking, weight monitoring, and fast history with visual charts
The npm package @profullstack/fasting receives a total of 16 weekly downloads. As such, @profullstack/fasting popularity was classified as not popular.
We found that @profullstack/fasting demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.