<?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: Siri</title>
    <description>The latest articles on DEV Community by Siri (@siri404).</description>
    <link>https://dev.to/siri404</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F391848%2F42dd9b76-9afc-4277-bd82-e0155493ecb9.jpeg</url>
      <title>DEV Community: Siri</title>
      <link>https://dev.to/siri404</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/siri404"/>
    <language>en</language>
    <item>
      <title>How to deploy multiple parts of the same website to multiple vercel projects</title>
      <dc:creator>Siri</dc:creator>
      <pubDate>Wed, 28 Jun 2023 22:42:46 +0000</pubDate>
      <link>https://dev.to/siri404/how-to-deploy-multiple-parts-of-the-same-website-to-multiple-vercel-projects-447p</link>
      <guid>https://dev.to/siri404/how-to-deploy-multiple-parts-of-the-same-website-to-multiple-vercel-projects-447p</guid>
      <description>&lt;h2&gt;
  
  
  Backstory
&lt;/h2&gt;

&lt;p&gt;I originally wanted to write about how I used Vercel to deploy multiple parts of the same website using a reverse proxy because it was truly a "Eureka moment" for me. I was able to split multiple parts of the same website and deploy them separately without authentication issues. And then I remembered that I had solved a similar problem a few years ago while working at Delivery Hero in Germany. I decided to combine these two stories into one post. In rapidly changing start-up and scale-up environments it is not uncommon to see big changes needed in the architecture. This post is about one such occasion and the technical decisions I had to make while delivering the project. I will also discuss how I approached the problem differently recently using the latest technologies like NextJS and Vercel for a client of mine.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem statement
&lt;/h2&gt;

&lt;p&gt;As the story goes, I was tasked with an intriguing challenge. The business was expanding from food delivery to grocery delivery and I had to create a new website with a strict deadline without impacting the existing business. We had a successful e-commerce website running. Let's call it &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt; for example. All the developers were working on this website. The ask was to create another business vertical in parallel with zero to minimal disruption to the existing business but part of the same website. That was it. This was how it was framed in the beginning. We knew what we wanted to build, but didn't know how it would look or what it would take. We also knew that there were downstream decisions that depended on the successful completion of this project in the given time. The CTO Rawad Traboulsi pulled me into a meeting and asked for my opinion on this. It was the first time I was put on the spot like that. I don't remember how the meeting went, but I remember coming out all blank and needing time to come up with an estimate of what it would take to build it. What followed was 3 months of tackling what would eventually be my proudest technical achievement so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge #1 - Scoping
&lt;/h2&gt;

&lt;p&gt;The first challenge was to understand the scope of the problem. The problem statement was ambiguous. Nobody knew what the actual requirement was. All there was was an idea and there was a deadline. I figured that the only way to develop that idea from that state was by asking questions. So I probed as many people involved in the business as possible in order to understand the true nature of the challenge at a high level. Soon enough, I had a reasonably good picture of what I had to deliver and the time I had to do it. To give you an idea, it was basically like Amazon moving from their shopping-only business to shopping + groceries. The shopping website was running fine and successful and a whole new groceries business was to be developed in 3 months, of which I was tasked with creating the website. Over the next few days, I had a plethora of decisions to make and I had to make it work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge #2 - Decisions, Decisions!
&lt;/h2&gt;

&lt;p&gt;I had the following questions to be answered before jumping into implementation. The success of the project depended on answers to these pertinent questions. What never gets said is some seemingly less important questions that are difficult to answer. Naming conventions are a good example. Because everything feels right and wrong at the same time and everyone has an opinion about them. Anyway, the other most important questions were:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Will it be implemented in the same codebase or a new one?&lt;/li&gt;
&lt;li&gt;Will it be a subdomain like grocery.example.comor a path in the base domain, like example.com/grocery?&lt;/li&gt;
&lt;li&gt;If it's a subdomain, will the existing authentication system work?&lt;/li&gt;
&lt;li&gt;Will it be deployed as a microservice or on-premise like the existing one?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If it was a microservice, the following questions needed answering.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can data be shared between the 2 services?&lt;/li&gt;
&lt;li&gt;How can code be shared between the 2 codebases?&lt;/li&gt;
&lt;li&gt;How can features like serverside rendering and hydration be built in a short time?&lt;/li&gt;
&lt;li&gt;What about logging and monitoring?&lt;/li&gt;
&lt;li&gt;What will the CI/CD pipeline look like?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these questions wreaked havoc in my mind. I went to the drawing board many a time. As a side note, I can't emphasize enough how some problems need a whiteboard to be solved. Things like architectural decisions need a proper mental model and I have always found drawing them up on a whiteboard helps take these decisions and explaining others the problem as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codebase  -  new or existing?
&lt;/h2&gt;

