Uncategorized

  • Zero-Sum budgeting with Double-Entry accounting

    Here’s how double-entry accounting creates an effective budgeting system.

    How they fit together

    Zero-sum budgeting (giving every dollar a job) and double-entry accounting (every transaction affects two accounts) work perfectly together because both ensure everything balances to zero. When you gain $100, it must be assigned somewhere. When you spend $50, both your bank account and budget category decrease.

    Core components

    Accounts: Where you money physically lives (checking accounts, credit cards).

    Categories: What you plan to use your money for (groceries, rent, fun money).

    Transactions: Money moving between accounts and categories.

    Account types

    Traditional accounting has five account types, but for budgeting we focus on three:

    • Assets (your bank accounts): Increase with credits, decrease with debits.
    • Liabilities (your credit cards): Increase with credits, decrease with debigs.
    • Equity (your budget categories AND income): Increase with credits, decrease with debits.

    Why Categories Are Equity, Not Expenses

    In traditional accounting, groceries would be an expense account. But in budgeting, your “Groceries” category isn’t tracking what you’ve spent – it’s tracking what you can spend. It represents a portion of your wealth assigned to a specific purpose. That’s why categories work like equity accounts.

    Why Income Is Equity, Not Revenue

    Your Income category works as an equity account rather than a revenue account because it temporarily holds unallocated funds until you distribute them to categories.

    Income functions as “unassigned equity” while budget categories represent “assigned equity.” Budgeting is simply the process of moving equity from unassigned to assigned status.

    How Transactions Work

    Getting paid:

      AccountTypeActionAmount
      CheckingAssetDebit (+)$1000
      IncomeEquityCredit (+)$1000

      Budgeting money:

        AccountTypeActionAmount
        IncomeEquityDebit (-)$200
        GroceriesEquityCredit (+)$200

        Spending money:

          AccountTypeActionAmount
          GroceriesEquityDebit (-)$50
          CheckingAssetCredit (-)$50

          The Benefits

          This approach provides accurate accounting: everything maintains balance, errors are identifiable, and you can track both the location of your money (accounts) and its purpose (categories).

          Zero-sum budgeting powered by double-entry accounting gives you a complete system for managing your personal finances effectively.

        1. What I cannot create, I do not understand

          I saw a post in Hacker News about Richard Feynman’s blackboard at the time of his death. The first comment mentions his motto: “What I cannot create, I do not understand.”

          This motto matches the Not Invented Here syndrome and how I’ve been learning programming.

          When I first started to get serious about Frontend development, there was Backbone.js. This amazing library abstracted concepts into an easy-to-use API that allowed you to build powerful Frontends.

          However, before I started using it, I had an urge to understand it, so I wrote my own version. After I nailed down the concepts, I was comfortable using Backbone.js.

          This post is a glorified bookmark with notes reminding me how I started learning these things.

        2. Build your own ngrok

          This simple setup can help us expose our local development environment to the public internet. I usually paid for ngrok, but the last time I tried them, they were expensive, and their customer support was terrible.

          For a small-size project, we can build our own small ngrok with Linux, Caddy, and SSH port forwarding.

          Requirements:

          • A VPS with Linux. In this example, we will use Ubuntu 20.01 LTS
          • SSH access to your server
          • Caddy
          • A domain name. In this example, we will use mydomain.io

          Add DNS record

          We need to add two A records to our domain DNS zone:

          • An A record pointing to our server’s IP address
          • A wildcard A record pointing to our server’s IP address

          For example, if our server IP address is 5.164.71.442, our records will look like this:

          HostnameTypeAddress
          @A5.164.71.442
          *A5.164.71.442
          DNS records example

          Configure Caddy

          First, Install Caddy.

          Then, create a Caddyfile to route traffic from a specific domain name to a local port; in this case, we will do app.mydomain.io and port 8881.

          touch ~/Caddyfile
          app.mydomain.io {
            reverse_proxy 127.0.0.1:8881
            log {
              output file /var/log/access.log
            }
          }

          Reload caddy.

          caddy reload
          
          > 2023/05/30 17:55:25.272 INFO    using adjacent Caddyfile

          And our server is ready.

          Create an SSH tunnel

          With SSH, you can create a secure connection between your computer and the server, with the services relayed, i.e., every request to the server will be forwarded to your local development environment.

          For example, if we are building our application in localhost:8000, we can do the following:

          # ssh -R <server port>:<server domain>:<local port> <server ssh user>@<server domain>
          ssh -R 8881:app.mydomain.io:8000 user@mydomain.io

          Now, every request you send to app.mydomain.io will be forwarded to localhost:8000 on your computer.

          Resources

          No artificial intelligence was used in the making of this post.