<?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 Aditya Maheshwari on Medium]]></title>
        <description><![CDATA[Stories by Aditya Maheshwari on Medium]]></description>
        <link>https://medium.com/@adityamah2002?source=rss-1fe63713236d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WuGnu2dt3Nyq9GyTp9sKnw.jpeg</url>
            <title>Stories by Aditya Maheshwari on Medium</title>
            <link>https://medium.com/@adityamah2002?source=rss-1fe63713236d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:30:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityamah2002/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[From Monolith to Microservices: A Practical Guide Using DDD, Strangler Pattern & ACL]]></title>
            <link>https://medium.com/@adityamah2002/from-monolith-to-microservices-a-practical-guide-using-ddd-strangler-pattern-acl-886e1b24fac5?source=rss-1fe63713236d------2</link>
            <guid isPermaLink="false">https://medium.com/p/886e1b24fac5</guid>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[strangler-pattern]]></category>
            <category><![CDATA[ddd]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 13:43:05 GMT</pubDate>
            <atom:updated>2026-04-11T13:43:05.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UqP4gZAtqsWqOz3ToGDIGQ.png" /></figure><p>Most teams or people just start migrating the codebase from monolith to microservices without knowing the proper structure or pattern you should use and in the half way, they start facing heat from the codebase and they have to start again with the proper planning.</p><p>The most common thing they do is to <strong>rewrite everything at once</strong>.</p><blockquote>Big-bang rewrites sound exciting— until they hit production.</blockquote><p>This is one of the major reasons people fail migrating codebases.</p><p>So, lets know about few important patterns that are required for successful migration.</p><p>Instead of rewriting everything:</p><blockquote>Migrate gradually, safely and incrementally.</blockquote><p>This blog is a practical guide to doing exactly that using:</p><ul><li><strong>Strangler Fig Pattern</strong> (migration strategy)</li><li><strong>Domain-Driven Design</strong> (DDD) (how to split)</li><li><strong>Anti-Corruption Layer </strong>(ACL) (clean integration)</li></ul><h3>Step 1: Understand Your Monolith</h3><p>A typical Spring Boot monolith looks like this:</p><pre>controller/<br>service/<br>serviceImpl/<br>repository/<br>entity/</pre><p>Example:</p><pre>@Service<br>public class OrderServiceImpl implements OrderService{<br><br>    @Override<br>    public void placeOrder(OrderRequest request) {<br>        // business logic<br>        // payment logic<br>        // DB logic<br>    }<br>}</pre><p><strong>Problems</strong>:</p><ul><li>Everything is mixed together</li><li>Hard to isolate features</li><li>One change affects everything</li></ul><p>Although this type of layering code is fine for small codebases, but for larger codebases it becomes burdensome to navigate such big codebase even for very small changes.</p><h3>Step 2: Why Big-Bang Rewrite is a Bad Idea</h3><p>Many teams attempt:</p><blockquote>Monolith → Rewrite → Microservices</blockquote><p><strong>Problems:</strong></p><ul><li>Take months(or years)</li><li>No incremental value</li><li>High failure rate</li></ul><h3>Step 3: Use the Strangler Fig Pattern</h3><blockquote>Gradually replace parts of a monolith with new services, <strong>piece by piece</strong>, until the old system “dies”.</blockquote><h4>How it works:</h4><p>Initially:</p><pre>Client -&gt; Monolith</pre><p>After introducing the gateway:</p><pre>Client → Gateway<br>        ├── /orders → New Order Service<br>        └── others → Monolith </pre><p>You gradually redirect traffic.</p><p>Before:</p><pre>/orders → monolith</pre><p>After:</p><pre>/orders → order-service</pre><p>Everything else still uses the monolith.</p><h3>Step 4: Use DDD to Identify Services</h3><blockquote>DDD helps you decide <strong>WHAT</strong> to extract.</blockquote><p>So, as I told earlier that layering style of code is good for small codebases, but many big companies still use that, but the better way to do that is using <strong>Domain Driven Design.</strong></p><p>In the layering style code, you are making separations by technical layers, which is burdensome with navigating and making code changes in the bigger codebases, whereas in the DDD <strong>you make separations with the domain.</strong></p><p>For eg:</p><p>Before DDD:</p><pre>com.example.app<br>│<br>├── controller<br>│   └── OrderController.java<br>│<br>├── service<br>│   ├── OrderService.java<br>│   └── OrderServiceImpl.java<br>│<br>├── repository<br>│   └── OrderRepository.java<br>│<br>├── entity<br>│   └── Order.java<br>│<br>├── dto<br>│   └── OrderRequest.java<br>│<br>└── util</pre><p>So if you want to change “Order Logic”, you touch 5 folders….</p><p>After DDD:</p><p>Now we organise by <strong>business domain</strong>.</p><pre>com.example.app<br>│<br>├── order<br>│   ├── domain<br>│   │   ├── Order.java<br>│   │   ├── OrderItem.java<br>│   │   ├── OrderRepository.java<br>│   │   └── OrderService.java <br>│   │<br>│   ├── application<br>│   │   └── PlaceOrderService.java<br>│   │<br>│   ├── infrastructure<br>│   │   └── JpaOrderRepository.java<br>│   │<br>│   ├── presentation<br>│   │   └── OrderController.java<br>│   │<br>│   └── dto<br>│       ├── OrderRequest.java<br>│       └── OrderResponse.java<br>│<br>├── payment<br>│   ├── domain<br>│   ├── application<br>│   ├── infrastructure<br>│   └── presentation<br>│<br>└── shared<br>    └── Money.java</pre><p>Now, order is called a <strong>subdomain</strong> here, likewise payment is also a subdomain.</p><p>Here in this, <strong><em>Domain</em></strong> is the center.</p><p>DDD is also good for team scaling.</p><p><strong>Now with this DDD design, you can split this modular frontend to individual microservices easily.</strong></p><p>So,</p><pre>Monolith → Modular Monolith → Microservices</pre><pre>order → Order Service<br>payment → Payment Service</pre><h3>Step 5: Anti-Corruption Layer(ACL)</h3><blockquote>Protect your new service from legacy mess.</blockquote><p>As you in the process of migration, as your services are coupled/dependent on each other so there should be some way to communicate with them properly right, in short, something that should <strong>keep your created microservices clean and microservice still talking with the monolith, getting the data.</strong></p><p>There we introduce ACL layer.</p><p><strong>This ACL layer is written inside the microservices not the monolith, microservice is the consumer.</strong></p><p>See, we want clean meaningful naming convention now in the microservice to work now, we don’t require confusing and bad naming convention that are good for us in monolith but not in the microservice.</p><h4><strong>Example:</strong></h4><h4>Without ACL:</h4><p>Legacy system response(monolith):</p><pre>{<br>  &quot;cust_id&quot;: &quot;123&quot;,<br>  &quot;cust_nm&quot;: &quot;Aditya&quot;,<br>  &quot;acc_bal&quot;: 1000<br>}</pre><p>Without ACL also you can use this everywhere like this,</p><pre>class Customer {<br>    String cust_id;<br>    String cust_nm;<br>    double acc_bal;<br>}</pre><p>but its not clean and will create issues later with the naming and all.</p><h4><strong>With ACL:</strong></h4><p><strong>Step 1: Create clean domain model</strong></p><pre>class Customer {<br>    String id;<br>    String name;<br>    Money balance;<br>}</pre><p><strong>Step 2: Add ACL(translator)</strong></p><pre>class CustomerTranslator {<br><br>    public Customer toDomain(LegacyCustomer legacy) {<br>        return new Customer(<br>            legacy.getCust_id(),<br>            legacy.getCust_nm(),<br>            new Money(legacy.getAcc_bal())<br>        );<br>    }<br>}</pre><p><strong>Step 3: Use only clean model</strong></p><pre>Customer customer = translator.toDomain(legacyResponse);</pre><p>Your new system(microservice) never sees the legacy ugliness.</p><h3>Step 6 (Final): Putting it all together</h3><p>Here’s the complete migration flow:</p><ol><li>Identify subdomain(DDD)</li><li>Extract service (Strangler Pattern)</li><li>Add ACL to communicate with monolith</li><li>Gradually redirect traffic</li><li>Repeat for next domain</li></ol><h3>End of the Blog</h3><p>If you find this blog helpful, please give it a clap and share!</p><p>You can connect me on <a href="https://www.linkedin.com/in/aditya-maheshwari-50bb37229/">LinkedIn</a>.</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=886e1b24fac5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distributed Tracing in Spring Boot 3]]></title>
            <link>https://medium.com/@adityamah2002/distributed-tracing-in-spring-boot-3-94a20e3323e4?source=rss-1fe63713236d------2</link>
            <guid isPermaLink="false">https://medium.com/p/94a20e3323e4</guid>
            <category><![CDATA[opentelemetry]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[spring-boot-3]]></category>
            <category><![CDATA[distributed-tracing]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Sun, 01 Mar 2026 19:52:37 GMT</pubDate>
            <atom:updated>2026-03-01T19:52:37.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdySQM9x4pD90iBHpU9hZw.png" /></figure><p>Lets talk about “distributed” tracing in spring boot 3.</p><p>Why specifically in distributed systems? <br>Because in monolith systems you only have one thread and through that thread you can easily trace any request, but in distributed systems where many systems coordinate over a network and process the request , multiple threads gets involved.</p><h3>Content of this blog:</h3><ol><li>What are distributed systems?</li><li>What distributed tracing means?</li><li>W3C Format and Telemetry data.</li><li>What is OpenTelemetry and Micrometer?</li><li>What do you mean by Observability Backend here?</li><li>Deep Dive into OpenTelemetry.</li><li>End of this blog.</li></ol><p>Let’s dive deep into the topics.</p><h3>1. What are distributed systems?</h3><p>Distributed systems is when multiple computers are working together over a network to appear as a single system.<br>There can be many types of distributed systems, people often confuse microservices with the distributed systems, microservice is a type of distributed systems, there are many other types of distributed systems like</p><ul><li><strong>Distributed Databases </strong><br>Eg. Cassandra, CockroachDB, MongoDB cluster etc.</li><li><strong>Distributed File Systems</strong><br>Eg. Hadoop, Google File System(GFS), Amazon S3 etc.</li><li><strong>Cluster Management Systems<br></strong>Eg. Kubernetes, Nomad etc.<br>Yes, Kubernetes itself is a distributed system.</li><li><strong>Distributed Messaging Systems<br></strong>Eg. Kafka, RabbitMQ cluster etc.</li><li><strong>CDNs<br></strong>Eg. Cloudfare, Akamai, Fastly<br>They distribute content across global edge nodes.</li><li><strong>Distributed Cache Systems</strong><br>Eg. Redis Cluster, Memcached Cluster</li></ul><p>Many more types……….</p><p>The core problem distributed systems solve is consistency, partition tolerance, fault tolerance, consensus and latency.</p><p>So, microservices are basically business oriented distributed systems, they are only a type of architectural pattern.</p><h3>2. What distributed tracing means?</h3><p>In monolith application, you can just apply one MDC filter and track the request, as it works on a single thread, but thing starts getting interesting when the architecture is microservices, you want that request’s trace path, metrics and logs, and if you are sending something with the request apart from it, called as “baggage” in technical terms, and there are multiple threads invloved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*TVHNcXz30so8UBQjz5zIkw.png" /></figure><p>So, these are all completely different threads in different processes, they cannot share memory, thread local variables and anything directly.</p><p>So, what actually connects them is the traceId + spanId passed via HTTP headers.</p><p>Lets understand traceId and spanId:</p><p>For each request complete request there’s a single traceId and for each thread as the each service process the request, it has a different spanId, and that’s how they relate each other in simple terms.<br>So, these two together called the <strong>trace context </strong>and the propagation of it is called the <strong>trace context propagation.</strong></p><p>So each request from one service to another service sends headers that contains this traceId + spanId. When another service receives the request with that header it extracts the traceId, creates a span, and then continues the same traceId.</p><p>That header is also called the <strong>traceparent header</strong>. So the services are only connected via the trace context nothing else.</p><h3>3. W3C Format and Telemetry data.</h3><p>So, when your services are written in different languages like suppose there’s a java service talking to the nodejs service, so there should be some standards right to send the headers, that’s where W3C format comes into picture.</p><p>So, W3C format defines standard HTTP headers such as:</p><p><strong>a. traceparent<br></strong>This carries the core trace info in the format:</p><pre>00-&lt;trace-id&gt;-&lt;span-id&gt;-&lt;trace-flags&gt;</pre><p><strong>b. tracestate<br></strong>Optional vendor specific metadata, but still in a structured format.</p><h3>4. What is OpenTelemetry and Micrometer?</h3><p>So, specifically in the spring boot 3, there’s Observation API that is introduced for tracing, metrices and logs.</p><p>So, what if we connect that Observation API directly to the vendors like Zipkin, Datadog, New Relic etc, each one of them had its format, and everything was vendor-specific, and we got vendor locked.</p><p>That’s where Open Telemetry comes into play and unified all of that.</p><p>So, <strong>OpenTelemetry(OTel) </strong>is a vendor-netural, open standard for collecting traces, metrics and logs. And then through that we send it to any of the vendors we want on a high level, flexible right. From this we had vendor independence.</p><p>Now, let’s understand what is Micrometer.</p><p>To make it more de-structured, we have the abstraction layer as well which is the Micrometer.</p><p>So, <strong>Micrometer</strong> is the abstraction layer, the actual propagation mechanism depends on the tracer implementation underneath like of OpenTelemetry.</p><p>If you still don’t get this, take this analogy:</p><p>We know right, Spring Data doesn’t talk directly to PostgreSQL driver, it uses JDBC as the abstraction so, Spring Data -&gt; JDBC -&gt; PostgreSQL Driver.</p><p>Same, <strong>Micrometer is the JDBC of the observability, and OpenTelemetry is the database driver.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*zn92AJny-6plwJaLlGJFzQ.png" /></figure><h3><strong>5. </strong>What do you mean by Observability Backend here?</h3><p>In observability context, this backend means the system that stores and visualises telemetry data.</p><p>Telemetry data is basically a structured observability signals, that contains:<br>- Trace ID<br>- Span ID<br>- Parent Span ID<br>- Start time<br>- End time<br>- Duration<br>- Status (error or success)<br>- Attributes (HTTP URL, DB Query, User ID, region etc)<br>- Events (exceptions, logs)</p><p>Example:</p><pre>{<br>  &quot;traceId&quot;: &quot;abc123&quot;,<br>  &quot;spanId&quot;: &quot;xyz789&quot;,<br>  &quot;parentSpanId&quot;: &quot;root456&quot;,<br>  &quot;name&quot;: &quot;inventory-call&quot;,<br>  &quot;startTime&quot;: 170000000,<br>  &quot;endTime&quot;: 170000010,<br>  &quot;status&quot;: &quot;OK&quot;,<br>  &quot;attributes&quot;: {<br>    &quot;http.method&quot;: &quot;GET&quot;,<br>    &quot;http.url&quot;: &quot;/inventory/123&quot;<br>  }<br>}</pre><p>Datadog, New Relic, Jaeger, Tempo etc. are examples of observability backends.</p><p>Its reponsibililties:</p><ul><li>Stores spans</li><li>Index trace Ids</li><li>Provide search</li><li>Show waterfall UI</li><li>Alert on errors.</li></ul><p>Its not you business backend, its a observability backend.</p><h3>6. Deep dive into OpenTelemetry</h3><p>Till now we have understood that OpenTelemetry is the tracing engine that creates spanIds, traceIds under the hood.<br>Remember Micrometer Observation API doesn’t create trace IDs or span IDs, its just the abstraction layer.<br><strong>Micrometer Tracing</strong> (Bridge Layer) converts Observation into a tracing call and delegates to a real tracing implementation(OpenTelemetry in this case).</p><p>So, first let me show you the step by step flow, then will understand few more terms in depth,</p><ol><li>Client Request</li><li>Spring Boot Controller</li><li>Micrometer Observation (start)</li><li>Micrometer Tracing Bridge</li><li>OpenTelemetry SDK</li><li>TraceId &amp; SpanId created</li><li>Business Logic Executes</li><li>Span Ends</li><li>OTLP Exporter (gRPC/HTTP)</li><li>OpenTelemetry Collector</li><li>Processors (batch/filter/enrich)</li><li>Exporter</li><li>Observability Backend</li><li>UI (Trace Visualisation)</li></ol><p>Few new terms here:</p><p><strong>OTLP Exporter: </strong>It stands for OpenTelemetry Protocol, its a standard protocol for sending telemetry data (traces metrics, logs) from applications to a collector or backend directly.<br>Think of it like a standardized shipping box for telemetry data.<br>So its a standard way to ship spans to collector, don’t confuse it with the W3C trace context, that’s the standard way to pass trace IDs between services.</p><p><strong>OpenTelemetry Collector</strong>: Collector is a separate service that acts as a telemetry router/processor.</p><p>Think of it like a reverse proxy, but for observability data. It finally sends the data to the observability backend.</p><p>It performs a lot of operations:</p><ul><li>Receive traces</li><li>Batch them</li><li>Retry on failure</li><li>Filter sensitive attribute</li><li>Sample</li><li>Transform data</li><li>Export to multiple observability backend systems</li></ul><p>So, based on what backend is like Datadog, New Relic etc.. it serves the data in their format to them.</p><p>Collector gets the data via OTLP exporter.</p><p>And then when finally backend receives the data, it stitches it on basis of traceId, parentSpanId to build a tree, sorts by timestamp and finally render waterfall UI.</p><p>Link for your reference: <a href="https://opentelemetry.io/">https://opentelemetry.io/</a></p><h3>End of the Blog</h3><p>If you find this blog helpful, please give it a clap and share!</p><p>You can connect me on <a href="https://www.linkedin.com/in/aditya-maheshwari-50bb37229/">LinkedIn</a>.</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94a20e3323e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entity Relationships in Spring Boot — All you need to know]]></title>
            <link>https://medium.com/@adityamah2002/entity-relationships-in-spring-boot-all-you-need-to-know-dcb1155ed1f1?source=rss-1fe63713236d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcb1155ed1f1</guid>
            <category><![CDATA[entity-relationship]]></category>
            <category><![CDATA[entity]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Mon, 10 Nov 2025 14:20:59 GMT</pubDate>
            <atom:updated>2025-11-10T14:20:59.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>Entity Relationships in Spring Boot — All you need to know</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Smwqc4vCO1zMtA04L35oA.png" /></figure><p>Struggling with Entity Relationships? I gotchu!</p><p>Will specifically dealing with relationships not even little here and there.<br>So just a small prerequisite of knowing little Spring Boot.</p><p>Keeping blog short and crisp, let’s dive in!</p><h3>Content of this blog</h3><ol><li>Type of Relationships<br>a. What each relationship means<br>b. When to use it<br>c. How to map it with code<br>d. Terminologies</li><li>Terminologies</li><li>Common Issues &amp; Fixes<br>a. Circular JSON Issue<br>b. N+1 Query Problem</li><li>End of the blog</li></ol><h3>1. Types of Relationships</h3><h4>— One-to-One</h4><p>It simply means one record in table A is linked to exactly one record in table B.<br>Neither side has multiple entries — it’s always <strong>one-to-one</strong>.</p><p>Pretty simple right!</p><p>Some of the real-life examples are:</p><ul><li>One <strong>Customer</strong> → one <strong>Address</strong> (billing/shipping)</li><li>One <strong>User</strong> → one <strong>Profile</strong></li><li>One <strong>Employee</strong> → one <strong>ID Card</strong></li><li>One <strong>Order</strong> → one <strong>Payment</strong></li></ul><h4>Code Implementation</h4><pre>// Customer Entity<br>@Entity<br>public class Customer {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br><br>    private String name;<br><br>    @OneToOne(mappedBy = &quot;customer&quot;, cascade = CascadeType.ALL)<br>    private Address address;<br>}<br><br>// Address Entity<br>@Entity<br>public class Address {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br><br>    private String city;<br><br>    @OneToOne<br>    @JoinColumn(name = &quot;customer_id&quot;)<br>    private Customer customer;<br>}</pre><p>Don’t worry we cover mappedBy and cascade further in this blog.</p><h4>— One-to-Many and Many-to-One</h4><p>Basic concept is when one entity have many of other entity.</p><p>Example: One <strong>Customer</strong> → many <strong>Orders</strong>, but each <strong>Order</strong> belongs to one <strong>Customer</strong>.</p><p>Some of the real-life examples are:</p><ul><li><strong>Customer</strong> ↔ <strong>Orders</strong></li><li><strong>Category</strong> ↔ <strong>Products</strong></li><li><strong>Department</strong> ↔ <strong>Employees</strong></li></ul><h4>Code Implementation</h4><pre>@Entity<br>public class Customer {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br>    private String name;<br><br>    @OneToMany(mappedBy = &quot;customer&quot;, cascade = CascadeType.ALL)<br>    private List&lt;Order&gt; orders = new ArrayList&lt;&gt;();<br>}<br><br>@Entity<br>@Table(name = &quot;orders&quot;)<br>public class Order {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br>    private LocalDate orderDate;<br><br>    @ManyToOne<br>    @JoinColumn(name = &quot;customer_id&quot;)<br>    private Customer customer;<br>}</pre><p>Point To be Noted: They are generally used together(bi-directional) ie. if you are adding on one side and then you have to add other on the another side.</p><h4>— Many-to-Many</h4><p>Both sides can have many of each other.<br>Example: One <strong>Order</strong> can contain many <strong>Products</strong>, and one <strong>Product</strong> can appear in many <strong>Orders</strong>.</p><p>Some of the real-life examples are:</p><ul><li><strong>Order</strong> ↔ <strong>Product</strong></li><li><strong>Student</strong> ↔ <strong>Course</strong></li><li><strong>Author</strong> ↔ <strong>Book</strong></li></ul><h4>Code Implementation:</h4><pre>@Entity<br>@Table(name = &quot;orders&quot;)<br>public class Order {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br><br>    @ManyToMany<br>    @JoinTable(<br>        name = &quot;order_products&quot;,<br>        joinColumns = @JoinColumn(name = &quot;order_id&quot;),<br>        inverseJoinColumns = @JoinColumn(name = &quot;product_id&quot;)<br>    )<br>    private List&lt;Product&gt; products = new ArrayList&lt;&gt;();<br>}<br><br>@Entity<br>public class Product {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br>    private String name;<br><br>    @ManyToMany(mappedBy = &quot;products&quot;)<br>    private List&lt;Order&gt; orders = new ArrayList&lt;&gt;();<br>}</pre><p>Point To be Noted:</p><ol><li>In this as you can see, <strong>creating a whole new table</strong> named “order_products”, as you can’t manage ManyToMany relationship as we have done in OneToMany or ManyToOne(just adding one FK column)</li><li>So, its adding two columns that are order_id and product_id in the order_products table.</li><li>In a @ManyToMany relationship, the entity that is considered most relevant or holds the primary reference is treated as the <strong>owning side (parent)</strong>. In the example above, the Order entity acts as the parent in the relationship.</li></ol><h3>2. Terminologies</h3><p>Will go through all the important and most used annotations have go through in the examples above</p><h4>1. Owning Side vs Inverse Side</h4><p>When two entities are related, <strong>only one side actually “owns” the foreign key</strong> in the database.</p><ul><li>The <strong>owning side</strong> uses <strong>JoinColumn</strong></li><li>The <strong>inverse side</strong> uses <strong>mappedBy</strong></li></ul><p>Just remember the owning side, other side is inverse side automatically.</p><pre>// Owning side (foreign key in this table)<br>@ManyToOne<br>@JoinColumn(name = &quot;customer_id&quot;)<br>private Customer customer;<br><br>// Inverse side<br>@OneToMany(mappedBy = &quot;customer&quot;)<br>private List&lt;Order&gt; orders;</pre><p>As we can also see in the relationship examples.</p><h4>2. Cascade Types</h4><p>Cascade type tells Hibernate what to do to <em>child entities</em> when something happens to the <em>parent</em>.</p><p>PERSISTSave child when parent is saved</p><p>MERGEUpdate child when parent is updated</p><p>REMOVEDelete child when parent is deleted</p><p>ALLApplies all of the above</p><p>DETACHDetach child when parent is detached</p><p>REFRESHRefresh child when parent is refreshed</p><pre>@OneToMany(mappedBy = &quot;customer&quot;, cascade = CascadeType.ALL)<br>private List&lt;Order&gt; orders;</pre><p>So if you save a <em>Customer</em>, all their <em>Orders</em> will be saved automatically.</p><h4>3. Fetch Types (Lazy vs Eager)</h4><p>Controls <em>when</em> related entities are fetched from the database.</p><p>EAGERLoads related data immediately</p><p>LAZYLoads related data only when accessed</p><p>Basically <strong>Eager</strong> loads all its child at once even if we don’t need the child just we have queried the parent, but in <strong>Lazy </strong>it only loads what is required, no extra things.</p><h4>4. Join Tables and Join Columns</h4><p>@JoinColumnAdds a foreign key column to a table</p><p>@JoinTableCreates a separate table to link two entities (for many-to-many)</p><pre>@ManyToMany<br>@JoinTable(<br>  name = &quot;order_products&quot;,<br>  joinColumns = @JoinColumn(name = &quot;order_id&quot;),<br>  inverseJoinColumns = @JoinColumn(name = &quot;product_id&quot;)<br>)<br>private List&lt;Product&gt; products;</pre><h4>5. Orphan Removal</h4><p>Automatically removes “orphaned” child records when removed from parent’s list.</p><pre>@OneToMany(mappedBy = &quot;customer&quot;, cascade = CascadeType.ALL, orphanRemoval = true)<br>private List&lt;Order&gt; orders;</pre><p>If you remove an <em>Order </em>from the <em>orders</em> list, Hibernate deletes it from the DB.</p><h3>3. Common Issues and Fixes</h3><h4>Circular JSON Issue</h4><pre>class Customer {<br>    @OneToMany(mappedBy = &quot;customer&quot;)<br>    private List&lt;Order&gt; orders;<br>}<br><br>class Order {<br>    @ManyToOne<br>    @JoinColumn(name = &quot;customer_id&quot;)<br>    private Customer customer;<br>}</pre><p>This is what the relationship that we have, so when you start querying for the customer, it starts fetching the customer and then for each <em>order</em> in the <em>orders, </em>it again comes to the customer, and it just goes on….this is where we have <strong>infinite recursion</strong> problem and hence S<strong>tackOverflowError</strong>.</p><p>So, basically there are <strong>three</strong> fixes to this problem:</p><p><strong>Option 1</strong> — @JsonManagedReference and @JsonBackReference</p><pre>class Customer {<br>    @OneToMany(mappedBy = &quot;customer&quot;)<br>    @JsonManagedReference(value = &quot;customer-order&quot;)   // parent side<br>    private List&lt;Order&gt; orders;<br>}<br><br>class Order {<br>    @ManyToOne<br>    @JsonBackReference(value = &quot;customer-order&quot;)      // child side<br>    private Customer customer;<br>}</pre><p>Now JSON will include <em>orders</em> under <em>customer</em>, but won’t include the <em>customer</em> inside each <em>order</em> again.<br>And the “value” attribute inside the annotation helps to pair the relationships as there can be many relationships inside the entity, for a particular relationship, the value should be same on both the sides.</p><p><strong>Option 2 </strong>— @JsonIgnore</p><p>If you want to ignore one side completely,</p><pre>class Order {<br>    @ManyToOne<br>    @JsonIgnore<br>    private Customer customer;<br>}</pre><p><strong>Option 3</strong> — <strong><em>Use DTOs</em></strong> (<strong>This is the best way and industry practise</strong>)</p><p>Instead of exposing all the entities, we can make DTOs which is basically a class that includes all the fields we want as the response that user can see. We see them later in detail in the upcoming blogs.</p><p>First two options are just temporary fixes.</p><h4>N+1 Query Problem</h4><p>The simple meaning of N+1 is “1” stands for the parent that you want to load and “N” stands for the child for that parent that it loads one by one, which is heavy on the database, this happens when you apply</p><p><em>fetch = FetchType.LAZY</em></p><p>on the parent, and hence it causes performance issues in the application. For Example,</p><pre>@Entity<br>public class Customer {<br>  @Id Long id;<br>  @OneToMany(mappedBy=&quot;customer&quot;, fetch = FetchType.LAZY)<br>  private List&lt;Order&gt; orders;<br>}<br><br>@Entity<br>public class Order {<br>  @Id Long id;<br>  @ManyToOne<br>  @JoinColumn(name=&quot;customer_id&quot;)<br>  private Customer customer;<br>}</pre><p>and the service code,</p><pre>// Bad service code<br><br>List&lt;Customer&gt; customers = customerRepository.findAll();  // 1 SQL<br>for (Customer c : customers) {<br>    System.out.println(c.getOrders().size());            // triggers N SQLs (lazy load)<br>}<br>// total queries = 1 + N</pre><p>and SQL produced behind the scenes is,</p><pre>SELECT * FROM customer;                      -- 1<br>SELECT * FROM orders WHERE customer_id = 1;  -- for customer 1<br>SELECT * FROM orders WHERE customer_id = 2;  -- for customer 2<br>...</pre><h4><strong>FIXES:</strong></h4><ol><li><strong>Using JOIN FETCH (most common)</strong></li></ol><p>This loads the parent and children in one query.</p><pre>@Query(&quot;SELECT DISTINCT c FROM Customer c JOIN FETCH c.orders&quot;)<br>List&lt;Customer&gt; findAllWithOrders();</pre><p>the query written inside the Query annotation is the JPQL, which is basically SQL for <strong>Java entities, </strong>not for <strong>Database tables</strong>. Its database independent, and what happens under the hood is Spring Data JPA translates JPQL into SQL only, hibernate then executes that SQL in your database, and results automatically mapped back to your entity objects.</p><p><strong>2. EntityGraph</strong></p><p>Define which associations to fetch for a specific repository query.</p><p><strong>And actually there are many methods, and hybrid methods as well, every method has its pros and cons, it all depends on the use case.</strong></p><p>But the most commonly used one is using <strong>DTOs.</strong></p><p>We see <strong>DTOs</strong> in great detail in the upcoming blogs.</p><h4>End of the blog</h4><p>And that wraps up this guide!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*thvtKhh-k6XSrf4wDhy7Sg.png" /></figure><p>If you enjoyed this blog, give it a clap 👏 and share your thoughts in the comments!</p><p>And check out my other blogs too, may help!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcb1155ed1f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker- Getting started]]></title>
            <link>https://medium.com/@adityamah2002/docker-getting-started-3f6d71af8004?source=rss-1fe63713236d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f6d71af8004</guid>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-volume]]></category>
            <category><![CDATA[docker-container]]></category>
            <category><![CDATA[docker-image]]></category>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Wed, 07 May 2025 06:09:52 GMT</pubDate>
            <atom:updated>2025-05-07T06:19:12.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*50ADjVEh8EmHEcUq_LQnzw.png" /></figure><p>Learning docker can be overwhelming when you are starting, let me ease a bit for you.</p><p>I recommend installing <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> on your system — it’s a convenient and hassle-free way to get started with learning Docker.</p><h3>Content of this blog</h3><ol><li>Brief about Docker.</li><li>Some important docker commands.</li><li>Writing Dockerfile and creating docker images.</li><li>Docker Containers</li><li>Docker Caching</li><li>Docker Volumes</li></ol><h3>Brief about Docker</h3><p>Docker is a tool that helps me bundle my application along with all its dependencies into a single container — basically a lightweight, standalone unit that can run anywhere.</p><p>So, basically its a containerisation platform, there are others as well, but Docker is the most popular one.</p><p>It solves the classic problem of “It works on my machine”.</p><p><strong>Docker Image</strong>: A Docker image is basically a snapshot of everything my app needs — it includes the code, runtime, libraries, and environment setup. It’s a read-only template that serves as the blueprint for running the application.</p><p><strong>Docker Container</strong>: It is what you get when that image is actually running. It’s isolated from the host machine but still uses system resources efficiently. I can start, stop, or scale containers whenever needed.</p><h3>Some brief points</h3><ul><li>You can build an image, and run as many containers as you want.</li><li>There’s no relation of the port on which you app is running app locally to what you have mentioned in the Dockerfile unless you do port mapping.</li></ul><p>Don’t worry if you don’t understand these points right now, it will get clear as we move forward in the blog.</p><h3>Some important Docker Commands</h3><ol><li>Shows all the containers including the stopped ones. “ps” is the process status(knowing full forms helps remembering things)</li></ol><pre>docker ps -a</pre><p>2. Lets you stop the container but still its there.</p><pre>docker stop &lt;ContainerID&gt;</pre><p>3. To remove the container</p><pre>docker stop &lt;ContainerID&gt;</pre><p>4. Remove all stopped containers</p><pre>docker container prune</pre><p>5. Remove unused images</p><pre>docker image prune</pre><p>6. Remove <strong>everything unused</strong> (containers, images, volumes, networks)</p><pre>docker system prune</pre><p>7. Remove unused volumes</p><pre>docker volume prune</pre><p>There are other important commands as well, will see that later in the blog.</p><h3>Images and spinning up the containers</h3><p>So basically there are two ways in which you build an image and spin up the container, it depends on the need of the project.</p><ol><li>Keeping it all locally.</li><li>Pushing the image on the Docker Hub and then running up from there.</li></ol><p>As writing a docker file is common to both, first we will write a docker file.</p><h3>Writing Dockerfile</h3><p>I am using nodejs app in this blog, you can use any of your own and can write on that.</p><p><em>Project Link: </em><a href="https://github.com/adityasgit25/nodejs-docker-demo"><em>https://github.com/adityasgit25/nodejs-docker-demo</em></a></p><p>Keep this thing in your mind that we have to run that app in the container, so step by step what all things we will do.</p><pre># Use an official Node.js runtime as the base image<br>FROM node:18<br><br># Setting the working directory inside the container<br>WORKDIR /app<br><br># Copying package.json and package-lock.json<br>COPY package*.json ./<br><br># Install dependencies<br>RUN npm install<br><br># Copy the rest of the application code to the container&#39;s working directory ie. /app<br>COPY . . <br><br># Build the TypeScript code, as we are using typescript we have to build it first to get index.js<br>RUN npm run build<br><br># Expose the application port, this is exposing port inside the container.<br>EXPOSE 4000<br><br># Define the command to run the application<br>CMD [&quot;node&quot;, &quot;dist/index.js&quot;]</pre><p>This is the docker file for the above app.</p><p>One thing that I have to clear is, the port you write in EXPOSE, exposes the port inside the container on which the app will be running, port 4000 in this case.</p><h4>First Approach: Keeping it all local</h4><p><strong>1. Building the docker image.</strong></p><pre>docker build -t nodejs-docker-demo .</pre><p>“.” — its basically searching the current directory in which you Dockerfile is to build the image.</p><p>“nodejs-docker-demo” — its the name of the image, can specify version as well! (Specifying version or tag for the image is a good practise)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jcgi3k_IkIurT-dzMcd_SQ.png" /><figcaption>Terminal</figcaption></figure><p>Now you can see in your docker console, in the images section, a new image has been created like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHkFvKTinBO-JRGUXgVoow.png" /></figure><p><strong>2. Running the image</strong></p><p>So as we successfully built the image, now will run that.</p><pre> docker run -p 8050:4000 nodejs-docker-demo    </pre><p>So the app is running at port 4000 in the container and we can access the same on port 8050 on our localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XyP4m4fHBjDsEO_P1XtDGw.png" /><figcaption>Browser</figcaption></figure><p>We can also see in that our container is created on the Docker Desktop inside the container section, or using command line.</p><p><strong>When this approach to be used?</strong></p><ul><li>Local development/testing</li><li>Uses private/internal storage</li><li>Avoids public exposure</li><li>Quick experiments</li><li>Temporary, no need to persist</li></ul><p>And of course there are other several important use cases as well.</p><h4>Second Approach: Docker hub</h4><p>First go to <a href="https://hub.docker.com/">https://hub.docker.com/</a> and create an account.</p><p><strong>1. Building the docker image</strong></p><p>The syntax is</p><pre>docker build -t username/image-name:tag .</pre><pre>docker build -t aditya2525/nodejs-docker-demo:latest .</pre><p>This is the command in my case.</p><p>Its good to specify tag, if you don’t specify it will be latest automatically.</p><p>After running the above code,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pL1LK-RoqpRD9BysSXZPoQ.png" /><figcaption>Terminal</figcaption></figure><p><strong>2. Pushing image to docker hub</strong></p><p>So for pushing image to docker hub, you need to first login to the docker with your credentials by running the following command.</p><p>You will have “Login Succeeded” after successful login.</p><pre>docker login</pre><p>and then, push</p><pre> docker push aditya2525/nodejs-docker-demo:latest  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZO-dER0C3eIlqsyqNncHfw.png" /><figcaption>Terminal</figcaption></figure><p>You can view the pushed image on the docker hub</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9Di0ObwBTgSUlE6J-fhCA.png" /><figcaption>Docker Desktop</figcaption></figure><p><strong>3. Pulling the image</strong></p><p>Now to run the image, you have to pull the image first.</p><pre>docker pull aditya2525/nodejs-docker-demo:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzPv5himJKHKuEr1uBdMUQ.png" /><figcaption>Terminal</figcaption></figure><p>You can see the same on the Docker Desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F_NgzSHj9x_ebeK3k0pThg.png" /><figcaption>Docker Desktop</figcaption></figure><p><strong>4. Running the image(basically spinning up the container)</strong></p><p>Now, How do you know on which port is the app running inside the container so you can do port mapping?</p><p>Most of times, its given in the documentation itself on which port it is running. Like in case of mongoDB it runs on port 27017 inside the container.</p><p>But if it is not specified, so there are various approaches for that, one of them is using command like in this case,</p><pre>docker image inspect nodejs-docker-demo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t1zwv13bnP8Qh0wlzqsH0w.png" /><figcaption>Terminal</figcaption></figure><p>So, as you can see the highlighted part, and from ExposedPorts we can get the port.</p><p>For running the image,</p><pre>docker run -p 6060:4000 nodejs-docker-demo </pre><p>So, we can access the app at port 6060 this time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmFUvHl6cOrOvdy2LBKMPw.png" /><figcaption><strong>Browser</strong></figcaption></figure><p><strong>When this approach to be used?</strong></p><p>This approach is used when you want your code to be shareable across different platforms and environments.</p><p>And of course there are other several important use cases as well.</p><h3>Docker Caching</h3><p>Docker builds each instruction in a Dockerfile as a separate layer. If nothing changes in a layer, Docker can reuse it from cache during subsequent builds.</p><p><strong>Tip</strong>: <em>Put </em><em>COPY package.json and </em><em>RUN npm install </em><strong><em>before</em></strong><em> </em><em>COPY . .</em></p><p>As<em> </em><em>RUN npm install </em>depends on package.json file, and if it doesn’t change(not adding any new dependencies) it can be cached, so two layers can be cached.</p><p>On the other hand if keep <em>COPY . . </em>before the two, then if any code changes are there, the other two have to re-build again, making builds much slower.</p><h3>Data Persistence</h3><p>So, whenever we spin up the container and then when we stop it or remove, data is no longer there, so its non-persistent state. But in most of our cases we want our data to be persistent. So we have two methods of doing that via</p><ol><li><strong>Bind Mounting</strong></li><li><strong>Docker Volumes</strong></li></ol><h4>Bind Mounting</h4><p>In this, basically you link a specific directory of your system(host) to a path inside a container. Any changes in the path either from the system or container will reflect the other.</p><p>So, will go through the steps how to do that.</p><p>In my case it is like,</p><pre> docker run -it -v /Users/adityamaheshwari/Documents/Projects/nodejs-docker-demo:/app -p 9010:4000 aditya2525/nodejs-docker-demo:latest /bin/bash</pre><p>Will understand each and every part in the command, so that you can<strong> write of your own</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBQfw9gn-vD2UYKMQC2JIg.png" /><figcaption><strong>Explanation of the command</strong></figcaption></figure><ul><li>-v stands for volume in short.</li><li>-it is for interactive, so that we can interact with the container.</li><li>Many times there’s no need to specify the ports as just we want to do bind mount so in that case there’s no need of port mapping, you can skip that part.</li><li>Remember that the container runs linux inside it, so don’t specify any system folder unless you know what you are doing.</li><li>If you want to directly spin up the container and app together then you can remove /bin/bash and -it.</li></ul><p>Now you will be inside the container. And now you can run the app doing, in my case, as I am using typescript so,</p><pre>node dist/index.js</pre><p>and this will run your app on the specified port you have mentioned.</p><p>Now in the following screenshots you can see,</p><ul><li>how I am bind mounting</li><li>creating a file inside the container app folder “test.txt”, writing some text</li><li>closing the container</li><li>And then checking the same if it persist on my local system in which I have mounted after closing the container.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZ5iM4-mu6rlI3ExiOjIaA.png" /><figcaption><strong>Spinning up the container and making a file “test.txt”</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7MnWoYaFe-5ZZ_mHwyUbA.png" /><figcaption><strong>Writing some text in the file</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g7xsGOL3gwFFUToGmO4HcA.png" /><figcaption><strong>Exiting the container</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ESS5OmtuBp0GaoEEDH-zwA.png" /><figcaption><strong>Going to the folder I have specified as the host path</strong></figcaption></figure><p>And here you can see we have “test.txt” file created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFDcDIVJ9zAhuTYhcuOzDw.png" /><figcaption><strong>Verified!</strong></figcaption></figure><p>So here as we can see its the same text that we have added from inside the container.</p><h4>Docker Volumes</h4><p>Now will see the approach of how to persist the data using docker volumes.</p><p>Volumes are permanent storage.</p><p>In this section,</p><ul><li>Will see how to create a docker volume and attach to a container.</li><li>Will add some data in the docker volume.</li><li>And then will create some another container, mount that volume to it and see if the data persist or not.</li></ul><p>Let’s do that!</p><ol><li>Creating a docker volume,</li></ol><pre>docker volume create data</pre><p>Volume named “data” has been created and they are called <strong>Named Volumes</strong>, and these are entirely managed by docker.</p><p>2. Mounting the volume to the container,</p><pre>docker run -it -v data:/aditya nodejs-docker-demo:latest bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfRYgDE3fwzF_k0GO_AhEQ.png" /></figure><p>3. Creating some folders inside the container’s /aditya directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8771ytIiwpi0wUTNioHQQ.png" /><figcaption>creating my_nodejs_app folder inside /aditya</figcaption></figure><p>4. Now running up another container and attaching the same volume to it, will run ubuntu.</p><pre> docker run -it -v data:/adityasapp ubuntu</pre><p>creating /adityasapp inside ubuntu, as there’s no image of ubuntu locally, so it will pull from Docker Hub and run the container.</p><p>5. Now checking the if the same folder “my_nodejs_app” is present inside the container running ubuntu,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3VCvlD_Qbu9QCKP339f4Q.png" /><figcaption><strong>And yes, we have it!</strong></figcaption></figure><p>Let’s take make another folder named “nextapp” and check,</p><p>Creating “nextapp” folder inside the node-app container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6DsF4e4XD-ZPCnGhYAdmQ.png" /><figcaption><strong>Creating folder inside container running nodejs app</strong></figcaption></figure><p>So, now the same folder should be present inside the container running ubuntu as they are attached to the same volume,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvnWPl_Zb5zokb18lus-dQ.png" /><figcaption><strong>And yes it is!</strong></figcaption></figure><p>So we have attached the same volume to the two different containers, one is running my node app and other ubuntu.</p><h3>End of blog</h3><p>If you found it helpful, feel free to give a clap and comment!</p><p>You can connect with me on:</p><ul><li><a href="https://www.linkedin.com/in/aditya-maheshwari-50bb37229/">LinkedIn</a></li></ul><p><em>Thanks for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f6d71af8004" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>