&lt;p&gt;Based on the above decisions to be made, choosing the microservice route posed a bigger challenge than the on-premise one. But, the fact also remained that I didn't want to touch the existing codebase given the state of its affairs. It was from the pre-cloud era, and there was a lot of tech debt to be fixed and I didn't want to burden the other developers already having a hard time working on it. Moreover, making drastic changes to a codebase serving thousands of customers was like operating a beating heart. If not done carefully, the results will be catastrophic. That meant it had to be a new codebase developed and deployed in isolation but working in conjunction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Subdomain or path?
&lt;/h2&gt;

&lt;p&gt;I chose to go the subdomain way here. Due to many reasons. I didn't want to have any conflicts with the base domain. I didn't want someone to deploy a new page in the base domain and have it collide with the microservice in production. That led me to go the subdomain way completely isolated from the main website. It was deployed as grocery.example.com. But thinking back now, it was the best decision. A path would have been a better solution because it gives the user the feeling of continuity and..read ahead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication problems
&lt;/h2&gt;

&lt;p&gt;The user's authentication status did not carry over from the main domain to the subdomain. This was because the session cookie was set to persist only on the main domain and all its paths and hence it got dropped when the user moved from www to grocery.&lt;br&gt;
To fix this, I had to change the way the cookie was set in the server once the user logged in. This had unexpected behavior for users who never logged out. They were logged in, but not really logged in. So we had to force a re-login for those users. It wasn't the best of user experiences.&lt;br&gt;
Playing with session is dangerous. A lot of things could potentially go wrong if not done right.&lt;/p&gt;

&lt;h2&gt;
  
  
  On-premise or Cloud?
&lt;/h2&gt;

&lt;p&gt;At the time, I had some experience deploying websites in the cloud. It was a time the world was moving towards microservices and it was clear to me that it will solve my problem of decoupling the 2 businesses. Only, I didn't know how to wire the two applications together. The problem wasn't having the technical expertise to do it, but it was not having a clear mental model of the whole architecture, and not knowing how we wanted the end product to look like. I did a spike to check the feasibility of deploying an app in the cloud and wiring it with the base domain and I eventually took the decision to go the microservices way with the data I had in my hand even though it meant that I had to solve more challenges to get the whole thing working. It was a dangerous decision at the time given the amount of time I had to build them all, but looking back now, it was the right decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data sharing between services
&lt;/h2&gt;

&lt;p&gt;Moving to a new web app meant that both session cookies and the global state of the user did not persist between the apps, and that was a major problem. As far as the session cookies are concerned, they required the change in the server that I explained above. As far as global state management was concerned, it was written to localstorage and read in the other app. Naive maybe, but worked for a first-time implementation. We had to settle with this tradeoff in the first iteration of the website.&lt;br&gt;
Note: Using localstorage for this purpose was not wrong per se, but it was not the right solution. Because localstorage is blocking and it could cause performance implications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code sharing between services
&lt;/h2&gt;

&lt;p&gt;We had a Design system we maintained in parallel where all the frontend components were published into npm separately. It was a simple web-only Design system, nothing complex. There were some hurdles in making the build systems work together. For this, I decided to publish the components as source rather than as built versions.&lt;/p&gt;

&lt;p&gt;Even though sharing code using a component library was possible, some features like Serverside rendering and client-side hydration couldn't be shared and had to be rebuilt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rebuilding basic features like Serverside rendering and client hydration
&lt;/h2&gt;

&lt;p&gt;Luckily for me, NextJS was available to solve exactly these problems. It was a lifesaver. Suddenly, with NextJS's Static Site Generation and Serverside rendering solutions, I didn't have to worry about reinventing the wheel of building. I gained a lot of time to focus on creating stuff rather than implementing features like tooling, ssr, etc which would have meant that I had to compromise on time or quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logging and Monitoring
&lt;/h2&gt;

&lt;p&gt;I used GCP's internal monitoring tools for server-side monitoring and Sentry for client-side logging.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD pipeline
&lt;/h2&gt;

&lt;p&gt;We had other engineers who had the know-how of using Terraform in the organization. It was reasonably easy to dockerize the application and use Terraform to deploy the app to GCP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge #3 - Dividing the problem and conquering
&lt;/h2&gt;

&lt;p&gt;With all the questions answered, I divided the work into pages and delegated that to my team who implemented all the features.&lt;/p&gt;

&lt;h2&gt;
  
  
  How would I have done it differently now?
&lt;/h2&gt;

&lt;p&gt;The world of Microservices has moved dramatically over the past few years. From major cloud providers like GCP to AWS, we now have a lot of solutions to deploy frontend applications like Vercel, Netlify, Fly, Render, etc which have been paving the future of the web. Especially Vercel which I believe has changed the game for the better.&lt;br&gt;
And so when I faced the same problem recently while working on a website for a client of mine, I knew exactly what I wanted to build and how. It had a homepage, a blog, a dashboard, an API service, a subscription page, etc. I wanted to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep complex routes isolated as Microservices&lt;/li&gt;
&lt;li&gt;Share as much code as possible&lt;/li&gt;
&lt;li&gt;Implement a reverse proxy to route requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used Turborepo, Vercel, and NextJS to solve all these problems. Turborepo is the awesome new monorepo solution by Vercel. It helps me keep all the shared code like Design System, TSConfig, and Eslint Config all in the same place to be shared with any app I build. I then deployed all the microservices as individual apps on Vercel. I then created a reverse proxy to point the base domain to it and all the routes to the respective apps like below. Easy peasy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqidv0k0rwor96lwb0781.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqidv0k0rwor96lwb0781.png" alt="turborepo + nextjs + vercel + reverse proxy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I use Vercel as a reverse proxy
&lt;/h2&gt;

&lt;p&gt;First of all, using third-party reverse proxies like Cloudflare, Fastly, etc is not recommended by Vercel when all the other apps are in Vercel. This is because these proxies might not be globally available as the Vercel apps are. So I had to create the proxy rules myself in vercel. Luckily, we have rewrite rules in vercel effectively emulating a reverse proxy. An example is given below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  "rewrites": [
    {
      "source": "/route1",
      "destination": "https://route1.vercel.app/"
    },
    {
      "source": "/route1/:match*",
      "destination": "https://route1.vercel.app/:match*"
    },
    ...
    {
      "source": "/",
      "destination": "https://root.vercel.app/"
    },
    {
      "source": "/:match*",
      "destination": "https://root.vercel.app/:match*"
    },
  ]
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/sreeramofficial/turborepo-starter" rel="noopener noreferrer"&gt;https://github.com/sreeramofficial/turborepo-starter&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You don't usually get challenges like these on a daily basis. I took away a lot of learnings in those 3 months both technically and professionally. It is safe to say this was the toughest project I ever delivered due to many reasons. It was the first time I was assigned a task as big as that to be taken to completion, it was the first time for me to lead people both from a technical as well as from a managerial level, it was during the peak of the pandemic when I was personally struggling socially in a country where I was only beginning to integrate before the pandemic struck. But I am so glad I got to do it with great success.&lt;br&gt;
Also, note that this isn't a post glorifying the use of Microservices. Microservices may not be the answer to all problems. It depends on the use case. Also, just because Amazon decided to go with monoliths, doesn't necessarily mean it's the best solution for us. Just like the answer to any question in Computer Science, it all depends on the requirements. I have explained why I took the decisions I took.&lt;br&gt;
Finally, a special thanks to my team of Nikita Barabanov and Gladson Robinson without whom this wouldn't have been possible.&lt;/p&gt;

</description>
      <category>vercel</category>
      <category>nextjs</category>
      <category>turborepo</category>
      <category>reverseproxy</category>
    </item>
    <item>
      <title>Executing n parallel promises in series</title>
      <dc:creator>Siri</dc:creator>
      <pubDate>Sun, 18 Jun 2023 09:33:33 +0000</pubDate>
      <link>https://dev.to/siri404/executing-n-parallel-promises-in-series-3cbm</link>
      <guid>https://dev.to/siri404/executing-n-parallel-promises-in-series-3cbm</guid>
      <description>&lt;p&gt;Recently, I faced a peculiar challenge at work. As a Design System Engineer, one of the tasks I perform is publishing client files to an artifactory. Due to a recent change I introduced to the architecture, the number of files I published increased by a big factor. This caused the backend to refuse connection mid way through the publishing process and the whole version was deemed to be a failure. I had to quickly find a solution.&lt;/p&gt;

&lt;p&gt;One of the solutions was to reduce the number of files I published. But this didn’t fix the problem as the number of files were still huge and there was nothing I could do to reduce them. Plus, this solution had scalability issues. Should the number of files increase in the future, we would see the issue again.&lt;/p&gt;

&lt;p&gt;The other solution was to publish in batches. Let’s say we have &lt;code&gt;n&lt;/code&gt; number of files to publish. The script was publishing them all in parallel using &lt;code&gt;Promise.all&lt;/code&gt;. The idea was to set a limit to the number of parallel requests. This is in a way, rate limiting of promises.&lt;/p&gt;

&lt;p&gt;And so I wrote a script which executes &lt;code&gt;n&lt;/code&gt; promises in parallel in batches in series recursively. In other words, it would publish a given number of files, wait for them to be uploaded and then continue with the rest of the files in batches until all the files are uploaded in a recursive manner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PromisesInSeries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&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="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_data&lt;/span&gt; &lt;span class="o"&gt;=&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;execute&lt;/span&gt; &lt;span class="o"&gt;=&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;p&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;data&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="nx"&gt;_data&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="nx"&gt;data&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;n&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_data&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;execute&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 to test it, I created 10 fake promises.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;promiseGenerator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&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="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;executing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1000&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="nx"&gt;call&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;PromisesInSeries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&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;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nf"&gt;promiseGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mi"&gt;10000&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] after 10 seconds.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, what if we wanted at add a wait stage after every batch? Simple, instead of calling the function recursively right away, we would call it with a delay with a &lt;code&gt;setTimeout&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PromisesInSeriesWithDelay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&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="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;_data&lt;/span&gt; &lt;span class="o"&gt;=&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;execute&lt;/span&gt; &lt;span class="o"&gt;=&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;p&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;data&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="nx"&gt;_data&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="nx"&gt;data&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;n&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;promises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;waiting for&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_data&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;execute&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;&lt;strong&gt;Note&lt;/strong&gt;: This script doesn't cater for failure scenarios and hence is not suitable for production.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>promises</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How I organised my life transforming it digitally over 5 years</title>
      <dc:creator>Siri</dc:creator>
      <pubDate>Sat, 10 Sep 2022 16:35:07 +0000</pubDate>
      <link>https://dev.to/siri404/how-i-organised-my-life-transforming-it-digitally-over-5-years-30ah</link>
      <guid>https://dev.to/siri404/how-i-organised-my-life-transforming-it-digitally-over-5-years-30ah</guid>
      <description>&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This is a long one, read it with a bit of patience. But I believe this digital literacy is important for all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backstory
&lt;/h2&gt;

&lt;p&gt;About 6 years ago when I moved to London for the first time, I realised my life was all over the place. It was running ahead of me and I was constantly playing catchup. Being on top of everything was just impossible. I was wasting a lot of time fixing the not so important things in life, reading spam emails and wasteful notifications. I noticed I was spending a big chunk of the day just fixing things. I couldn't focus on my life, family or work. I had a terrible work life balance and I had to come up with something to put everything in order. I started forgetting things and it got really frustrating. I also knew that I was not making good use of the computer I had. Being a computer engineer, that should be simple right? Fast forward today, I have created a system around me which has made my life smooth where I let my computer and money do all the heavy lifting and I do all the living and loving. If you are a person like me who travels, invests, pays taxes in multiple countries and has a busy life generally, you might find this interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Divide your time
&lt;/h2&gt;

&lt;p&gt;We all have 24 hours in a day. Not more, not less. Whether you are rich or poor, happy or sad, we all have just the same amount of time. If x out of that 24 go for sleeping and y for working, that leaves t = 24 -(x+y) for doing the other stuff. For most people, what they do in these t hours determines their future. And how you use, optimise and efficiently allocate your resources to this t hour period determines who you are tomorrow. For me, x = y = t = 8.&lt;/p&gt;

&lt;p&gt;The only time you have to actually live is whatever left of the day after working and sleeping.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Categorise your life
&lt;/h2&gt;

&lt;p&gt;I thought in depth about what life is and where mine was leading to. I asked myself what I really needed in life, what truly makes me feel accomplished, what truly makes life less mundane, less monotonous and worth living every second to the fullest doing the things which actually are worth doing not following the crowd. So I went back to the drawing board, did some soul searching and came up with a list of the 7 most important things in life. Organising everything around these categories has helped me streamline all the events in my life and dedicate time and resources to each of them. These are the 7 main categories I came up with.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Health, Career, Accommodation, Finance, Travel, Entertainment and the most important one - Relationships.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Relationships come last in this order because everything else had to be in order for this to work. Maximising time for family is the end goal. But for that, the other 6 had to be set in place.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Clear the clutter
&lt;/h2&gt;

&lt;p&gt;If Software Engineering has taught me anything, it is that you make big things happen by doing the little things right over a long period of time. Extending that logic to my life, I realised that all I have to do is make efforts in each of these areas, however little, day by day, and life will sort itself out. Not that I don’t expect setbacks here and there or if everything will go according to plan. Just that in the long run, things will turn out just fine. If you want investment advice, this probably is my biggest advice. And so I set out goals I wanted to achieve in each of these areas. I then decided to take action. But first things first, I had to organise my identity. My documents, emails, photos &amp;amp; videos, apps &amp;amp; websites, passwords, businesses etc.&lt;/p&gt;

&lt;p&gt;Small things done over long time yield the best results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Files and Documents
&lt;/h3&gt;

&lt;p&gt;I had documents from School, college, scans of ids, bills, statements, rental agreements, visa applications, payment receipts, tax documents, tickets and several other documents. They were all over the place. Some physical, some digital, some in my email, some back home in India. I had to come up with a way of storing these somewhere in such a way I can access them from anywhere whenever. So, I had everything digitised and moved them to the cloud. I initially tried Dropbox, Box, and some other lesser known cloud storage providers before Google Drive was a thing. When Google Drive came up, 15 GB of storage was plenty to store all these documents. So in Google drive, I created folders for all of the above categories and uploaded all the files there.&lt;/p&gt;

&lt;p&gt;Thats not it. The amazing thing about Google Drive is the software makes sure I have a copy of the drive synced with the cloud in my laptop and mobile phone at all times. Also this way, I realised there is no need of a physical drive because 15GB is plenty to store all the files one needs. Not if you use it to store large video files though. Today, my files have crossed the 15GB limit and I subscribed to Google One. I think it’s a handy subscription. Yet another great feature it has is I can make any file available offline. With internet becoming cheaper and available almost everywhere, disks will not be necessary anymore. Thats why you don’t see floppies, CDs or even physical hard disks anymore. You will understand the true potential of it when you read the travel category below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Emails
&lt;/h3&gt;

&lt;p&gt;Being a web developer meant that a third of my life is spent on the internet. I had several email accounts mostly I created over the years for various purposes. First thing I did was delete all the unnecessary accounts and move everything to a single one. But the problem with this was there were too many emails. There were hundreds of emails everyday from various sources that I had to do something about it so as to not miss the important ones. I started creating email filters in Gmail for recurring emails into these categories. Each of these categories then have their sub categories. For example, a mail from my bank would go into a folder inside Finance and will not be available in the inbox. This way, I can pick and choose which emails to read and I can take collective action on a specific category of emails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Photos and videos
&lt;/h3&gt;

