Skip to content

Add spending budget alerts — notify when projected monthly spend exceeds user-set limit #183

@Calebux

Description

@Calebux

Description

Users who set a monthly subscription budget (once the analytics feature is built) need automated alerts when they are approaching or exceeding that budget. This is one of SYNCRO's core value propositions — preventing surprise financial impact.

Feature Scope

Budget Alert Types

1. Monthly budget threshold alert

Trigger when current month's active subscription total exceeds X% of budget:

  • 80% warning: "You've used 80% of your $200 monthly subscription budget ($160/$200)"
  • 100% alert: "You've exceeded your monthly subscription budget by $23.50"

2. New subscription would exceed budget

When adding a subscription, calculate if it would push total over budget:

⚠️ Budget Alert
Adding Adobe CC ($54.99/month) would bring your monthly total to $213.50, 
which exceeds your $200 budget by $13.50.
[Add Anyway] [Set New Budget] [Cancel]

3. Annual budget projection

"At your current rate, you'll spend $2,421 on subscriptions this year — $421 over your $2,000 annual budget."

Implementation

User Budget Settings

ALTER TABLE profiles 
  ADD COLUMN monthly_budget DECIMAL(10,2),
  ADD COLUMN budget_alert_threshold INT DEFAULT 80;  -- percentage

Budget Check Service

async function checkBudgetAlerts(userId: string): Promise<void> {
  const [profile, subscriptions] = await Promise.all([
    getProfile(userId),
    getActiveSubscriptions(userId),
  ]);
  
  if (!profile.monthly_budget) return;
  
  const monthlyTotal = calculateMonthlyTotal(subscriptions);
  const percentage = (monthlyTotal / profile.monthly_budget) * 100;
  
  if (percentage >= 100 && !await wasAlertSentThisMonth(userId, 'budget_exceeded')) {
    await sendBudgetAlert(userId, 'exceeded', monthlyTotal, profile.monthly_budget);
  } else if (percentage >= profile.budget_alert_threshold && !await wasAlertSentThisMonth(userId, 'budget_warning')) {
    await sendBudgetAlert(userId, 'warning', monthlyTotal, profile.monthly_budget);
  }
}

Schedule: Run daily at recalculation time

Alert Deduplication: Only send once per month per alert type

Acceptance Criteria

  • User can set monthly budget and alert threshold in settings
  • Budget progress bar on dashboard
  • Alert sent at 80% threshold (configurable)
  • Alert sent when 100% exceeded
  • Warning shown inline when adding subscription that would exceed budget
  • Annual projection shown in analytics page

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendStellar WaveIssues in the Stellar wave programenhancementNew feature or requestfrontendClient/frontend related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions