<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pedro acosta</title>
    <description>The latest articles on DEV Community by pedro acosta (@pedroacosta613).</description>
    <link>https://dev.to/pedroacosta613</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F22247%2Faad92919-9259-4d7d-ba54-fed24aeb2fab.jpg</url>
      <title>DEV Community: pedro acosta</title>
      <link>https://dev.to/pedroacosta613</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pedroacosta613"/>
    <language>en</language>
    <item>
      <title>Debt Avalanche vs. Snowball: Which Payoff Method Actually Works?</title>
      <dc:creator>pedro acosta</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:07:05 +0000</pubDate>
      <link>https://dev.to/pedroacosta613/debt-avalanche-vs-snowball-which-payoff-method-actually-works-4n4k</link>
      <guid>https://dev.to/pedroacosta613/debt-avalanche-vs-snowball-which-payoff-method-actually-works-4n4k</guid>
      <description>&lt;p&gt;There are two famous ways to pay off debt, and people argue about them like it's sports. The avalanche method and the snowball method both work. They just optimize for different things, and the honest answer to "which one" depends on you, not on the math alone.&lt;/p&gt;

&lt;p&gt;Here is the short version, then a real example with numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Avalanche: pay the minimum on everything, then put every extra dollar on the debt with the highest interest rate. It costs the least interest.&lt;/li&gt;
&lt;li&gt;Snowball: pay the minimum on everything, then put every extra dollar on the smallest balance. You close accounts sooner, and that feels good.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Neither one changes how much you pay each month. The total stays the same. Only the order changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  How avalanche works
&lt;/h2&gt;

&lt;p&gt;List your debts by interest rate, highest first. Pay the minimums on all of them. Whatever extra you have goes to the top of the list. When that debt is gone, its whole payment rolls onto the next one.&lt;/p&gt;

&lt;p&gt;Because the most expensive debt dies first, less interest piles up along the way. That is the whole trick. It is the cheapest order, mathematically.&lt;/p&gt;

&lt;h2&gt;
  
  
  How snowball works
&lt;/h2&gt;

&lt;p&gt;Same idea, different list. Sort by balance, smallest first. Minimums on everything, extra money on the smallest balance. When it hits zero, roll that payment into the next smallest.&lt;/p&gt;

&lt;p&gt;The math is a little worse. The upside is that you start knocking out whole debts early, and that matters if you are the kind of person who needs to see progress to keep going.&lt;/p&gt;

&lt;h2&gt;
  
  
  One example with real numbers
&lt;/h2&gt;

&lt;p&gt;Here are four made up debts. They are not anyone's real accounts, just a typical mix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store card: $600 at 14.99%, minimum $25&lt;/li&gt;
&lt;li&gt;Credit card A: $1,500 at 19.99%, minimum $45&lt;/li&gt;
&lt;li&gt;Credit card B: $4,800 at 27.99%, minimum $110&lt;/li&gt;
&lt;li&gt;Car loan: $9,000 at 6.9%, minimum $260&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Say you can put an extra $300 a month on top of the minimums, so you pay $740 a month in total. I ran both methods month by month, with interest added each month.&lt;/p&gt;

&lt;p&gt;Avalanche attacks card B first (27.99%). Snowball attacks the store card first (smallest balance).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Both finish in 25 months. The total monthly payment is identical, so the finish line is the same.&lt;/li&gt;
&lt;li&gt;Avalanche pays about $2,162 in total interest.&lt;/li&gt;
&lt;li&gt;Snowball pays about $2,378 in total interest.&lt;/li&gt;
&lt;li&gt;The gap is roughly $216 over two years.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first debt gone looks different too. Avalanche clears the big 27.99% card in month 14. Snowball clears the little store card in month 2, and the big card in month 18.&lt;/p&gt;

&lt;p&gt;So on this example, avalanche saves about $216. Snowball gives you a win in month 2 instead of month 14. Is $216 worth waiting twelve more months for your first account to hit zero? For some people yes. For others, that early win is what keeps them from quitting in month 9.&lt;/p&gt;

&lt;p&gt;These are hypothetical debts. Your numbers will move the gap up or down. When the highest rate is also the smallest balance, the two methods give the same order and the same result. The bigger the rate gaps and the bigger the balances at the high rates, the more avalanche saves.&lt;/p&gt;

&lt;h2&gt;
  
  
  When avalanche is the better pick
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Your highest rate sits on a large balance, so the interest is doing real damage.&lt;/li&gt;
&lt;li&gt;You are motivated by the math and will stick with a plan because it is efficient.&lt;/li&gt;
&lt;li&gt;The rate gaps between your debts are wide, say a 28% card next to a 7% car loan.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When snowball is the better pick
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You have tried and quit before, and you need quick wins.&lt;/li&gt;
&lt;li&gt;Your balances are small and the rates are close to each other, so the interest difference is small.&lt;/li&gt;
&lt;li&gt;Having fewer accounts to track matters to you. Fewer statements, fewer due dates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you hate your debt plan, you will abandon it. The best method is the one you finish.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you mix them?
&lt;/h2&gt;

&lt;p&gt;Yes. Plenty of people knock out one tiny balance first for the quick win, then switch to avalanche for the rest. Nothing breaks. You lose a little of avalanche's savings and gain some momentum. It is your call.&lt;/p&gt;

&lt;h2&gt;
  
  
  A word on balance transfers and consolidation
&lt;/h2&gt;

&lt;p&gt;A 0% balance transfer or a consolidation loan can change the whole picture, but both come with fees and conditions, and I am not going to pretend one answer fits everyone. Run the numbers on your actual offer before you move any debt. This article is general education, not financial advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built for this
&lt;/h2&gt;

&lt;p&gt;I built FinSight so people can see the real numbers instead of guessing. The Debt Payoff Planner takes each balance, interest rate and minimum payment, plus whatever extra you can add each month, and projects both strategies side by side. You see the payoff date and the total interest for each, so the tradeoff is a real number and not a feeling. You can try it on the &lt;a href="https://finsight.it.com/debt-payoff" rel="noopener noreferrer"&gt;debt payoff planner page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It will not tell you which one to pick. It cannot see how you feel about your debts at 11 p.m. on a Tuesday. It just takes the guessing out of the math, and you decide the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://finsight.it.com/blog/find-every-subscription-you-pay-for" rel="noopener noreferrer"&gt;How to find every subscription you pay for&lt;/a&gt;: cheap money you can send to the top of your debt list.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://finsight.it.com/blog/subscription-audit" rel="noopener noreferrer"&gt;Subscription audit: how to find what you're paying for&lt;/a&gt;: a repeatable routine that frees up the extra dollars.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://finsight.it.com/blog/budget-irregular-income" rel="noopener noreferrer"&gt;How to budget with irregular income&lt;/a&gt;: when the extra payment changes every month.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Which is better, avalanche or snowball?
&lt;/h3&gt;

&lt;p&gt;Avalanche costs less interest. Snowball gives faster early wins. If you will stick with either one, the interest difference is often modest, so pick the one you will finish.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do both methods pay off debt in the same time?
&lt;/h3&gt;

&lt;p&gt;If your total monthly payment is the same, they often finish in nearly the same month, as in the example above. Avalanche usually saves some interest. The order of payoff is what changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I pay off debt or save first?
&lt;/h3&gt;

&lt;p&gt;Many people keep a small starter cushion so one surprise bill does not go back on a card, then attack the debt. How big the cushion is depends on your life. That is your call.&lt;/p&gt;

&lt;h3&gt;
  
  
  What if I only have one debt?
&lt;/h3&gt;

&lt;p&gt;Then there is no order to choose. Pay as much extra as you can on that one.&lt;/p&gt;

&lt;p&gt;Originally published on FinSight: &lt;a href="https://finsight.it.com/blog/debt-avalanche-vs-snowball" rel="noopener noreferrer"&gt;https://finsight.it.com/blog/debt-avalanche-vs-snowball&lt;/a&gt;&lt;/p&gt;

</description>
      <category>personalfinance</category>
      <category>beginners</category>
      <category>money</category>
    </item>
    <item>
      <title>My balance forecast was wrong in two quiet ways. Here is the math that fixed it</title>
      <dc:creator>pedro acosta</dc:creator>
      <pubDate>Mon, 16 Nov 2026 16:28:09 +0000</pubDate>
      <link>https://dev.to/pedroacosta613/my-balance-forecast-was-wrong-in-two-quiet-ways-here-is-the-math-that-fixed-it-2ep0</link>
      <guid>https://dev.to/pedroacosta613/my-balance-forecast-was-wrong-in-two-quiet-ways-here-is-the-math-that-fixed-it-2ep0</guid>
      <description>&lt;p&gt;I'm a software engineer with a day job, and on the side I build FinSight, a budgeting app that connects to your bank through Plaid with read only access. One of the screens I care most about is the balance forecast: a day by day line for the next 90 days that shows where your checking and savings are heading, which bills land on which day, and the first date the balance would go below zero if nothing changes.&lt;/p&gt;

&lt;p&gt;The first version of that line looked reasonable and was wrong. Not wrong in a way that crashes, wrong in the way that is worse: it produced confident numbers that leaned in one direction. This post is about the two bugs, the fix, and what I took from it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the forecast works
&lt;/h2&gt;

&lt;p&gt;The model is simple on purpose. There are two ingredients.&lt;/p&gt;

&lt;p&gt;The first is recurring cash flow. A detector groups transactions by normalized merchant name, direction and account, takes the median gap between dates, and snaps it to weekly, biweekly, monthly, quarterly or yearly. Paychecks, rent, phone bills and subscriptions all come out of that, and each one gets projected forward on its own schedule.&lt;/p&gt;

&lt;p&gt;The second is what I call drift: the everyday spending that does not repeat on a schedule. Groceries, gas, a pizza on a Friday. Recurring bills alone make the future look far too rosy, because most of what people spend is not a bill. So the forecast estimates an average daily amount and subtracts it every day.&lt;/p&gt;

&lt;p&gt;Then it walks forward one day at a time from today's liquid balance (checking, savings and cash accounts only, no investments):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;running&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;startingBalance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;running&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;netByDay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// scheduled income and bills&lt;/span&gt;
    &lt;span class="n"&gt;running&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;dailyDrift&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// everyday spending&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;running&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From that series it pulls the lowest point and the first negative day, which is what the screen actually leads with. A date is more useful than a warning.&lt;/p&gt;

&lt;p&gt;Everything interesting is inside &lt;code&gt;dailyDrift&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug one: not every outgoing dollar is spending
&lt;/h2&gt;

&lt;p&gt;Drift was computed as total expenses in the history window, minus the part already explained by detected recurring bills, divided by the number of days.&lt;/p&gt;

&lt;p&gt;The problem is the word "expenses". From the bank's point of view, paying your credit card bill is money going out. So is moving money from checking to savings. So is a loan payment. If the detector had not yet picked one of those up as its own recurring series, it landed in the discretionary pile and got spread across every single day of the forecast as if it were coffee and groceries.&lt;/p&gt;

&lt;p&gt;Worse, when the card is connected too, the payment is double counting. The purchases already show up as spending on the card account, so counting the payment again makes the person look like they spend far more than they do.&lt;/p&gt;

&lt;p&gt;The fix was not new logic. The reports page already had a classifier that finds credit card payments, transfers between your own accounts, and loan payments. The forecast just was not using it. Now the query builds one exclusion set and hands it in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;excludedFromDrift&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ccPaymentIds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;internalTransferIds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loanPaymentIds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and drift only sums what is left:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;totalExpenses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;excludedIds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Loan and mortgage payments are only removed from drift, not from detection. They are real bills, so when they repeat they still get their own marker on the timeline. They just should not be smeared across every day as everyday spending.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug two: the denominator was a constant
&lt;/h2&gt;

&lt;p&gt;The history window is the previous three full months plus the current month to date. The old code divided by the length of that window, always.&lt;/p&gt;

&lt;p&gt;That is fine for someone with months of history. For someone who connected a bank last week, it is badly wrong. Ten days of real spending divided by roughly ninety days says they spend about a ninth of what they actually do. The forecast for a brand new account came out flattering, which is exactly the person you least want to mislead, because it is their first impression.&lt;/p&gt;

&lt;p&gt;The fix is to divide by the history you actually have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;earliestDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reduce&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;earliestDate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dailyDrift&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;historyDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;historyDays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nf"&gt;differenceInDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;startOfDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;startOfDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;earliestDate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same &lt;code&gt;historyDays&lt;/code&gt; is used to estimate how much of the window's spending was recurring (each bill's amount times how many of its intervals fit in that span), so both sides of the subtraction cover the same days.&lt;/p&gt;

&lt;p&gt;The function now returns &lt;code&gt;historyDays&lt;/code&gt; along with the rate, and the UI uses it. Under two weeks of history, the chart says plainly that the daily amount is based on only that many days and will get more accurate as transactions come in. The number did not get more certain, so the screen should not pretend it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the forecast still does not do
&lt;/h2&gt;

&lt;p&gt;Irregular income is the honest gap. Income only gets projected when it repeats on a schedule the detector can see: at least three deposits and a gap that snaps to a known frequency. A freelancer paid at random times gets no projected income, and the line will trend down. I think that is the right failure. A forecast that invents a paycheck is more dangerous than one that leaves it out. The same care applies the other way: once someone confirms or dismisses a detected series, the detector stops projecting its own copy, so a confirmed bill is never counted twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would tell another developer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Averages hide bad denominators. Whenever you divide by a time window, ask whether the data actually fills it. A constant divisor is a bug waiting for a new user.&lt;/li&gt;
&lt;li&gt;"Money out" is not "spending". Transfers, card payments and loan payments need to be classified before you average anything, and if another part of your app already classifies them, reuse it so the two screens agree.&lt;/li&gt;
&lt;li&gt;When an estimate is thin, ship the uncertainty with the number. Returning &lt;code&gt;historyDays&lt;/code&gt; next to &lt;code&gt;dailyDrift&lt;/code&gt; cost one field and let the UI tell the truth.&lt;/li&gt;
&lt;li&gt;Write the test for the new account, not just the established one. Both of these bugs only show up at the edges, and the fix landed with unit tests for the history span, each exclusion category, and the zero history case.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to see how the forecast is presented, the overview is at &lt;a href="https://finsight.it.com/cash-flow" rel="noopener noreferrer"&gt;finsight.it.com/cash-flow&lt;/a&gt;. The recurring detector behind it also powers a free &lt;a href="https://finsight.it.com/free-subscription-finder" rel="noopener noreferrer"&gt;Subscription Finder&lt;/a&gt; that runs in your browser on a bank CSV, no account needed. Happy to answer questions about any of this in the comments.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>fintech</category>
      <category>programming</category>
    </item>
    <item>
      <title>I built a subscription finder that never uploads your bank statement</title>
      <dc:creator>pedro acosta</dc:creator>
      <pubDate>Wed, 28 Oct 2026 17:25:25 +0000</pubDate>
      <link>https://dev.to/pedroacosta613/i-built-a-subscription-finder-that-never-uploads-your-bank-statement-1d4p</link>
      <guid>https://dev.to/pedroacosta613/i-built-a-subscription-finder-that-never-uploads-your-bank-statement-1d4p</guid>
      <description>&lt;p&gt;I'm a software engineer, and I built a budgeting app because I was tired of guessing where my money went. One piece of it has its own free page: a Subscription Finder where you drop in a CSV from your bank and it lists every recurring charge. The rule that shaped the whole thing was simple. The file must never leave the browser. This post is about how that works and the parts that turned out harder than I expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  No upload endpoint, so nothing to leak