&lt;p&gt;I digitised and uploaded all my old pictures into Google Photos. I do not own a camera. My iPhone does a good job of capturing all the necessary memories in my life. The Google Photos app then backs up all the pictures into the cloud. This way, I don’t have to copy them somewhere because its all backed up in the cloud automatically, I don’t lose any pictures either and I can safely delete the pictures on my phone saving valuable space. Whenever I get time, I organise these photos into albums. Now, I don’t have to worry about losing the phone either. If I lost it, the photos and videos are in the cloud anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Apps and Websites
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6yk0yE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/sreeramofficial/blog-posts/blob/master/img/blog/IMG_1116.jpg%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img alt="Screenshot of my iphone homescreen" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6yk0yE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/sreeramofficial/blog-posts/blob/master/img/blog/IMG_1116.jpg%3Fraw%3Dtrue" width="800" height="1247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I realised that I never used my computer or phone to their fullest potential. These are powerful devices with amazing computing powers which can actually do work while you sleep. If they can mine bitcoins, shouldn't it be possible for them to automatically invest in a stock when its low and sell it when it is at its peak? Aren’t they smart enough to make these decisions for us without manual interventions? So thats exactly what I set out to do. I divided all my apps and websites into these categories. Shown here is a screenshot of it. I then set important reminders and notifications like when a stock goes up or when it reaches a threshold. I no longer have to remember birthdays, anniversaries and deadlines, the reminder app does the remembering. I no longer have to open an app to understand the world, it just sends me notifications I can pick and choose from.&lt;/p&gt;

&lt;p&gt;But, there were too many notifications. Here is where the Scheduled summary feature in iOS comes to the picture. I set the unimportant apps to send me a notification only twice a day at specific times. With this, I noticed a 50% drop in my phone usage and I gained a lot more focus at work because over the pandemic, my phone usage had increased. And time not spent on the phone is time with family. And time to pursue my dreams like being a pilot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passwords
&lt;/h3&gt;

&lt;p&gt;Password management deserves a book of its own. Living in the virtual world, having signed up to a ton of services, remembering passwords was impossible. I initially wrote them all in a place. But that was not very secure. It is the dumbest thing anyone can do. So I came up with a system of creating passwords for websites in such a way I don’t have to write them anywhere. It was a combination of a secret keyword, name of the website and a number and character. But that didn’t work either. Half of them required changing passwords every now and then. So I tried numbering the passwords incrementing by 1 every time I changed it. This proved to be even more chaotic as now I had to remember their counts. All of a sudden, I had some with my old insecure password, some with the password system, and some I didn’t even remember. This is when I truly sat and thought about that to do.&lt;/p&gt;

&lt;p&gt;Social login to the rescue. If you don’t know about Social login, its good to read about their pros and cons. Basically you login to an app/website through other accounts like Google/Facebook. I decided to use it wherever they allowed it and didn’t want access to my private data. It took precedence over normal passwords. And in websites where they didn’t have social login, I would let the browser create a secure password and let a password manager like Google Chrome password manager remember it. With chrome settings being synced to me google account, this meant that I didn’t have to remember any of my passwords. Chrome did the remembering of the passwords.&lt;/p&gt;

&lt;p&gt;The problems didn’t end there though. Although in my laptop, Chrome acted as the password manager, I was using an iPhone and the passwords there were managed by the Apple keychain. I had to manually make it use Chrome as the password manager. There are still certain apps which use the Safari webviews. Webviews are basically instances of the native browser inside an app. If you have noticed certain apps to be sluggish, it probably was because they were using webviews in that journey. I still haven’t figured out a way to change this. Moving to an android device seems to be the only choice as of today.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Organise
&lt;/h2&gt;

&lt;p&gt;With all the little things organised, let’s look at how it affected each of the categories of life.&lt;/p&gt;

&lt;h3&gt;
  
  
  Health
