<?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>Forem: Parag Chirde</title>
    <description>The latest articles on Forem by Parag Chirde (@chirdeparag).</description>
    <link>https://forem.com/chirdeparag</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%2F66053%2F38f9f23f-71cb-42d1-b4fd-cb321e98365d.jpg</url>
      <title>Forem: Parag Chirde</title>
      <link>https://forem.com/chirdeparag</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/chirdeparag"/>
    <language>en</language>
    <item>
      <title>SPA behaviour in Astro JS</title>
      <dc:creator>Parag Chirde</dc:creator>
      <pubDate>Thu, 23 Feb 2023 06:56:07 +0000</pubDate>
      <link>https://forem.com/chirdeparag/spa-behaviour-in-astro-js-5c6p</link>
      <guid>https://forem.com/chirdeparag/spa-behaviour-in-astro-js-5c6p</guid>
      <description>&lt;p&gt;Astro Js is a great framework for building completely static sites with out of the box SEO pros. However its MPA (Multi page application) approach might seem odd for few scenarios. To give your Astro application a SPA behaviour is possible and is super easy. &lt;/p&gt;

&lt;p&gt;Introducing &lt;a href="http://turbo.hotwired.dev" rel="noopener noreferrer"&gt;Turbo&lt;/a&gt; by Hotwired. &lt;br&gt;
Here's a great blog to summarise the whole approach.&lt;br&gt;
&lt;a href="https://www.maxiferreira.com/blog/astro-turbo-persistent-islands/" rel="noopener noreferrer"&gt;https://www.maxiferreira.com/blog/astro-turbo-persistent-islands/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to give your Astro app a SPA behaviour? Here's a quick boilerplate repo.&lt;br&gt;
&lt;a href="https://github.com/paragchirde/Astro-SPA" rel="noopener noreferrer"&gt;https://github.com/paragchirde/Astro-SPA&lt;/a&gt;&lt;/p&gt;

</description>
      <category>astro</category>
      <category>hotwired</category>
      <category>turbo</category>
    </item>
    <item>
      <title>Event bus in Nuxt3</title>
      <dc:creator>Parag Chirde</dc:creator>
      <pubDate>Fri, 15 Jul 2022 14:52:31 +0000</pubDate>
      <link>https://forem.com/chirdeparag/event-bus-in-nuxt3-331n</link>
      <guid>https://forem.com/chirdeparag/event-bus-in-nuxt3-331n</guid>
      <description>&lt;p&gt;Event bus is typically a mechanism that makes it possible to have communication between different components. These components can be present at any level of component hierarchy in your project.&lt;/p&gt;

&lt;p&gt;To know more about Event bus and its implementation in Nuxt2 visit link&lt;/p&gt;

&lt;p&gt;&lt;a href="https://paragchirde.medium.com/vuejs-eventbus-easy-way-to-pass-data-between-components-2d2a663a3e83"&gt;VueJS Eventbus: Easy way to pass data between components&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, the &lt;a href="https://v3.vuejs.org/guide/migration/events-api.html#_2-x-syntax"&gt;official documentation&lt;/a&gt; you can see how the Event Bus implementation has changed from Vue 2 to Vue 3.&lt;/p&gt;

&lt;p&gt;Introducing &lt;a href="https://www.npmjs.com/package/mitt"&gt;mitt&lt;/a&gt;, a new and simple way of implementing event bus on Vue3/Nuxt3&lt;/p&gt;

&lt;p&gt;We’ll start by installing mitt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i mitt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we’ll register a new plugin named &lt;code&gt;mitt.client.js&lt;/code&gt; in the plugins directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;import mitt from &lt;span class="s2"&gt;"mitt"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const emitter &lt;span class="o"&gt;=&lt;/span&gt; mitt&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;default defineNuxtPlugin&lt;span class="o"&gt;((&lt;/span&gt;nuxtApp&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    nuxtApp.provide&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'bus'&lt;/span&gt;, &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="nv"&gt;$on&lt;/span&gt;: emitter.on,
      &lt;span class="nv"&gt;$emit&lt;/span&gt;: emitter.emit,
    &lt;span class="o"&gt;})&lt;/span&gt;
  &lt;span class="o"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Know more about registering plugins in Nuxt3 &lt;a href="https://v3.nuxtjs.org/guide/directory-structure/plugins/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s see how to emit and listen to events in different components. Consider two components A and B. In our case &lt;strong&gt;Component A&lt;/strong&gt; will emit the event and Component B will listen to the event.&lt;/p&gt;

&lt;p&gt;ComponentA.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;this.&lt;span class="nv"&gt;$bus&lt;/span&gt;.&lt;span class="nv"&gt;$emit&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"someEvent"&lt;/span&gt;, &lt;span class="s1"&gt;'Data to send'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ComponentB.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mounted&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
this.&lt;span class="nv"&gt;$bus&lt;/span&gt;.&lt;span class="nv"&gt;$on&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"someEvent"&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;data&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    console.log&lt;span class="o"&gt;(&lt;/span&gt;data&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    //Some stuff to &lt;span class="k"&gt;do&lt;/span&gt;..
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s pretty neat and clean. Thank you for reading! &lt;/p&gt;

</description>
      <category>vue3</category>
      <category>nuxt3</category>
    </item>
    <item>
      <title>Introduction to JAM stack</title>
      <dc:creator>Parag Chirde</dc:creator>
      <pubDate>Sat, 02 May 2020 15:43:51 +0000</pubDate>
      <link>https://forem.com/chirdeparag/introduction-to-jam-stack-1219</link>
      <guid>https://forem.com/chirdeparag/introduction-to-jam-stack-1219</guid>
      <description>&lt;p&gt;In the past few years, there has been a tremendous development in the way how we build web applications and then how we deploy them. Many stacks such as MERN (MongoDB, Express, React, Node), LAMP (Linux, Apache, MySQL, Python), MEAN (MongoDB, Express, Angular, Node), etc have proven to be extremely helpful to developers. These stacks have been very successful in their respective ways for developing modern web applications and allowed people to come up with different software design architectures and principles. Moreover, the browsers have been evolving at a rapid pace and are much faster, secure, and powerful than ever before. This lead to a new ear of developing applications that at client-centric i.e client-side applications and concepts such as client-side rendering, client-side routing, and much more. It suddenly became an immediate factor that the websites should load faster, users wanted everything to load instantly, faster rendering, faster video loading, image loading. Due to this Google also nowadays ranks the website based on the loading time. (Lighthouse is a great tool developed by Google itself that check how fast is your website and also gives the suggestions of how you can improve the loading time significantly).&lt;/p&gt;

&lt;p&gt;JAM stack is a new emerging software development philosophy which calls a news term of “serverless”. Serverless doesn’t mean the complete absence of physical servers, but it is more of a logical term. Cloud computing is the backbone when it comes to serverless applications. The cloud provider actually runs the server for you and at the same time manages the dynamic allocation of resources, load balancing, monitoring for your application. This means you really don’t have to go through the sometimes cumbersome process of setting up the server, managing, scaling, and the whole deployment process of your application. It is the cloud that manages everything for you so that you can only focus on the core logic of your application without worrying about the DevOps process. &lt;br&gt;
Cloudflare defines serverless as follows: Serverless computing is a method of providing backend services on an as-used basis. Servers are still used, but a company that gets backend services from a serverless vendor is charged based on usage, not a fixed amount of bandwidth or number of servers.&lt;br&gt;
The term “Serverless” is confusing since with such applications there are both server hardware and server processes running somewhere, but the difference compared to normal approaches is that the organization building and supporting a ‘Serverless’ application is not looking after that hardware or those processes. They are outsourcing this responsibility to someone else.&lt;br&gt;
The serverless applications leverage all the advantages of the FaaS i.e Function as a Service architecture. FaaS is an event-driven approach that runs and executes your server-side logic via the use of services. AWS Lambda and Microsoft Azure Functions are some popular FaaS providers. Serverless can also mean applications where server-side logic is still written by the application developer, but, unlike traditional architectures, it’s run in stateless compute containers that are event-triggered, ephemeral (may only last for one invocation), and fully managed by a third party. &lt;/p&gt;

&lt;p&gt;JAM stack brings in together Javascript, API’s and Markup Languages to develop the applications. At first, it might seem like a little confusing when someone reads about the JAM stack. When I first read I was completely confused about how do I even build an actual application without even having any server and just mere Javascript? But as I started to dive deep into the architectural phenomena of JAM stack I was presented with the whole new methods of developing modern-day web applications. And it all actually made sense!&lt;br&gt;
Let’s consider a scenario where we are developing a small project management software. In a more traditional way you would first think about the frontend (Vue, React, Svelte, Angular, etc), then comes the backend server-side language or framework such as Laravel and finally the database which might be a SQL or a NoSQL depending on need. Then comes the part of setting up the database connecting with the backend and setting up the server. This consumes time and sometimes is just too tiresome. After that, you decide to write your frontend and decide to work with API. All your business logic is now in your backend and you manipulate the data received from the API. Every time you make a request to the server about a page the server accepts the request, queries the database, and pulls the data, renders it into an HTML template, and finally pushed into the network as a response. So every time you make a new request the same process is repeated leading to network latency. Another major thing in such an approach is that of scaling the servers and of course the database as the data grows. You may then come up with the idea of cauterization which is good, but scaling the database is again something that needs your attention. Horizontal scaling or vertical scaling? Hmm, Can’t afford the vertical scaling, let’s do sharding you’ll say. More and more time into the scaling aspect is utilized. Then at some point, you notice the application is quite slow and then you start looking for the optimization techniques. You see where have you reached and what was your purpose?&lt;br&gt;
No doubt you have learned a lot but you would surely not go through the same tedious process for every new application you make. &lt;br&gt;
Now, this is where JAM stack comes into action. A completely modern way to develop fast, secure, and scalable web applications. &lt;br&gt;
By nature, JAMstack sites are the following:&lt;br&gt;
• Globally distributed and resilient to heavy traffic&lt;br&gt;
• Centered around a developer-friendly, Git-based workflow&lt;br&gt;
• Designed modularly, consuming other services via APIs&lt;br&gt;
• Prebuilt and optimized before being served&lt;/p&gt;

&lt;p&gt;JAM stack websites are often deployed using a Content Delivery Network (CDN), Cloudflare being one of the most popular. A CDN geographically distributes your website and the user can then reach your website to the nearest possible server resulting in reduced load time for every request made. Since a serverless JAM stack-based application doesn’t rely on a server-side code they can be distributed using a CDN without living on the server. This also unlocks the website loading speed that every developer thrives for.&lt;/p&gt;

&lt;p&gt;Now we have covered a good amount of datils about JAM Stack. I would like to add some information about microservices as well. Microservices is another architectural pattern of building modern highly complex and dynamic applications wherein you have a ton of functionalities and features embedded in your application. Consider microservices as lego blocks to build a lego car. Each functionality is broken down and has its own environment in which it works in a more decoupled manner than a traditional monolith application. Microservices work hand in hand with serverless and adding JAM stack on top of it would lead to a perfect technology stack for your next application. Decoupling the front end from the backend allows for more modular development where we can take advantage of the huge ecosystem of third-party tools to provide website functionality. &lt;/p&gt;

&lt;p&gt;Now let’s dive into how to decide some technologies for your next project using JAM stack. Consider the example of building a simple project management application. Our frontend will be completely decoupled with the backend. &lt;/p&gt;

&lt;p&gt;I have used VueJS for the frontend purpose. FaunaDB is a new NoSQL database technology that is emerging. It is based on serverless architecture and completely API  based. This is a true example of how you don’t have to set up a database and then take up the task of connecting it manually. Using faunaDB’s javascript driver you can directly connect to the database using the secret key generated in the Fauna’s dashboard. It has its own authentication system and first of its kind in terms of being a 100% ACID compliant and a transactional distributed database. With FaunaDB you don’t have to worry about the scalability at all, its all managed by Fauna and thus you can now more focus on the core business logic and purpose of your application. &lt;/p&gt;

&lt;p&gt;Here is a link to the actual application which is completely serverless and makes use of FaunaDB’s multitenancy as well. &lt;br&gt;
&lt;a href="https://vue-fauna-project.herokuapp.com/"&gt;https://vue-fauna-project.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to go through the repo&lt;br&gt;
&lt;a href="https://github.com/parag1997/vue-fauna-test"&gt;https://github.com/parag1997/vue-fauna-test&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will be writing about how to develop a completely serverless application using JAM stack and faunaDB in my next article. &lt;/p&gt;

&lt;p&gt;References &amp;amp; more reading:&lt;br&gt;
&lt;a href="https://www.netlify.com/jamstack/"&gt;https://www.netlify.com/jamstack/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://jamstack.org/"&gt;https://jamstack.org/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>vue</category>
      <category>jamstack</category>
      <category>fauna</category>
    </item>
    <item>
      <title>Explain Blockchain like I'm 5</title>
      <dc:creator>Parag Chirde</dc:creator>
      <pubDate>Mon, 30 Jul 2018 17:02:47 +0000</pubDate>
      <link>https://forem.com/chirdeparag/demo-416n</link>
      <guid>https://forem.com/chirdeparag/demo-416n</guid>
      <description>&lt;ul&gt;
    &lt;li&gt;The concept of blockchain came with Stuart Haber and W. Scott Stornetta when in 1991 they published a paper about how to timestamp a digital document. It was until Satoshi Nakamoto published a paper on Bitcoin: A Peer-to-Peer Electronic Cash System which was completely based on the Blockchain concept.&lt;/li&gt;
    &lt;li&gt;Blockchain lets us for the first time have a shared version of truth that is open, distributed and tamper proof in its nature. Blockchain is an emergent technology concept that enables the decentralized and immutable storage of verified data.
    &lt;/li&gt;
    &lt;li&gt; Blockchain has a wide ranging set of applications and almost any field can benefit from having such a technology at its disposal. Blockchain is also heralded as a way by which trust can be ensured in the online world and lets us have greater confidence in the range of products and services that we use online.
    &lt;/li&gt;
    &lt;li&gt;While previously we would have the backend code residing in a server or a set of servers, Dapps let us run web enabled applications where the back end is instead hosted on a blockchain network which executes the code that is needed for it.
    &lt;/li&gt;
    &lt;li&gt; Distributed Ledger( a collection of accounting entries consisting of debits and credits)
Computing power and breakthroughs in cryptography, along with the discovery and use of some new and interesting algorithms, have allowed the creation of distributed ledgers.
    &lt;/li&gt;
    &lt;li&gt;Blockchain is a new technology that uses cryptography with distributed computing. It was Satoshi Nakamoto the genius behind building up the blockchain where a network of computers collaborate to maintain a shared and a secured database. So we can call blockchain as a secure distributed database.
Mining computers or nodes on the network validate the transaction, have them the block they are building and once the block is verified it is broadcasted to other nodes that all have the copy of.
    &lt;/li&gt;
    &lt;li&gt;Now since there is no centralized authority to verify the transaction the blockchain depends upon a distributed consensus algorithm. In order to make an entry on to the blockchain network(database) all the nodes have to agree on the state of the block so that no one computer in particular can make an alteration without the consensus of the others. Once the block is accepted it is finally added to the chain which may contain countless number of other blocks. 
    &lt;/li&gt;
    &lt;li&gt;Blockchain was designed so that the transactions are immutable. The first generation blockchain was much more like a database, but the second generation of the blockchain provides the facility to execute any computer code on the blockchain.
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>blockchain</category>
      <category>bitcoin</category>
    </item>
  </channel>
</rss>