&lt;/h2&gt;

&lt;p&gt;The page is a client component. The file is read with &lt;code&gt;file.text()&lt;/code&gt; and parsed in the browser. There is no API route that accepts it, so there is nothing on my server that could store or leak a statement. That is a stronger promise than a privacy policy, because it holds even if I make a mistake later.&lt;/p&gt;

&lt;p&gt;One honest detail: when the tool runs it logs a single analytics event with counts only, how many recurring charges it found, how many possible ones, and how many months the statement covers. No file, no merchant names, no amounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reuse the real detector, not a toy one
&lt;/h2&gt;

&lt;p&gt;The free tool calls the same recurring detector the app uses, so the two never disagree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;charges&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;txns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;NOT_A_CHARGE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recurring&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;extractSubscriptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;detectRecurring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;charges&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is what &lt;code&gt;detectRecurring&lt;/code&gt; does. It groups charges by normalized merchant name, direction, and account. A group needs at least three charges spread over at least two weeks. It takes the median gap between the dates and snaps it to a frequency such as weekly, biweekly, or monthly. Then it averages the amount after dropping anything more than 20 percent from the median, so a late fee on a phone bill does not drag the number around.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;null&lt;/code&gt; argument matters. The app normally looks at a rolling window of the last few months, but an uploaded statement can end months ago, so the finder asks it to use every transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  One statement has no other accounts
&lt;/h2&gt;

&lt;p&gt;Inside the app, transfers between your own accounts are removed by matching them across accounts. A single CSV has nothing to match against, so the finder filters by name instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;NOT_A_CHARGE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="sr"&gt;/TRANSFER|&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;XFER&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;|PAYMENT THANK YOU|AUTOPAY PAYMENT|ONLINE PAYMENT|&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;ZELLE&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;|&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;ATM&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="sr"&gt;|DEPOSIT|INTEREST &lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;CHARGE|PAID&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a heuristic and it will sometimes be wrong. I would rather show a slightly noisy list than hide real subscriptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short statements need honest handling
&lt;/h2&gt;

&lt;p&gt;Three charges are the minimum, so a one month statement cannot show recurrence at all. I handle that two ways. A list of well known subscription merchants flags a charge seen only once as a possible subscription. And if the tool finds nothing and the statement covers less than three months, it says that is probably why, instead of implying you have no subscriptions.&lt;/p&gt;

&lt;p&gt;Real bank files are messy too. Some banks put a few account summary lines above the header, so the parser looks through the first 15 rows for the real header with date, description, and amount columns. Billing phone numbers get stripped from merchant names, so "HULU 877-8244858" and "HULU" are not listed twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would tell another developer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;If a privacy promise can be structural, make it structural. No upload endpoint beats a paragraph in a policy.&lt;/li&gt;
&lt;li&gt;Reuse the product's real logic for a free tool, so the free version and the product agree.&lt;/li&gt;
&lt;li&gt;When the input is too small to answer the question, say so. Tell the person what you cannot see.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to try it, it is free and needs no account: &lt;a href="https://finsight.it.com/free-subscription-finder" rel="noopener noreferrer"&gt;https://finsight.it.com/free-subscription-finder&lt;/a&gt;. It is part of FinSight, a budgeting app with an AI assistant that explains your money.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>fintech</category>
    </item>
    <item>
      <title>How I built an AI that explains your money, with no way to touch it</title>
      <dc:creator>pedro acosta</dc:creator>
      <pubDate>Mon, 26 Oct 2026 18:49:58 +0000</pubDate>
      <link>https://dev.to/pedroacosta613/how-i-built-an-ai-that-explains-your-money-with-no-way-to-touch-it-1kbi</link>
      <guid>https://dev.to/pedroacosta613/how-i-built-an-ai-that-explains-your-money-with-no-way-to-touch-it-1kbi</guid>
      <description>&lt;p&gt;I'm a software engineer, and I built a budgeting app because I was tired of guessing where my money went. The part people ask about most is the AI assistant, so this post is about the one design choice that shaped all of it: the AI can read a snapshot of your finances, and it has no way to do anything else.&lt;/p&gt;