&lt;/h3&gt;

&lt;p&gt;This is further divided into 2: General activities and Sport activities. General activities include working out, yoga and meditation. Sport activities include Running, Swimming, Cricket, Football, Tennis, Badminton etc.&lt;/p&gt;

&lt;p&gt;I have a Fitbit device capturing all my health metrics and relaying them onto Google Health and Apple Health. They constantly monitor my health and indicate me of any drop in values. I measure my sleep as well because I spend a third of my life sleeping. I have apps monitoring my stress levels, water levels and nutrition. Still a long way to go to fine tune them but it’s amazing how much help is available through apps. You could argue that I am giving away vital personal information about myself to the developers of the apps. I think I get more benefits of doing that than not.&lt;/p&gt;

&lt;p&gt;Also, in the UK, I use Babylon Digital GP which gives me access to a GP through video on the same day. That is golden.&lt;/p&gt;

&lt;h3&gt;
  
  
  Career
&lt;/h3&gt;

&lt;p&gt;This is further divided into: Learning, Business, Work, and Interviews.&lt;/p&gt;

&lt;p&gt;I use a lot of resources to learn. Learning to me involves reading, writing and listening. I regularly read news articles, blogs and e-books. Some apps worth mentioning here are Reddit and Quora. Reddit especially has a lot of raw knowledge. Quora has become more of a propaganda tool these days. You have to filter out the good from the bad. I have a plethora of news app subscriptions. It is very important to choose the right ones when it comes to News. Reading from a few sources is very important as each one comes with its own propaganda. But its worth it if you have a need to be on top of whats happening in the country you are in. I listen, mostly to podcasts and audiobooks. Tech podcasts, life podcasts, investment podcasts mostly. Spotify and Audible are worth mentioning in this area. I listen to them when I have the time. I listen to them when I am not doing particularly anything, like when travelling in the tube for example. I also write. Mostly here in Medium, or sometimes Quora answers.&lt;/p&gt;

&lt;p&gt;I have my own business too as a career consultant. It comes with its own learnings.&lt;/p&gt;

&lt;p&gt;I try to learn from the work I do. I cant stress enough on the importance of this. This is yet another advice I have for people. Try to gather as much learning as you can in the job you do.&lt;/p&gt;

&lt;p&gt;Every interview I attend, there is a folder in Google Drive where I save all the questions I faced. When you attend a lot of interviews, you start seeing a pattern. They all ask the same questions. And you are prepared more and more each time. This is why interviews are one of the best ways to learn professionally and inter-personally. They hone your response to regular questions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shelter
&lt;/h3&gt;

&lt;p&gt;I keep moving houses. Every house comes with a lot of contractual obligations, disputes and artefacts. It’s important to keep a record of all that. I keep a record of all that in Google Drive&lt;/p&gt;

&lt;h3&gt;
  
  
  Finance
&lt;/h3&gt;

&lt;p&gt;Living in India, Germany and the UK, I had a lot of accounts with various banks. Some major high street banks and some digital. Managing them was difficult. Moving money from one place to the other as I moved was a pain. There were a lot of factors involved. Its my firm belief that one day, there will be a universal bank account which doesn’t charge a hefty conversion fee. I guess bitcoin is the only way to achieve that. Until then I have a folder where I put all the apps and can manage them easily.&lt;/p&gt;

&lt;p&gt;I have investments in all the 3 countries too. Some things like the EPF in India were not digitised until very recently. There was no way to check what my contributions were. These fell through the cracks. I had to unify them. The ruling party in India did a decent job of digitising everything. With handsets and cheap internet, India is surely on the right track to enabling the masses financial freedom. The UK is far superior in this area. Apps like &lt;a href="https://friends.withplum.com/r/RsCyoE" rel="noopener noreferrer"&gt;Plum&lt;/a&gt;, &lt;a href="https://join.monzo.com/c/q3ntwcw" rel="noopener noreferrer"&gt;Monzo&lt;/a&gt; and IFTTT can do certain smart things I explain below.&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://join.monzo.com/c/q3ntwcw" rel="noopener noreferrer"&gt;Monzo&lt;/a&gt;, I can create pots where I can put savings. I can round up spendings to the nearest pound and save the change into the pot. For example, If I spend £2.50 for coffee, the change of £0.50 goes to the pot. Although not much, it can add up quite quickly.&lt;/p&gt;

