<?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: ankitaabad</title>
    <description>The latest articles on DEV Community by ankitaabad (@ankitaabad).</description>
    <link>https://dev.to/ankitaabad</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%2F670677%2F1b857b82-492e-4a8a-b48a-4c08adbd9727.jpg</url>
      <title>DEV Community: ankitaabad</title>
      <link>https://dev.to/ankitaabad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankitaabad"/>
    <language>en</language>
    <item>
      <title>How I built a Custom Handwired Mechanical Keyboard</title>
      <dc:creator>ankitaabad</dc:creator>
      <pubDate>Sat, 03 Jun 2023 02:06:55 +0000</pubDate>
      <link>https://dev.to/ankitaabad/how-i-built-a-custom-handwired-mechanical-keyboard-65n</link>
      <guid>https://dev.to/ankitaabad/how-i-built-a-custom-handwired-mechanical-keyboard-65n</guid>
      <description>&lt;p&gt;🔥 🄰🄽🄺🄱🄳 - ➍➋ 🔥&lt;/p&gt;

&lt;p&gt;I created a custom ergonomic hand wired mechanical keyboard. It is an ortho-linear, column-staggered keyboard with 6 key thumb cluster powered by QMK 💪.&lt;/p&gt;

&lt;p&gt;This was my first time playing with micro controllers, I used a pro micro for my build. Here is a small video on it.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HKSbo6_KerA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>mechanicalkeyboard</category>
      <category>programming</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Javascript Productivity with Lodash</title>
      <dc:creator>ankitaabad</dc:creator>
      <pubDate>Sat, 23 Apr 2022 00:12:20 +0000</pubDate>
      <link>https://dev.to/ankitaabad/javascript-productivity-with-lodash-535f</link>
      <guid>https://dev.to/ankitaabad/javascript-productivity-with-lodash-535f</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Don't be Busy, Be Productive&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Life is too short to write everything from scratch. Javascript has an ecosystem of amazing libraries that we can leverage. Lodash is one of them. When you open the official website of lodash you are greeted with the following quote.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A modern JavaScript utility library delivering modularity, performance &amp;amp; extras.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I heavily rely on the utility functions that come with lodash. It not only makes me productive but also reduces my codebase size and thus reduce bugs. &lt;br&gt;
I created a small tutorial to explain this beautiful library. Check this out 👉&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/K3kZ09iSzXw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Solving Database Connection Issues in a Serverless World Using Prisma’s Data Proxy</title>
      <dc:creator>ankitaabad</dc:creator>
      <pubDate>Fri, 18 Feb 2022 10:50:12 +0000</pubDate>
      <link>https://dev.to/ankitaabad/solving-database-connection-issues-in-a-serverless-world-using-prismas-data-proxy-i3f</link>
      <guid>https://dev.to/ankitaabad/solving-database-connection-issues-in-a-serverless-world-using-prismas-data-proxy-i3f</guid>
      <description>&lt;p&gt;With Serverless a lot of headaches is now offloaded and outsourced to Cloud providers. We pay for what we use, scaling is no more our concern. Provisioning is more or less elastic and automatic.  But among all good things, tradeoffs are a bitter reality. When we try to solve one problem we often introduce another problem that was non-existent in the first place. &lt;/p&gt;

&lt;p&gt;With all the amazing benefits, Serverless comes with its own challenges. Local testing is one of them. Database connection management is another one and we will talk about it in more detail in this post.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;To query a database we need to first establish a TCP connection with the database server. We re-use this connection for subsequent queries instead of reconnecting every time. In practice, we actually use a pool of these connections and reuse them. This works well with always-on servers. &lt;/p&gt;

