<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shreya Dikshit on Medium]]></title>
        <description><![CDATA[Stories by Shreya Dikshit on Medium]]></description>
        <link>https://medium.com/@shreya.dikshit99000?source=rss-85435c38c075------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pF7HeRuY9KbMGD6a</url>
            <title>Stories by Shreya Dikshit on Medium</title>
            <link>https://medium.com/@shreya.dikshit99000?source=rss-85435c38c075------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:34:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shreya.dikshit99000/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Machine Learning Vocabulary You’ll Hear Everywhere]]></title>
            <link>https://towardsdev.com/machine-learning-vocabulary-youll-hear-everywhere-f3d92ea854b9?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3d92ea854b9</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 19:48:44 GMT</pubDate>
            <atom:updated>2025-12-17T06:18:44.530Z</atom:updated>
            <content:encoded><![CDATA[<p>In previous article of the ML Series, we understood how machine learning fits into the modern world. In this article, you will come to understand the set of words you’ll hear in every tutorial. It’ll be like your ML phrasebook. So, let’s dive into it!</p><h3>Data, Features and Labels</h3><p>Data is foundation of any machine learning, this is what a model learns from. Cleaner data leads to better learning. Model learns patterns from the data. So, the model performance depends heavily on how clean and accurate your data is.</p><p>Features are measurable properties or inputs (like height, weight and temperature)</p><p>Labels are the correct answers you want your model to predict.</p><h3>Training, Validation and Test Sets</h3><p>To train and test the model, we split the data into three parts:</p><p><strong>Training set:</strong> used to teach the model</p><p><strong>Validation set:</strong> used to tune parameters and test different versions of the model</p><p><strong>Test set:</strong> used only at the end to check with real-world performance.</p><h3>Model and Algorithm</h3><p>Model is a learned mathematical structure that predicts the output based on the patterns in the data.</p><p>An algorithm is method to train the model (Linear Regression, Logistic Regression, etc)</p><h3>Predictions and Ground Truth</h3><p>Predictions are what model outputs when trained on past data after identifying new patterns.</p><p>Ground Truth is the actual answer, how the result should be given the data.</p><h3>Loss function and Optimization</h3><p>Loss function measures how far off the model’s predictions are from the actual answers (ground truth).</p><p>Optimization is the process of adjusting the model’s parameters to minimize that loss.</p><h3>Overfitting and Underfitting</h3><p>Overfitting of a model happens when it has studied data too much that it fails on new data while underfitting of a model happens when it is trained on very less data that it even fails to capture the underlying patterns.</p><h3>Hyperparameters</h3><p>These are the configuration settings chosen before training the model on data (learning rate, batch size, etc). Think of these hyperparameters as knobs to get the better answers from the model.</p><h3>Evaluation Metrics</h3><p>Metrics help measure how well the machine learning model performs, basically how well the predictions are compared to the actual results (especially when your data is imbalanced). So, there’s accuracy, precision, recall and F1 score.</p><p>Accuracy is the ratio of correctly predicted observations to the total observations.</p><p>Precision determines out of all the predictions that the model made as positive, how many of them are <strong>actually</strong> <strong>correct</strong>.</p><p>Recall means that out of all the actual positives, how many did the model identify correctly.</p><p>F1 Score is the harmonic mean of the precision and recall. These will come handy when we measure the performance of our trained model.</p><h3>Bias and Variance</h3><p>Bias is the error due to overly simplistic assumptions in the model. Variance is the error due to model being too sensitive to small changes in the training data. A good model balances the difference between the two and this is called as bias-variance tradeoff.</p><h3>Pipeline and Workflow</h3><p>A pipeline is a sequence of steps that handle data processing, training and evaluation automatically.</p><p>A workflow is a broader process from data collection to deployment.</p><p>Along with these, you’ll hear multiple technical terms like confusion matrix, RQC etc which we will go about when we will analyze a machine learning model’s performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3d92ea854b9" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/machine-learning-vocabulary-youll-hear-everywhere-f3d92ea854b9">Machine Learning Vocabulary You’ll Hear Everywhere</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Modern Machine Learning Landscape]]></title>
            <link>https://towardsdev.com/understanding-the-modern-machine-learning-landscape-0086065f558d?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/0086065f558d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[types-of-machine-learning]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Mon, 20 Oct 2025 05:08:58 GMT</pubDate>
            <atom:updated>2025-10-21T11:01:50.604Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started exploring Machine Learning, I was curious how code could “learn” the data, something traditional programming couldn’t promise.</p><p>So, this article is going to be about building the context and understanding how ML fits into modern world, how it differs from traditional coding and how data flows through the entire ML pipeline.</p><h4>What’s the difference between Machine Learning and Traditional Programming?</h4><p>In traditional programming, we explicitly write rules, while in Machine learning, we give examples and let machine learn the rules itself. For example, in traditional programming, we write something like:</p><p>If temperature &gt; 30 print “hot day”</p><p>else print “normal day”</p><p>While in Machine Learning, we feed examples of temperature-weather pairs data, and it learns the rules itself.</p><h4>The Three Pillars of Machine Learning</h4><p><strong>Supervised Learning- Learning with a teacher</strong></p><p>You have the labeled data, which means you already know the answer. You have inputs X, output/ labels Y. So the generalization is like <strong><em>f: X -&gt;Y.</em></strong></p><p>The typical tasks that this kind of machine learning solves are like regression and classification. Regression is the one in which we predict a continuous value and the classification in which we predict a class/label based on the data we already have.</p><p><strong>Example:</strong></p><blockquote>Predict house prices when you already know past houses and their prices.</blockquote><p>It’s like how we study the past year exam papers, to get the better understanding of patterns.</p><p>Common uses: Price prediction, Email spam filters, Disease diagnosis, etc</p><p><strong>Unsupervised Learning- Exploring without answers</strong></p><p>Now, you have data but there are no labels. The model tries to find the pattern, relationships or groups by itself.</p><p>Example:</p><blockquote>Grouping customers based on their shopping habits as high-value or casual</blockquote><p>Common uses: Customer Segmentation, Anomaly Detection, etc</p><p><strong>Reinforcement Learning- Learning by doing</strong></p><p>This one feels like playing a game. In this, the model interacts, takes action, gets reward or penalty and gradually learns what works best.</p><p>Example:</p><blockquote>A self driving car learns to stay in lane by earning points for smooth driving and loosing points for collisions.</blockquote><p>It’s the trial and error kind of learning that we use all the time.</p><p>Common uses: Games, Warehouse Optimization, etc.</p><p>So, let’s revise this with a simple snapshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yz0mUR86r3UPuXyteLJOLg.jpeg" /><figcaption>Types of Machine Learning</figcaption></figure><p>In the next article of this series, you’ll get to know the common vocabulary used in Machine Learning like features, overfitting, underfitting, hyperparameters. So, Stay tuned. Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0086065f558d" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/understanding-the-modern-machine-learning-landscape-0086065f558d">Understanding the Modern Machine Learning Landscape</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning Journey: Where It All Began]]></title>
            <link>https://towardsdev.com/machine-learning-journey-where-it-all-began-4f2f564655ae?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2f564655ae</guid>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Mon, 06 Oct 2025 08:19:58 GMT</pubDate>
            <atom:updated>2025-10-07T12:13:18.785Z</atom:updated>
            <content:encoded><![CDATA[<p>When we talk about machine learning today, we think of voice-assistant Alexa or Netflix recommending your next favourite show. But have you wondered when machines actually started “learning”?</p><p>As I began my machine learning journey, I thought it would be exciting to look back at how it all started.</p><h4><strong>The Origins of Machine Learning</strong></h4><p><strong>1950, The Vision: Alan Turing, </strong>you must have heard the name, published the “Computing Machinery and Intelligence”. He posed the famous Turing Test we learn about in our computer science subjects. Turing Test suggests that if a machine could carry on the conversation indistinguishable from a human, could we say it has intelligence? This planted the seed of the idea.</p><p><strong>The first practical example:</strong> <strong>Arthur Samuel</strong>, IBM Researcher, created a checkers-playing program. What made it groundbreaking was that it improved its strategy more it played. This was one of the first uses of machine learning.</p><p><strong>1957, The Perceptron: Frank Rosenblatt</strong>, introduced the Perceptron, the earliest form of neural network. It was designed to mimic how the human brain recognize patterns. Though limited, it paved the way for what we later come to know as deep learning.</p><p>Through 1960s-80s, Machine Learning found small but very important roles. Stuff like recognizing handwritten characters, early speech recognition experiments, medical diagnose systems. The real boom came in 1990s when the computing power increased. ML started getting used for spam filters, handwriting recognition and search engines.</p><p>By the 2000s, with the big data, ML was everywhere — recommendation systems, fraud detection, medical imaging, etc. Machine Learning is becoming very useful in prediction and making an evaluated decision.</p><p>I find it fascinating that something modern as ML has its root back in 1950s. From checkers to Netflix recommendations, it shows how far we’ve come. In these days, ML is not just a research, it has become part of our daily lives.</p><p>So, next few days, I’ll be documenting my learning journey, step by step, to understand this field better. Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2f564655ae" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/machine-learning-journey-where-it-all-began-4f2f564655ae">Machine Learning Journey: Where It All Began</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is EDI (X12 Standard)? (A Beginner’s Guide)]]></title>
            <link>https://towardsdev.com/what-is-edi-x12-standard-a-beginners-guide-beab9508d0c1?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/beab9508d0c1</guid>
            <category><![CDATA[electronicdatainterchange]]></category>
            <category><![CDATA[x12]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Sat, 30 Aug 2025 14:02:07 GMT</pubDate>
            <atom:updated>2025-09-03T12:08:11.507Z</atom:updated>
            <content:encoded><![CDATA[<p>When we want to communicate to people, we talk or send messages or mail them, but when two businesses want to communicate, they use something called as EDI. It stands as Electronic Data Interchange. It’s a standardized way to exchange business documents like purchase orders, sales orders, ship notices etc. When I first came across EDI, it felt quite confusing at first, just a sequence of strange segments and numbers. But as I started to look at it from the business perspective of it, things clicked. EDI is simply a common <em>language</em> that lets two companies’ computer systems talk to each other.</p><p>Every type of business transaction in EDI is assigned an transaction set number. For example, <strong>810</strong> is <strong>Invoice</strong>, <strong>856</strong> is <strong>Advance Ship Notice</strong> etc. These numbers ensure that no matter which companies are talking to each other, both systems know what kind of document they’re dealing with.</p><h4>How Businesses Actually use EDI</h4><p>Let’s take an example of 2 business B1 and B2. B1 needs to purchase 1000 shoes from B2. Traditionally, B1 will email or fax a purchase order and someone at B2 will re-enter this into their system. This is slow and error-prone.</p><p>With EDI, it works like this instead:</p><ol><li>B1’s system generates an <strong>850 Purchase Order</strong> in X12 format.</li><li>That file is sent electronically to B2.</li><li>B2’s system receives it, and automatically understands it, and creates a sales order without anyone typing anything.</li><li>When the order is shipped, B2 sends an <strong>856 Advance Ship Notice</strong> to B1.</li><li>Later, it sends <strong>810</strong> <strong>Invoice</strong> so B1 can make the payment.</li><li>Then, B1’s system sends <strong>997</strong> <strong>Functional Acknowledgment</strong> saying “<em>okay, got it!”</em></li></ol><h4>How EDI File Travels</h4><p>Creating an EDI file is half the job and the other half is sending it securely to your trading partner. Over the years, businesses have used different methods. Most common means of transport include VANs, AS2, SFTP/FTPS, API-based EDI. Someone gave me analogy of it as, VANs are like digital post office, AS2 as a courier, SFTP as a dropbox and API-based as developer friendly option.</p><h4>What is X12?</h4><p>There are several standards across the world for EDI. Most widely used one in US is <strong>ANSI X12</strong> — developed by the American National Standards Institute.</p><p>Here are common X12 transactions sets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQyNHFhmf5uh5UWEFJTCdg.png" /><figcaption>X12 Transaction Sets</figcaption></figure><h4>Building Blocks of an EDI file</h4><p>An EDI file may look like gibberish at first as it’s a long string of characters separated by * and ~. But it is highly structured.</p><p>* is a element separator and ~ is a segment separator. Below is the sample EDI for 850 (Purchase Order) (Reference took from stedi.com)</p><pre>ISA*00*          *00*          *ZZ*STEDI          *ZZ*ACME           *210901*1234*U*00801*000000001*0*T*&gt;~<br>GS*PO*SENDERGS*007326879*20210901*1234*1*X*008020~<br>ST*850*000000001~<br>BEG*24*SP*PO-00001**20210901~<br>N1*2L*STEDI INC.~<br>REF*K6*The EDI platfrom for developers~<br>PER*SR**EA*team@stedi.com~<br>PO1**1*1N*500*PM*GE*Stedi Core~<br>PO1**1*C0*0.001*PE*GE*Mappings~<br>CTT*2~<br>SE*9*000000001~<br>GE*1*1~<br>IEA*1*000000001~</pre><p>After observing the above EDI, the segments are those who are at the leftmost part of each line, these are ISA, GS, ST, BEG, N1, REF, PER, PO1, CTT, SE, GE, IEA. These segments represent a specific kind of information. Also, the EDI above is formatted (It’s not necessary that the EDI you receive is formatted it can come as a single line without line breaks). Also, some segments in EDI are not mandatory and are optional.</p><p>Now if we break it down:</p><ul><li>ISA/IEA -&gt; Outer envelope (its like the box you ship the documents in)</li><li>GS/GE -&gt; Group of related transactions</li><li>ST/SE -&gt; The actual transaction (purchase order itself)</li><li>Segments (BEG, N1, PO1 etc) -&gt; Each line holds a specific piece of information like who ordered, what item, how many, where to ship to, bill to etc.</li></ul><p>The another thing in EDI that you will notice is <strong>loops</strong>. A <strong>loop</strong> is simply a repetitive group of segments that belong together. Think of it as like having multiple items in a cart. Each item has its own product ID, quantity and price.</p><p>Let’s take an example. If a retailer buys 2 products so, in 850 purchase order, we will have a PO1 loop repeat.</p><pre>PO1*1*10*EA*15.00*PE*BP*123456<br>PID*F****Red T-Shirt<br>PO1*2*5*EA*45.00*PE*BP*654321<br>PID*F****Blue Jeans</pre><p>In the above EDI, we can see that:</p><ol><li>Each <strong>PO1</strong> segment is one line item segment.</li><li><strong>PID</strong> (product description) belongs to PO1 and together they form PO1 loop. This can be repeated as many times.</li></ol><p>Let’s take example of another loop. N1 loop:</p><pre>N1*ST*ABC Store*9*111111111<br>N3*123 Main St<br>N4*New York*NY*10001<br>N1*BT*ABC HQ*9*222222222<br>N3*456 Market Ave<br>N4*Chicago*IL*60601</pre><p>In the above EDI:</p><ol><li><strong>N1</strong> indicates the name of the party (Bill to (BT), Ship to (ST), etc.)</li><li><strong>N3</strong> represents the street address.</li><li><strong>N4</strong> represents the city, state and zip.</li><li>This repeats for each party in transaction.</li></ol><p>EDI has been there since 1970s, but it is still the backbone of logistics, retail, healthcare, and manufacturing. EDI is used by big corporations as well as small suppliers to do their business with big retailers or distributors.</p><p>For more understanding of multiple segments related to a transaction, you can visit stedi.com. I found it very useful.</p><p>So, the next time you order something from Amazon, remember that behind the scenes, an EDI transaction probably made it happen! Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beab9508d0c1" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/what-is-edi-x12-standard-a-beginners-guide-beab9508d0c1">What is EDI (X12 Standard)? (A Beginner’s Guide)</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Guide: Databricks on AWS (Part 2) — Networking and IAM]]></title>
            <link>https://towardsdev.com/terraform-guide-databricks-on-aws-part-2-networking-and-iam-c13e7d2276eb?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/c13e7d2276eb</guid>
            <category><![CDATA[databricks-on-aws]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 20:17:07 GMT</pubDate>
            <atom:updated>2025-08-21T14:53:42.712Z</atom:updated>
            <content:encoded><![CDATA[<h3>Terraform Guide: Databricks on AWS (Part 2) — Networking and IAM</h3><p>In Part 1, we took a quick look at the components necessary for provisioning Databricks on AWS. In Part 2, we will start building the actual infrastructure step-by-step, using Terraform. Before running this, ensure that you’ve created your Databricks Account and have Account Console credentials and account_id, client_id &amp; client_secret ready.</p><pre>databricks-on-aws/<br>│<br>├── main.tf<br>├── variables.tf<br>├── outputs.tf<br>├── terraform.tfvars<br>├── providers.tf <br>├── modules/<br>│   ├── vpc/<br>│   ├── iam/<br>│   └── databricks/</pre><h4>Providers Configuration</h4><p>Since we are using both AWS and Databricks providers, let’s declare them in a providers.tf file:</p><pre>terraform {<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>    }<br>    databricks = {<br>      source  = &quot;databricks/databricks&quot;<br>    }<br>  }<br>}<br><br>provider &quot;aws&quot; {<br>  region = var.aws_region<br>}<br><br>provider &quot;databricks&quot; {<br>  alias         = &quot;mws&quot;<br>  host          = &quot;https://accounts.cloud.databricks.com&quot;<br>  account_id    = var.databricks_account_id<br>  client_id     = var.client_id<br>  client_secret = var.client_secret<br>}</pre><h4>Subnets Setup in Terraform</h4><p>Let’s begin by defining private subnets in an existing VPC. These subnets are created across Availability Zones and tagged appropriately for Databricks usage.</p><pre><br>resource &quot;aws_subnet&quot; &quot;private_subnets&quot; {<br>  for_each                = var.private_subnets<br>  vpc_id                  = var.vpc_id<br>  cidr_block              = each.value.subnet_cidr<br>  availability_zone       = each.value.subnet_az<br>  map_public_ip_on_launch = false<br>  tags = merge(<br>    tomap({ &quot;Name&quot; : format(&quot;%s%s%s&quot;, var.resource_name_prefix, each.value.subnet_az_name, each.value.subnet_name), &quot;SubnetTier&quot; = &quot;PrivateSubnet&quot; }),<br>    each.value.additional_tags<br>  )<br>}</pre><h4>Routing for private subnets</h4><p>Private route tables are associated with the subnets and NAT gateways to ensure internet access for compute nodes.</p><pre>resource &quot;aws_route_table&quot; &quot;private_rt&quot; {<br>  for_each = var.private_subnets<br>  vpc_id   = var.vpc_id<br>  tags     = merge(tomap({ &quot;Name&quot; = format(&quot;%s%sPrivateRouteTable&quot;, var.resource_name_prefix, each.key) }),var.tags)<br>}<br><br>resource &quot;aws_route&quot; &quot;private_rt_route_nat_gw&quot; {<br>  for_each               = var.private_subnets<br>  route_table_id         = aws_route_table.private_rt[each.key].id<br>  nat_gateway_id         = var.nat_gateway_id<br>  destination_cidr_block = &quot;0.0.0.0/0&quot;<br>  depends_on             = [aws_route_table.private_rt, var.nat_gateway_id]<br>}</pre><h4>Security Groups and ACLs</h4><p>Security groups are configured to allow necessary traffic for Databricks compute and workspace access.</p><pre>resource &quot;aws_security_group&quot; &quot;sg&quot; {<br>  for_each    = var.security_groups<br>  name        = &quot;${var.resource_name_prefix}-${each.value.name}-sg&quot;<br>  description = &quot;Default security group to allow inbound/outbound from the VPC&quot;<br>  vpc_id      = var.vpc_id<br><br>  dynamic &quot;ingress&quot; {<br>    for_each = each.value.ingress<br>    content {<br>      from_port = ingress.value.from_port<br>      to_port   = ingress.value.to_port<br>      protocol  = ingress.value.protocol<br>      self      = true<br>    }<br>  }<br><br>  dynamic &quot;egress&quot; {<br>    for_each = each.value.egress<br>    content {<br>      from_port   = egress.value.from_port<br>      to_port     = egress.value.to_port<br>      protocol    = &quot;tcp&quot;<br>      cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>    }<br>  }<br><br>  tags = var.tags<br>}</pre><h4>Create Assume Role Policy</h4><p>This generates the assume role policy that allows Databricks to assume an IAM role in your AWS account.</p><pre>data &quot;databricks_aws_assume_role_policy&quot; &quot;databricks_aws_assume_role_policy&quot; {<br>  provider    = databricks.mws<br>  external_id = var.databricks_account_id<br>}</pre><h4>Create Cross-Account role</h4><p>Now, let’s define an IAM role with the assume policy fetched from Databricks.</p><pre>resource &quot;aws_iam_role&quot; &quot;cross_account_role&quot; {<br>  name               = &quot;${var.resource_name_prefix}-crossaccount&quot;<br>  assume_role_policy = data.databricks_aws_assume_role_policy.databricks_aws_assume_role_policy.json<br>  tags = var.tags<br><br>}</pre><h4>Attach Databricks Policy</h4><p>This policy provides Databricks with the necessary permissions to manage AWS resources.</p><pre>data &quot;databricks_aws_crossaccount_policy&quot; &quot;databricks_aws_crossaccount_policy&quot; {<br>  provider    = databricks.mws<br>  policy_type = &quot;customer&quot;<br>}<br><br>resource &quot;aws_iam_role_policy&quot; &quot;aws_iam_role_policy&quot; {<br>  name   = &quot;${var.resource_name_prefix}-policy&quot;<br>  role   = aws_iam_role.cross_account_role.id<br>  policy = data.databricks_aws_crossaccount_policy.databricks_aws_crossaccount_policy.json<br>}</pre><h4>Register MWS Credentials</h4><p>Finally, register this IAM role with Databricks MWS Credentials. databricks_mws_credentials registers the role so it can be used while creating the workspace.</p><pre>resource &quot;databricks_mws_credentials&quot; &quot;databricks_mws_credentials&quot; {<br>  provider         = databricks.mws<br>  role_arn         = aws_iam_role.cross_account_role.arn<br>  credentials_name = &quot;${var.resource_name_prefix}-creds&quot;<br>  depends_on       = [aws_iam_role_policy.aws_iam_role_policy]<br>}</pre><p>Nextly, we need to configure the variables in variables.tf for respective modules like this:</p><pre># for vpc/variables.tf<br><br>variable &quot;aws_region&quot; {<br>  description = &quot;AWS region to deploy resources in&quot;<br>  type        = string<br>  default     = &quot;us-east-2&quot;<br>}<br><br>variable &quot;resource_name_prefix&quot; {<br>  description = &quot;Prefix to use for all resource names&quot;<br>  type        = string<br>}<br><br>variable &quot;tags&quot; {<br>  description = &quot;Tags to apply to all resources&quot;<br>  type        = map(string)<br>  default     = {}<br>}<br>variable &quot;vpc_id&quot; {<br>  description = &quot;VPC ID where the subnets will be created&quot;<br>  type        = string<br>}<br><br>variable &quot;nat_gateway_id&quot; {<br>  description = &quot;NAT Gateway ID used for private subnet routing&quot;<br>  type        = string<br>}<br><br>variable &quot;private_subnets&quot; {<br>  description = &quot;Map of private subnets to create&quot;<br>  type = map(object({<br>    subnet_cidr        = string<br>    subnet_az          = string<br>    subnet_az_name     = string<br>    subnet_name        = string<br>    additional_tags    = map(string)<br>  }))<br>}<br><br>variable &quot;security_groups&quot; {<br>  description = &quot;Security group configuration&quot;<br>  type = map(object({<br>    name    = string<br>    ingress = list(object({<br>      from_port = number<br>      to_port   = number<br>      protocol  = string<br>    }))<br>    egress = list(object({<br>      from_port = number<br>      to_port   = number<br>    }))<br>  }))<br>}<br><br><br><br># for iam/variables.tf<br><br>variable &quot;resource_name_prefix&quot; {<br>  description = &quot;Prefix to use for all resource names&quot;<br>  type        = string<br>}<br><br>variable &quot;tags&quot; {<br>  description = &quot;Tags to apply to all resources&quot;<br>  type        = map(string)<br>  default     = {}<br>}<br><br>variable &quot;databricks_account_id&quot; {<br>  description = &quot;Your Databricks Account ID&quot;<br>  type        = string<br>}<br><br>variable &quot;client_id&quot; {<br>  description = &quot;Client ID for Databricks account console&quot;<br>  type        = string<br>  sensitive   = true<br>}<br><br>variable &quot;client_secret&quot; {<br>  description = &quot;Client secret for Databricks account console&quot;<br>  type        = string<br>  sensitive   = true<br>}<br></pre><p>So after setting up these things, in <strong>Part 3</strong>, we’ll create the <strong>Databricks workspace</strong>, <strong>storage configurations</strong>, and <strong>network attachments</strong> using these modules. It’s really great how much we can configure with Terraform, so, the Terraform Registry and Databricks on AWS guides are also helpful if you want to go in a little deeper. Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c13e7d2276eb" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/terraform-guide-databricks-on-aws-part-2-networking-and-iam-c13e7d2276eb">Terraform Guide: Databricks on AWS (Part 2) — Networking and IAM</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Regular Expressions in JavaScript: Learn by Doing]]></title>
            <link>https://towardsdev.com/demystifying-regular-expressions-in-javascript-learn-by-doing-4a86d836921e?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a86d836921e</guid>
            <category><![CDATA[js-regular-expression]]></category>
            <category><![CDATA[regex]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Fri, 08 Aug 2025 09:05:16 GMT</pubDate>
            <atom:updated>2025-08-23T15:56:06.056Z</atom:updated>
            <content:encoded><![CDATA[<p>Regular Expressions (Regex) are often seen as intimidating — unknown sequences of symbols that look like spells than code. But once you crack the logic behind them, regex becomes one of the most powerful tools in your JavaScript toolbox.</p><p>In this article, we will learn regex by doing. Through relatable problems, you will see how regex can clean your data, validate inputs, and extract meaningful patterns — all with minimal code.</p><h4>Extract All Email Addresses</h4><p>Problem: You have a long string and want to extract every email address mentioned</p><pre>const text = &quot;Contact us at sales@example.com or support@example.com&quot;;<br>const emails = text.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g);<br>console.log(emails);<br>// [ &#39;sales@example.com&#39;, &#39;support@example.com&#39; ]</pre><p><strong>Explanation:</strong></p><ol><li>\b : <strong>Word boundary means </strong>“here is the start/end of a word” (zero-width, no chars consumed).</li><li>[A-Za-z0–9._%+-]+ : <strong>Local-part</strong>: one or more letters, digits, dot, underscore, percent, plus or hyphen.</li><li>@ : The literal “@” that separates local-part and domain.</li><li>[A-Za-z0–9.-] : <strong>Domain</strong>: one or more letters, digits, dot or hyphen (allows subdomains).</li><li>\. : Escaped dot: the literal “.” before the TLD.</li><li>[A-Za-z]{2,} : <strong>TLD</strong>: two or more letters (e.g. com, org, co.uk would match just uk).</li><li>\b : <strong>Word boundary</strong> again, to ensure we stop at the end of the address.</li><li>g : <strong>Global</strong> search: find all matches, not just the first.</li></ol><h4>Validate a Strong Password</h4><p>Problem: Ensure a password has at least 1 lowercase, 1 uppercase, 1 digit, 1 special character, and is at least 8 characters long</p><pre>function isStrongPassword(password){<br>  const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{8,}$/;<br>  return regex.test(password);<br>}</pre><p><strong>Explanation:</strong></p><ol><li>^ : Start of string anchor</li><li>(?=.*[a-z]): <strong>Lookahead</strong>: Ensure at least one lowercase character somewhere</li><li>(?=.*[A-Z]): <strong>Lookahead</strong>: Ensure at least one uppercase character somewhere</li><li>(?=.*[\W_]: Lookahead: Ensure at least one non-word character (anything other than A-Za-Z0–9_) including symbols like !@#</li><li>$: End of string anchor</li></ol><h4>Remove Extra Spaces From a Sentence</h4><p>Problem: A sentence has multiple spaces between words. We want to reduce them to a single space.</p><pre>const text = &quot;This has many   spaces&quot;;<br>const cleanText = text.replace(/\s+/g, &#39; &#39;).trim();<br>console.log(cleanText);<br>// &quot;This has many spaces&quot;<br></pre><p><strong>Explanation:</strong></p><ol><li>\s+ : \s matches spaces and + means one or more occurences</li><li>g : The global flag, so every group of spaces in the string is replaced, not just the first.</li><li>‘ ’: We replace each multi-space run with exactly one ordinary space.</li><li>trim(): Strips off accidental leading/trailing spaces that might remain</li></ol><h4>Convert a Date Format</h4><p>Problem: Reformat a date string for use in a database or APIs.</p><pre>const date = &quot;07-08-2025&quot;;<br>const formattedDate = date.replace(/(\d{2})-(\d{2})-(\d{4})/, &#39;$3-$2-$1&#39;);<br>console.log(formattedDate);<br>// &quot;2025-08-07&quot;</pre><p><strong>Explanation:</strong></p><ol><li>/(\d{2})-(\d{2})-(\d{4}) : <strong>Group 1</strong> (\d{2}) =&gt;the day (07) <strong>Group 2</strong> (\d{2}) =&gt; the month (08), <strong>Group 3</strong> (\d{4}) =&gt; the year (2025)</li><li>$3-$2-$1: $3 means the year, $2 means the month, $1 means the day.. which means $3 add Group 3, $2 add Group 2, $1 add Group 1</li></ol><h4>Mask a Phone Number for Privacy</h4><p>Problem: You want to hide part of a phone number, leaving only the last 4 digits visible.</p><pre>const phoneNum = &quot;9876543210&quot;<br>const maskedPN = phoneNum.replace(/\d(?=\d{4})/g,&#39;*&#39;);<br>console.log(maskedPN);</pre><p><strong>Explanation:</strong></p><ol><li>\d : matches a digit</li><li>(?=\d{4}): lookahead: only if there are exactly 4 digits ahead of it</li><li>g: do this for all matches</li><li>Replace the match with *</li></ol><p>This is just the beginning. Regular expressions can parse logs, find broken patterns and more. Once you start using regex in your daily Javascript, you will wonder how you lived without it! Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a86d836921e" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/demystifying-regular-expressions-in-javascript-learn-by-doing-4a86d836921e">Demystifying Regular Expressions in JavaScript: Learn by Doing</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When HMR Went Silent: A Debugging Story and How Hot Module Replacement Works]]></title>
            <link>https://medium.com/@shreya.dikshit99000/when-hmr-went-silent-a-debugging-story-and-how-hot-module-replacement-works-c6c07cc3dfdc?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6c07cc3dfdc</guid>
            <category><![CDATA[hot-module-replacement]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Mon, 04 Aug 2025 15:59:24 GMT</pubDate>
            <atom:updated>2025-08-04T15:59:24.559Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, let’s get to know HMR — and discover how it keeps your app alive while you code</p><blockquote>I thought hot module replacement was my little productivity hero — tweaking styles, changing logic and watching it reflect instant without full page reload. Until one afternoon, a simple CSS change didn’t show up. No crash. No warning. Just stale UI pretending everything was fine. I refreshed, restarted, rewrote but — still nothing. HMR had stopped working and I didn’t even know how it worked to begin with.</blockquote><p>So, let’s pull back the curtain on HMR.</p><h3>What is Hot Module Replacement?</h3><p>Hot Module Replacement is a feature primarily used in development (especially with Webpack, Vite or Parcel) that allows modules to be updated in the browser at runtime without requiring a full refresh. This means you retain the application state while making code changes — especially useful in large React apps.</p><h3>Why Does It Matter?</h3><ul><li><strong>Faster dev cycle:</strong> no reload means no re-initialization</li><li><strong>Preserves state:</strong> your form data, scroll position, component state — all stay intact</li><li><strong>Smoother DX: </strong>You focus on iterating and not loading</li></ul><h3>How HMR Works?</h3><ol><li><strong>File watching:</strong> Dev server watches files for changes</li><li><strong>Incremental build:</strong> On save, it only builds the changed module, not the entire module</li><li><strong>Websocket update:</strong> The dev server sends a Websocket message to the browser</li><li><strong>Runtime patching:</strong> Framework-specific logic, like React fast refresh takes care of updating the UI without losing state</li></ol><p>If <strong>any</strong> of those steps breaks — say, your HMR plugin is misconfigured, the WebSocket disconnects, or your app’s accept handlers are missing — you get stale UI with zero errors. Understanding each layer helps you pinpoint and fix the silent failure, so you can get that instant feedback loop humming again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6c07cc3dfdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debug Guide: Debug Configuration in VS Code]]></title>
            <link>https://towardsdev.com/guide-debug-configuration-in-vs-code-93ecb944ad73?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/93ecb944ad73</guid>
            <category><![CDATA[debugging-tools]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 05:54:17 GMT</pubDate>
            <atom:updated>2025-07-18T12:28:11.090Z</atom:updated>
            <content:encoded><![CDATA[<p>Debugging is more than trial and error; it helps you think analytically and follow best practices. It enhances your problem-solving skills and deepens your understanding of the systems. Debugging is detective work; complex bugs require time to reproduce and understand. Before you fix a bug, you must gather context on how to reproduce it and what are the inputs/environment variables involved are, etc. Sometimes narrowing down also helps pinpoint where the issue lies. Strategic logging also helps find critical things, so log at multiple levels — Use DEBUG for verbose internal state, INFO for high-level milestones, WARNING for recoverable issues, and ERROR for failures.</p><h3>Getting Started: Your First Debug Configuration</h3><ol><li><strong>Open your project folder</strong> in VS Code.</li><li>Click the <strong>Run and Debug</strong> icon in the Activity Bar.</li><li>If you haven’t set up any debug configs yet, you’ll see a button <strong>“create a launch.json file”</strong>. Click it and choose the environment closest to your project (e.g., Node.js, Python, C++, .NET Core). VS Code will scaffold a basic launch.json under a new .vscode folder.</li></ol><pre>// .vscode/launch.json (Node.js example)<br>{<br>  &quot;version&quot;: &quot;0.2.0&quot;,<br>  &quot;configurations&quot;: [<br>    {<br>      &quot;type&quot;: &quot;node&quot;,<br>      &quot;request&quot;: &quot;launch&quot;,<br>      &quot;name&quot;: &quot;Launch Program&quot;,<br>      &quot;program&quot;: &quot;${workspaceFolder}/index.js&quot;,<br>      &quot;cwd&quot;: &quot;${workspaceFolder}&quot;<br>    }<br>  ]<br>}</pre><p>You can tweak fields like program, cwd, and add args or environment variables as needed.</p><h3>Breakpoints: The Core of Interactive Debugging</h3><ul><li><strong>Standard Breakpoints</strong>: Click in the gutter next to a line number. Execution will pause there.</li><li><strong>Conditional Breakpoints</strong>: Right-click an existing breakpoint. <strong>“Edit Breakpoint…”</strong>, then supply an expression (e.g., user.id == 1). The debugger only stops when the condition is truthy.</li><li><strong>Logpoints</strong>: Instead of pausing, have VS Code print a message. Right-click the gutter ⇒ <strong>“Add Logpoint…”</strong>, enter something like User data: {JSON.stringify(user)}. Great for inspecting state without interrupting flow.</li></ul><h3>Exploring State: Variables, Watch, and Call Stack</h3><p>Once paused, you get four key panels in the Run view:</p><ul><li><strong>Variables</strong>: Inspect all in-scope variables and object hierarchies. Expand nested objects to drill in.</li><li><strong>Watch</strong>: Manually add expressions you’re curious about. They update as you step through.</li><li><strong>Call Stack</strong>: See the chain of function calls that got you here. Click any frame to jump there.</li><li><strong>Breakpoints</strong>: A list of all breakpoints with options to enable/disable or add hit-count conditions.</li></ul><p>Use <strong>Step Over</strong>, <strong>Step Into</strong>, <strong>Step Out</strong>, and <strong>Continue </strong>to navigate.</p><h3>Best Practices for VS Code Debugging</h3><ul><li>Keep your launch.json clean: Comment out unused configs or split them into multiple .vscode/*.json files if your workspace handles disparate projects.</li><li>Use workspace variables (${workspaceFolder}, ${file}) to make configs portable.</li><li>Leverage tasks: Combine build or lint tasks with the preLaunchTask so code is compiled/validated before the debugger starts.</li></ul><p>Debugging in VS Code is a seamless, interactive experience. By mastering launch configurations, breakpoint features, and the debug panels, you’ll cut down on guesswork and accelerate your bug-squashing. Whether you’re tracing a tricky async issue in Node.js or stepping through C++ code, VS Code’s debugger empowers you to understand exactly what your code is doing — line by line. Happy debugging!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93ecb944ad73" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/guide-debug-configuration-in-vs-code-93ecb944ad73">Debug Guide: Debug Configuration in VS Code</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Guide: Databricks on AWS (Part 1)]]></title>
            <link>https://medium.com/@shreya.dikshit99000/terraform-guide-databricks-on-aws-part-1-f36056b56510?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/f36056b56510</guid>
            <category><![CDATA[unity-catalog]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Sun, 15 Jun 2025 15:57:19 GMT</pubDate>
            <atom:updated>2025-06-15T15:57:19.921Z</atom:updated>
            <content:encoded><![CDATA[<p>In this guide, we’ll walk through how to use Terraform to automate the setup of <strong>Databricks on AWS</strong>. As you may know, Databricks uses a <strong>control plane</strong> managed by Databricks itself, while the <strong>compute plane</strong> runs in your own AWS account using resources like VPCs, subnets, S3 buckets, and security groups. Manually configuring these components can be repetitive and prone to errors. This guide will help you automate the entire setup using Terraform, ensuring consistency and compliance with Databricks’ infrastructure requirements.</p><p>We will cover the provisioning of VPCs, subnets, security groups, NAT gateway, IAM roles, S3 buckets for storage, the Databricks workspace itself, Unity Catalog with external metastore, and user groups for correct access.</p><p><strong>Prerequisites</strong>: AWS CLI Configured, Databricks Account, Terraform, AWS Account</p><p>In this guide, we will be focusing on the key components below :</p><h4>Key Components:</h4><p><strong>VPC Configuration:</strong> Sets up a <strong>Virtual Private Cloud (VPC)</strong> with <strong>private subnets</strong> across multiple Availability Zones (e.g., us-east-2a, us-east-2c) to ensure <strong>high availability</strong> and <strong>fault tolerance</strong>. This isolation is critical because Databricks compute resources (clusters) run in your cloud account, and the network configuration must meet Databricks&#39; security and connectivity requirements.</p><p><strong>Security Groups:</strong> Defines <strong>inbound and outbound traffic rules</strong> for Databricks-related services (e.g., clusters, web app). This includes allowing specific ports (like 443 for HTTPS) and restricting unwanted access.</p><p><strong>Databricks Workspace: </strong>Creates and configures <strong>Databricks Workspaces</strong>, which act as the main development environment where users create notebooks, clusters, jobs, and other artifacts.</p><p><strong>IAM Integration:</strong> Sets up <strong>AWS IAM roles</strong>, <strong>policies</strong>, and <strong>trust relationships</strong> to grant Databricks permission to access resources in your AWS account (e.g., S3 buckets, KMS, VPC).</p><p><strong>S3 Integration: </strong>Provisions S3 buckets for the storage of system data (logs, libraries, init scripts), tables, and Unity Catalog data locations.</p><p><strong>Metastore: </strong>Deploys the <strong>Unity Catalog metastore</strong>, which is a centralized governance layer for managing metadata, access control, and data lineage.</p><p><strong>Service Principles:</strong> Creates <strong>Databricks service principals</strong>, which are non-human identities used to authenticate services (e.g., automation tools, CI/CD pipelines, jobs, integrations).</p><p><strong>User Group Management: </strong>Manages <strong>Databricks users and groups</strong> with roles like Admin, Data Engineer, and Analyst. Assigns appropriate access levels based on responsibilities.</p><p><strong>Storage Credentials:</strong> Creates Databricks storage credentials linked to IAM roles, enabling secure access to specific S3 locations from within the Databricks environment.</p><p><strong>External Locations:</strong> Defines <strong>external locations</strong> in Unity Catalog, which map S3 URIs to logical paths used in data lake architectures</p><p><strong>Catalogs and Schemas:</strong> Creates logical catalogs and schemas with Unity Catalog to organize data assets (Tables, Views, and Functions)</p><p>In the next section, we’ll begin writing Terraform code to implement these components. See you there!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36056b56510" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Code with Constants in Node.js — a way to manage the static values]]></title>
            <link>https://medium.com/@shreya.dikshit99000/clean-code-with-constants-in-node-js-a-way-to-manage-the-static-values-ce8f1e6b7057?source=rss-85435c38c075------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce8f1e6b7057</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[constant]]></category>
            <dc:creator><![CDATA[Shreya Dikshit]]></dc:creator>
            <pubDate>Fri, 13 Jun 2025 12:10:06 GMT</pubDate>
            <atom:updated>2025-06-13T12:10:06.881Z</atom:updated>
            <content:encoded><![CDATA[<h3>Clean Code with Constants in Node.js — a way to manage the static values</h3><p>When building backend applications with Node.js, you’ll often use repeated values like status codes, errors, messages, or config flags. Instead of hardcoding them everywhere, a clean and maintainable approach is to extract them into <strong>constants</strong>.</p><h4>Why use Constants?</h4><p>Imagine you’re building an API and hardcoding like this:</p><pre>res.status(404).json({message: &quot;User not found&quot;});</pre><p>Now, imagine this appears 10 times in your code files. If you ever want to change the message or status code, you will need to make changes in 10 different places. That’s where constants come into play. It gives us centralized control, fewer bugs, and ease in maintenance.</p><blockquote>A good convention is to create your constants folder in the root directory of the project.</blockquote><p>For example:</p><pre>// constants/statusCodes.js<br>module.exports = {<br>OK: 200,<br>CREATED: 201,<br>BAD_REQUEST: 400,<br>UNAUTHORIZED: 401,<br>NOT_FOUND: 404,<br>INTERNAL_SERVER_ERROR: 500,<br>};<br><br>//constants/messages.js<br>module.exports = {<br>USER_NOT_FOUND: &quot;User not found&quot;,<br>UNAUTHORIZED_RESOURCE: &quot;You are not allowed to access this resource&quot;,<br>};<br><br>//constants/index.js<br>const statusCodes = require(&#39;./statusCodes.js&#39;);<br>const messages = require(&#39;./messages.js&#39;);<br>module.exports = {<br>statusCodes,<br>messages,<br>};</pre><p>Now, here’s how you use them after importing them whenever needed.</p><pre>if(!user){<br>return res.status(statusCodes.NOT_FOUND).json({message: messages.USER_NOT_FOUND});<br>}<br>return res.status(statusCodes.OK).json(user);</pre><p>To make the constants truly immutable, use <strong>Object.freeze().</strong></p><pre>// constants/statusCodes.js<br>const statusCodes = Object.freeze({<br>  OK: 200,<br>  CREATED: 201,<br>  BAD_REQUEST: 400,<br>  UNAUTHORIZED: 401,<br>  NOT_FOUND: 404,<br>  INTERNAL_SERVER_ERROR: 500,<br>});<br><br>module.exports = statusCodes;</pre><p>Using constants in your Node.js application is a small step that goes a long way in improving the structure and maintainability of your codebase. Whether you’re handling API responses or configuration values, constants give you the clarity and flexibility every robust backend needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce8f1e6b7057" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>