&lt;p&gt;I also use IFTTT to automatically move money from the main pot to the savings pot when certain events happen. It’s pretty crazy what it can do. For example, I have set it to automatically move money to the pot when:&lt;/p&gt;

&lt;p&gt;When Elon Musk Tweets. (Link to applet here)&lt;br&gt;
When it rains, when it’s too hot or snowy.&lt;br&gt;
The 1p savings challenge where you start by saving 1p on 1 January, then 2p on 2 January, then 3p on 3 January and so on.&lt;br&gt;
Weekly savings challenge&lt;br&gt;
All these save me a couple of hundred quids every month and its pretty cool.&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://friends.withplum.com/r/RsCyoE" rel="noopener noreferrer"&gt;Plum&lt;/a&gt;, I invest into stocks and funds. They have other cool features which help you save more and intelligently.&lt;/p&gt;

&lt;p&gt;With all of the money coming and going, filing tax returns becomes crucial. This has been the most cumbersome thing I have ever done when it comes to my finances. The due dates for filing tax returns vary from country to country. Their names, languages, rules and rates vary. It’s unbelievably painful a process to complete. I have never invested in a tax advisor. Maybe worth looking into.&lt;/p&gt;

&lt;h3&gt;
  
  
  Travel
&lt;/h3&gt;

&lt;p&gt;Having moved quite a lot, I needed a way to organise my tickets, visa applications, scans of documents etc. I use Google Drive for this. Lets take a Flight ticket to London for example. In the olden days, I would print it, print the boarding pass, keep it somewhere so I wouldn’t lose it and chaos ensues on the day of travel. With Google drive, once I buy the ticket, I create a folder called ‘London Trip 2022’ in the travel folder. I then upload the ticket and the boarding pass into the drive. It gets synced to my laptop and phone automatically. All in all, no copying, no hard disk space required and no losing or misplacing tickets and no worrying about where I kept it. To me, that was a big win. The days of having to use the flash drive are over.&lt;/p&gt;

&lt;h3&gt;
  
  
  Entertainment and Relationships
&lt;/h3&gt;

&lt;p&gt;All of the remaining time is for entertainment with family and friends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Divide your time&lt;/li&gt;
&lt;li&gt;Categorise your life&lt;/li&gt;
&lt;li&gt;Organise all of your files in Drive based on these categories — Google Drive&lt;/li&gt;
&lt;li&gt;Organise all of your emails based on these categories — Gmail&lt;/li&gt;
&lt;li&gt;Organise all of your apps into these categories — Your phone&lt;/li&gt;
&lt;li&gt;Bookmark all your websites into these categories — Google Chrome&lt;/li&gt;
&lt;li&gt;Organise all your photos and videos — Google Photos&lt;/li&gt;
&lt;li&gt;Organise all your passwords — Google Chrome Password Manager&lt;/li&gt;
&lt;li&gt;Set up Scheduled Summary (iOS only)&lt;/li&gt;
&lt;li&gt;Set up automated Investments — &lt;a href="https://join.monzo.com/c/q3ntwcw" rel="noopener noreferrer"&gt;Monzo&lt;/a&gt;, &lt;a href="https://friends.withplum.com/r/RsCyoE" rel="noopener noreferrer"&gt;Plum&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;To conclude, all this might sound simple. But trust me they weren’t. I started this back in 2016 and took me over 5 years to iterate and reach this point. But the heavy lifting has been done. I have become a productivity and time management freak, but thats how data driven I had to be to be where I am today and I live a clutter-free life now. And I believe people should have the basic knowledge of doing this. Digital literacy is important and I am considering teaching people basic organisation skills. And whether or not all this means I am conforming to living rat race of a life or whether or not sharing my private data with these giant corporations is good or bad is a debate for another time.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

</description>
      <category>productivity</category>
      <category>timemanagement</category>
    </item>
  </channel>
</rss>
