<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Siddharth Gupta</title>
    <description>The latest articles on DEV Community by Siddharth Gupta (@hamster_007).</description>
    <link>https://dev.to/hamster_007</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3328171%2Ffbe889e1-2221-45b1-aab0-5e5db3677a05.png</url>
      <title>DEV Community: Siddharth Gupta</title>
      <link>https://dev.to/hamster_007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamster_007"/>
    <language>en</language>
    <item>
      <title>docker Container vs docker Volumes for database</title>
      <dc:creator>Siddharth Gupta</dc:creator>
      <pubDate>Thu, 17 Jul 2025 10:59:03 +0000</pubDate>
      <link>https://dev.to/hamster_007/docker-container-vs-docker-volumes-for-database-3cj1</link>
      <guid>https://dev.to/hamster_007/docker-container-vs-docker-volumes-for-database-3cj1</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;using docker Container&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The data is stored inside the container's writable layer. to be honest, If the container is deleted, the data is gone.The usage of docker container is rare for persistent data (not recommended for databases). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;using Bind Mount (type: bind) method to host container&lt;/strong&gt;&lt;br&gt;
the Bind Mount method is used to map a specific host directory (e.g., /devdata/postgres) to a path inside the container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dy37n4r63ug59bzc8ii.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dy37n4r63ug59bzc8ii.png" alt=" " width="678" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;using docker Volume&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When we use docker volume to run the instance locally, A Docker-managed storage directory that lives inside /var/lib/docker/volumes/, abstracted from the host.now fun part i, it is being created and managed independently from the host filesystem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdqiietz1dle9v943kmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdqiietz1dle9v943kmh.png" alt=" " width="800" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  what if I delete any container in docker?
&lt;/h2&gt;

&lt;p&gt;A Docker container is a lightweight, standalone, and executable package that includes everything needed to run an application—such as code, runtime, system tools, libraries, and settings. It is essentially a running instance of a Docker image, designed to execute processes in an isolated environment. However, any data created inside a container is stored in its writable layer and will be lost if the container is deleted or restarted without persistent storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  what if I delete a volume in docker?
&lt;/h2&gt;

&lt;p&gt;On the other hand, a Docker volume is a persistent storage mechanism managed by Docker, used specifically to store data outside the container's ephemeral lifecycle. Volumes are ideal for storing data that needs to persist between container restarts, such as databases, uploaded files, logs, or user sessions. Volumes are created and managed independently of containers and can be shared between multiple containers. They are stored in Docker's internal storage path (usually /var/lib/docker/volumes/) and offer better performance, portability, and data safety compared to writing data inside a container or using host bind mounts.&lt;/p&gt;

&lt;p&gt;In local development, you might sometimes use bind mounts to map host directories to containers for easier debugging and direct file access. However, in production environments, &lt;strong&gt;Docker volumes are strongly recommended for handling persistent data, especially for databases like PostgreSQL or Redis&lt;/strong&gt;. Containers focus on running code, while volumes focus on reliably storing data across container lifecycles. When used together properly, they form a powerful and scalable system for deploying modern applications.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Understanding Optional Parameters: TypeScript Interface vs Zod Schema</title>
      <dc:creator>Siddharth Gupta</dc:creator>
      <pubDate>Sun, 06 Jul 2025 12:54:09 +0000</pubDate>
      <link>https://dev.to/hamster_007/understanding-optional-parameters-typescript-interface-vs-zod-schema-283k</link>
      <guid>https://dev.to/hamster_007/understanding-optional-parameters-typescript-interface-vs-zod-schema-283k</guid>
      <description>&lt;p&gt;Ever encountered a situation where your TypeScript interface works fine with optional parameters, but Zod schema throws an error? Let's break down this interesting difference!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
Consider this autocomplete component with optional parameters:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdl07f37dd0qrukswx9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdl07f37dd0qrukswx9a.png" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why This Happens?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-&amp;gt; TypeScript Interface:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follows JavaScript's natural function behavior &lt;/li&gt;
&lt;li&gt;Optional parameters can be completely omitted&lt;/li&gt;
&lt;li&gt;More flexible, compile-time only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&amp;gt; Zod Schema:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enforces runtime validation&lt;/li&gt;
&lt;li&gt;.args() requires all parameters to be provided, even if undefined&lt;/li&gt;
&lt;li&gt;Stricter validation for data safety&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to Use What?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-&amp;gt; Use TypeScript Interface when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want flexible, natural JavaScript function behavior&lt;/li&gt;
&lt;li&gt;You're doing compile-time type checking only&lt;/li&gt;
&lt;li&gt;Working with UI components and callbacks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&amp;gt; Use Zod Schema when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need runtime validation&lt;/li&gt;
&lt;li&gt;Working with API payloads or external data&lt;/li&gt;
&lt;li&gt;Need to enforce strict parameter validation&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