&lt;p&gt;But in a Serverless world, we might face scaling issues. For example: In a project that I was working on, we had close to 40 Lambda functions. Each of them will read from/ write to the same database. With the increase in load, multiple instances of these Lambdas will run in parallel. Each of these ephemeral compute instances requires a separate connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But there is a limit on how many simultaneous connections you can have with the database.&lt;/strong&gt;&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%2Fsuq53pvq94d6m20lln2a.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%2Fsuq53pvq94d6m20lln2a.png" alt="Limited Database Connections"&gt;&lt;/a&gt;&lt;br&gt;
In our case, we were using an AWS RDS instance. A t3 micro RDS instance allows only 80-90 connections, t3 large instance provides around  700 simultaneous connections. We were already hitting the connection limit in our developer environment with just 4 developers using t3 micro for development and testing purposes. &lt;/p&gt;
&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;We needed an external connection pooler. But doing it by yourself requires effort and expertise. Me being lazy looked outside. We were already using Prisma  as ORM and Prisma offers a built-in solution: &lt;strong&gt;&lt;a href="https://www.prisma.io/blog/prisma-data-proxy-xb16ba0p21" rel="noopener noreferrer"&gt;Prisma Data Proxy&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.prisma.io" rel="noopener noreferrer"&gt;Prisma&lt;/a&gt; is an open-source next-generation ORM that provides a typesafe query builder, hassle-free migrations and a GUI client to view and edit your data.&lt;/p&gt;
&lt;/blockquote&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%2Fv2b3aksvwh6rawh72az3.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%2Fv2b3aksvwh6rawh72az3.png" alt="Prisma vs SQL"&gt;&lt;/a&gt;&lt;br&gt;
In case you are unaware of Prisma: check out this webinar that we recently did on &lt;a href="https://www.youtube.com/watch?v=-td2zlTOvfw&amp;amp;ab_channel=AntStack" rel="noopener noreferrer"&gt;AWS RDS and Prisma. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coming back to Prisma Data Proxy, it is very simple to use. Every database has a database connection URL. In exchange for this URL, Prisma Data Proxy provides a proxy URL. To query the database we will use this proxy URL. For migrations, we will use the original database connection URL.&lt;/p&gt;

&lt;p&gt;Let's look at the details to use Prisma Data Proxy:&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Add your project to the Prisma Data Platform
&lt;/h3&gt;

&lt;p&gt;Go to &lt;a href="https://cloud.prisma.io/" rel="noopener noreferrer"&gt;Prisma Data Platform&lt;/a&gt;. Sign in with your Github profile and select your project repository. The Platform will automatically detect the path of &lt;code&gt;schema.prisma&lt;/code&gt; file.&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%2F1xrlh4j1e22apmx0ubyw.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%2F1xrlh4j1e22apmx0ubyw.png" alt="Connect your Repo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Provide your database URL
&lt;/h3&gt;

&lt;p&gt;Provide your database URL. As of now, Data Proxy supports two regions only. select the region closer to your database.&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%2F143kfo2w0yb1r29yv0ry.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%2F143kfo2w0yb1r29yv0ry.png" alt="add database details"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Get the Prisma Data Proxy URL
&lt;/h3&gt;

&lt;p&gt;Get a Proxy URL in exchange for your database URL.&lt;br&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%2F0odwsjb1gvjtp6c7obdk.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%2F0odwsjb1gvjtp6c7obdk.png" alt="Generate proxy URL"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 4: Replace the URL in your environment file.
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DATABASE_URL="prisma://aws-us-east-1.prisma-data.com/?api_key=j_5xpbBnfdcMfRH-HA7bBazLKirYR2FtwTankit0ItsYE6HhzZ8YoCSnVd5KyyeKks"

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

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step 5: Change the generator client in your &lt;code&gt;schema.prisma&lt;/code&gt; file  by adding &lt;code&gt;previewFeatures&lt;/code&gt; flag.
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["dataProxy"]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step 6: Generate the client
&lt;/h3&gt;

&lt;p&gt;To generate the client run the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PRISMA_CLIENT_ENGINE_TYPE='dataproxy' npx prisma generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and you are done. No more connection issues. All your queries will use the connections from the connection pool provided by the Prisma Data Proxy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before we say Goodbye
&lt;/h3&gt;

&lt;p&gt;I've found &lt;a href="https://www.prisma.io/" rel="noopener noreferrer"&gt;Prisma&lt;/a&gt; ORM very productive and I can't recommend you  enough to try it. In case you need any help, they have a humble and helpful community on  &lt;a href="https://slack.prisma.io/" rel="noopener noreferrer"&gt;slack&lt;/a&gt; as well.&lt;/p&gt;

&lt;p&gt;And you might want to check out  &lt;a href="https://www.antstack.io/#solutions" rel="noopener noreferrer"&gt;AntStack&lt;/a&gt;. We at Antstack help you embrace Serverless stack by designing your business applications. We also let you make architectural decisions keeping cost and best practices in mind.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed reading the article as much as I enjoyed writing it.🤗&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>prisma</category>
      <category>node</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
