A JavaScript module for managing and analyzing personal subscriptions. Convert between billing frequencies, identify unused services, analyze cost efficiency and make calculated decisions about which subscriptions to keep or cancel.
- Quick Start
- Installation
- Core Features
- Purpose
- Essential API
- Subscription
- SubscriptionCollection
- CostCalculator
- UsageAnalyzer
- Complete Example
- Requirements
- License
- Versioning
- Author
import { Subscription, SubscriptionCollection, CostCalculator, UsageAnalyzer } from 'subscription-tracker'
// Create and manage subscriptions
const netflix = new Subscription("Netflix", 139, "monthly", "streaming")
const collection = new SubscriptionCollection()
collection.addSubscription(netflix)
// Calculate costs
const calculator = new CostCalculator()
const yearlyCost = calculator.calculateYearlyCost(netflix)
console.log(`Netflix yearly cost: ${yearlyCost} kr`)
// Track and analyze usage
netflix.addUsageHours(25)
const analyzer = new UsageAnalyzer()
const costPerHour = analyzer.analyzeCostPerHour(netflix, calculator)
console.log(`Cost per hour: ${costPerHour.toFixed(2)} kr`)# Clone from GitHub
git clone https://github.com/HannaRV/subscription-tracker- ✅ Manage subscription data with validation
- ✅ Convert costs between weekly/monthly/yearly frequencies
- ✅ Track active/inactive status and usage hours
- ✅ Calculate individual and total costs by category
- ✅ Analyze usage efficiency (cost per hour)
- ✅ Identify completely unused subscriptions
- ✅ Identify underutilized subscriptions
Subscription Tracker helps individuals take control of their subscription expenses by providing clear insights into spending patterns. The module addresses common problems:
- Converting between different billing frequencies for fair cost comparison
- Identifying unused subscriptions costing you money
- Finding overpriced services relative to your usage
- Calculating total spending across categories
- Making calculated analysis of which subscriptions to keep or cancel
Subscription → Complete Subscription API
const subscription = new Subscription(name, price, frequency, category)
subscription.activate() / subscription.deactivate()
subscription.addUsageHours(hours)SubscriptionCollection → Complete SubscriptionCollection API
const collection = new SubscriptionCollection()
collection.addSubscription(subscription)
collection.getActiveSubscriptions()
collection.searchSubscriptionsByName(name)CostCalculator → Complete CostCalculator API
const calculator = new CostCalculator()
calculator.calculateMonthlyCost(subscription)
calculator.calculateTotalMonthlyCost(subscriptions)
calculator.calculateCostByCategory(subscriptions)UsageAnalyzer → Complete UsageAnalyzer API
const analyzer = new UsageAnalyzer()
analyzer.analyzeCostPerHour(subscription, calculator)
analyzer.findUnderutilizedSubscriptions(subscriptions, calculator, maxCostPerHour)
analyzer.findUnusedSubscriptions(subscriptions)// Setup subscriptions
const netflix = new Subscription("Netflix", 139, "monthly", "streaming")
const spotify = new Subscription("Spotify", 1200, "yearly", "music")
const collection = new SubscriptionCollection()
collection.addSubscription(netflix)
collection.addSubscription(spotify)
// Add usage data
netflix.addUsageHours(25)
spotify.addUsageHours(50)
// Calculate and analyze
const calculator = new CostCalculator()
const analyzer = new UsageAnalyzer()
const totalMonthlyCost = calculator.calculateTotalMonthlyCost(collection.getAllSubscriptions())
const categoryBreakdown = calculator.calculateCostByCategory(collection.getAllSubscriptions())
const unusedSubs = analyzer.findUnusedSubscriptions(collection.getAllSubscriptions())
console.log(`Completely unused subscriptions: ${unusedSubs.length}`)
const inefficientSubs = analyzer.findUnderutilizedSubscriptions(
collection.getAllSubscriptions(),
calculator,
20 // Max 20 kr/hour
)
console.log(`Total monthly cost: ${totalMonthlyCost} kr`)
console.log('By category:', categoryBreakdown)
console.log(`Inefficient subscriptions: ${inefficientSubs.length}`)- Language: JavaScript (ES2020+)
- Runtime: Node.js >=20.6.0
- Module system: ES6 modules
MIT
This project uses Semantic Versioning:
- MAJOR version for incompatible API changes
- MINOR version for new functionality
- PATCH version for bug fixes
Current version: 1.0.0
Hanna Rubio Vretby [email protected]