123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. Title: Why I keep track of spendings in a personal app made with Git+JS
  2. Date: 2020-05-03 00:00
  3. Category: News
  4. Slug: git-budget
  5. Lang: en
  6. ![GitBudget][снимок]
  7. In this article Michael shares his experience of using Git+JS.
  8. Hi, folks, let me share my experience of creating an application to keep track of my spendings. Specifically, let me do it by answering the following questions:
  9. 1. Why keep track of spendings in an application?
  10. 1. Why did I create the application as a personal project?
  11. 1. Why does the project use Git+JS?
  12. **1. Why keep track of spendings in an application?**
  13. I, like many people out there, wanted to become rich and [successful][успех]. To become rich, one is often advised to run a personal budget, that's what I started to do several years ago. I'd like to point out that running my personal budget hasn't made me rich and successful, and I increased income simply by moving to Moscow.
  14. I think I started to run the budget somewhere around 2012. By that time I already had a professional programmer deformation, which can be described as "made by someone else = bad" formula and is usually manifested by a strong desire to rewrite everything from scratch. However, I had no experience with budgeting back then, so I decided to try a "professional" solution and purchased [YNAB][ynab] (You Need A Budget) to use the application on both PC and mobile.
  15. I tried to do my best to set out budget plans and fulfill them in the course of three years. However, somewhere around 2015 the authors released a new application version and **demanded money for the upgrade**, the old version was no longer functioning. I had to choose one of the options:
  16. 1. Pay for the upgraded version and use a completely new "shiny" user interface.
  17. 1. Stop their ripoff, keep my money and lose the history of spendings.
  18. I concluded that:
  19. 1. I already paid for the application;
  20. 1. the old version was suitable for me;
  21. 1. I did not ask for an upgrade;
  22. 1. if I would know I have to pay for each upgrade, I would have never purchased their application in the first place;
  23. 1. I didn't want to sponsor this boorishness;
  24. so I stopped the ripoff and **lost my history of spendings**.
  25. This was a very disappointing situation for me, so I stopped tracking my spendings for about a year. However, I was once experiencing a "painful synchronization" (also known as "figuring things out" with a wife). I failed to defend myself against a financial vocal attack like "you're a waster, you always waste money on junk". Then I realized I really need to keep track of my spendings.
  26. This time I decided not to repeat my mistake of giving all my data to someone with the risk of losing it, so I started to track my spendings with simple phone notes. The format was simple and looked like this:
  27. ![Notes][снимок-заметки]
  28. I used the notes solely on the phone until mid-2018. Then, a new need arose: I wanted to be able to **work on my spendings from a PC** to analyze them. I took the time to see through the solutions that would allow me to work with my spendings on both PC and mobile **free of charge**. A calendar turned out to be such a solution:
  29. ![Calendar][снимок-календарь-день]
  30. ![New record][снимок-календарь-запись]
  31. I used a Google account to access [Apps Script][apps-script] (a clone of JavaScript) to analyze the spendings. Working with spendings in Apps Script turned out to be quite daunting because calendar records are not designed to host spendings. Data ownership question was still unresolved: my data was still dusting on an unknown server I don't control, and I could only access my data through an API, **which might change in the future by someone else's decision**.
  32. While I was using a calendar, I've had the following ideas frequently visiting me:
  33. 1. it would be nice to keep all my data in Git to be able to easily analyze the spendings;
  34. 1. it would be nice to have a convenient user interface without all the noise that prevents me from quickly adding a record.
  35. Autumn 2019 I discovered [Isomorphic-Git][isomorphic-git], which allows JavaScript to work with Git, quickly verified the ability to work with Git, and realized I found my Holy Grail. Recently I've finished creating the first version of GitBudget application, you can see its functionality here:
  36. <iframe width="720" height="405" src="https://www.youtube.com/embed/ii_cLXAy3S0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
  37. That's how the spendings look like on my phone now:
  38. ![GitBudget][снимок-гит-бюджет]
  39. Git data looks like this: [https://gitlab.com/kornerr/git-budget-sample-data/-/blob/me/gb.log](https://gitlab.com/kornerr/git-budget-sample-data/-/blob/me/gb.log)
  40. Let me highlight a few important issues:
  41. * Git repository above reflects actions performed in the video above;
  42. * I keep my spendings in a private repository, you should do the same;
  43. * the application runs completely on the device and has no back-end: GitHub Pages hosting is used;
  44. * the application talks to the outside world only during synchronization with Git;
  45. * password is kept by a browser, the application only uses it for synchronization with Git;
  46. * the application should be loaded over HTTP because the currently used Isomorphic-Git version (0.70.0) makes some requests (metadata) to Git over HTTP, and browsers prohibit HTTP requests from HTTPS nowadays.
  47. **2. Why did I create the application as a personal project?**
  48. I spent 40 hours of my life during the first quarter of 2020, i.e., on average, I worked for about half an hour each day.
  49. Personal projects have the following benefits over those done at work:
  50. 1. You can do whatever you want and learn from your mistakes.
  51. 1. Nobody's breathing down your neck and restricting your fantasy.
  52. 1. The above two points keep you calm and give you the strength to perform any stupid activity that might be required at work.
  53. 1. Mistakes you own drastically widen your horizons.
  54. Personal projects have drawbacks, too:
  55. 1. Nobody in the world cares about your project but you.
  56. 1. Nobody would pay you for your project.
  57. 1. You have to find time to do the project every day.
  58. 1. Your wife won't thank you for the project, even if she would use it herself.
  59. It's easy to note that all drawbacks of the personal project are balanced with the benefits of the work project. And all drawbacks of the work project are balanced with the benefits of the personal project. Yin and Yang.
  60. **3. Why does the project use Git+JS?**
  61. Keeping data in Git instead of an unknown back-end/API has the following benefits:
  62. 1. Git is the most widespread solution for decentralized source version control among developers, i.e., almost every developer has experience with Git.
  63. 1. You don't need a new API to work with Git: you just work with files.
  64. 1. There are numerous services offering Git free of charge if you're not too crazy about security and don't want to pay for the service.
  65. 1. Of course, a Git service provider might be [acquired by a large corporation][поглощение] one day, however, it's easy to move your Git data wherever you want.
  66. 1. For maximum security you can always host your own Git server.
  67. Usage of JS with HTML/CSS over Swift/Kotlin/C#/Python has the following benefits:
  68. 1. Your application runs everywhere: PC, tablet, mobile phone.
  69. 1. You don't need to pass AppStore reviews to get to every device.
  70. 1. HTML/CSS/JS standards are international, so [no single company may stop supporting it][opengl] or [change its API][swift]; this may result in backward compatibility of [20 years][долговечные-приложения] or more.
  71. 1. Since there's no back-end, all logic resides in JS executed on the client, so you can save the version of the application that best suits you and forget about recurrent updates that [usually only hamper usability][обновления].
  72. GitBudget is the first attempt to see what Git+JS can do. I can only imagine the possibilities lying ahead.
  73. [снимок]: ../../images/2020-05-06_гит-бюджет_снимок.png
  74. [снимок-заметки]: ../../images/2020-05-06_гит-бюджет_заметки.png
  75. [снимок-календарь-день]: ../../images/2020-05-06_гит-бюджет_календарь-день.png
  76. [снимок-календарь-запись]: ../../images/2020-05-06_гит-бюджет_календарь-запись.png
  77. [снимок-гит-бюджет]: ../../images/2020-05-06_гит-бюджет.png
  78. [успех]: https://youtu.be/7RchntYFtSE
  79. [ynab]: https://www.youneedabudget.com
  80. [apps-script]: https://developers.google.com/apps-script
  81. [isomorphic-git]: https://isomorphic-git.org/
  82. [поглощение]: https://github.blog/2018-06-04-github-microsoft/
  83. [opengl]: https://arstechnica.com/features/2018/09/macos-10-14-mojave-the-ars-technica-review/12/
  84. [swift]: https://medium.com/@DoorDash/tips-and-tricks-for-migrating-from-swift-2-to-swift-3-c67a8520dbac
  85. [долговечные-приложения]: on-the-way-to-durable-applications.html
  86. [обновления]: https://hardforum.com/threads/anyway-to-turn-off-the-damn-automatic-driver-updates-in-windows-10.1948410/