&lt;p&gt;The stack is Next.js, Prisma, Clerk for auth, Plaid for bank connections, and Claude for the assistant, streamed through the Vercel AI SDK. Here is how the read-only part works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer one: the bank connection only reads
&lt;/h2&gt;

&lt;p&gt;When someone connects a bank, the Plaid Link token asks for exactly one product, Transactions. There is no payment initiation product in the request, so even a bug on my side cannot create a transfer. It is a boundary the bank enforces, not a promise in my code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer two: the model gets a snapshot, not a database
&lt;/h2&gt;

&lt;p&gt;The assistant does not run queries and it has no tools. Before each chat turn, the server builds a text summary of the user's finances (account balances, three months of cash flow, spending by category, budgets, goals, and upcoming recurring charges) and passes it as the system message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;systemContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;buildAiContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;system&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;systemContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;messagesForModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;maxOutputTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model can only talk about what is in that snapshot. It cannot fetch more, write anything back, or call out to anything. If the model misbehaves completely, the worst outcome is a bad answer on screen.&lt;/p&gt;

&lt;p&gt;I considered giving it tools, so it could look up arbitrary date ranges. I decided against it. Every tool is a new way for a prompt to cause a side effect, and for a money app the extra flexibility is not worth the new attack surface. A bigger or better organized snapshot solves most of what tools would have solved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer three: cache the snapshot, retrieve the rest
&lt;/h2&gt;

&lt;p&gt;The snapshot is the expensive part of each request, and it barely changes between messages in one conversation. So it sits in the system message with Anthropic's prompt caching turned on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;cacheControl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ephemeral&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow up questions in the same session reuse the cached prefix instead of paying for it again.&lt;/p&gt;

&lt;p&gt;For general money questions that are not about the user's own data, like "what is an avalanche payoff", I retrieve a few articles from a small knowledge base and put them in the last user message. They go there on purpose. Retrieval results differ on every turn, so putting them in the cached system message would break the cache every time. A failed lookup falls back to the plain messages, so retrieval can never take the chat down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer four: boring guardrails
&lt;/h2&gt;

&lt;p&gt;Monthly message quotas are enforced per plan and counted in the database, and a Redis rate limit sits in front of everything as an abuse guard. The request body is validated with Zod, and the message list only allows user and assistant roles. A client cannot smuggle in a fake system message, because the Messages API has no system role inside the list at all, and I restrict the schema to match.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would tell another developer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Decide what the model must never be able to do, then make that impossible at the boundary, not in the prompt.&lt;/li&gt;
&lt;li&gt;Prefer a good snapshot over tools until you can name a specific question the snapshot cannot answer.&lt;/li&gt;
&lt;li&gt;Put stable context in the cached prefix and volatile context in the user turn.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to see the result, the app is FinSight at &lt;a href="https://finsight.it.com" rel="noopener noreferrer"&gt;https://finsight.it.com&lt;/a&gt;, and there is a free tool that finds recurring charges in a bank statement CSV without an account: &lt;a href="https://finsight.it.com/free-subscription-finder" rel="noopener noreferrer"&gt;https://finsight.it.com/free-subscription-finder&lt;/a&gt;. I'm happy to answer questions about any of this in the comments.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ai</category>
      <category>webdev</category>
      <category>fintech</category>
    </item>
  </channel>
</rss>
