<?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 Sanchit Rk on Medium]]></title>
        <description><![CDATA[Stories by Sanchit Rk on Medium]]></description>
        <link>https://medium.com/@sanchitrk?source=rss-168d94f65b17------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KaKI_Lg29McUOyRljSliGA.jpeg</url>
            <title>Stories by Sanchit Rk on Medium</title>
            <link>https://medium.com/@sanchitrk?source=rss-168d94f65b17------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:55:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanchitrk/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[Building SaaS with DDD & Clean Architecture in Python — Issue 1]]></title>
            <link>https://medium.com/@sanchitrk/building-saas-with-ddd-clean-architecture-in-python-issue-1-15cb49f5dff8?source=rss-168d94f65b17------2</link>
            <guid isPermaLink="false">https://medium.com/p/15cb49f5dff8</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sanchit Rk]]></dc:creator>
            <pubDate>Thu, 31 Aug 2023 17:11:23 GMT</pubDate>
            <atom:updated>2023-08-31T17:11:23.526Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building SaaS with DDD &amp; Clean Architecture in Python — Issue 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWjClklfbYPWfgh1RWwQyg.jpeg" /></figure><p>It&#39;s been a few weeks, and I decided to work on a SaaS application — I had a bunch of ideas for some time now and was looking to focus on a problem space worth solving.</p><p>I chose Python as the programming language, as I felt a bit rusty — I have been a Node.js developer for a while and wanted to brush up on my Python skills.</p><blockquote>Now, I don’t recommend this approach. I suggest focusing on the problem and solution and most importantly talking to customers.</blockquote><p>When building real apps, you can select a programming language that you are most familiar with. Focusing on your knowledge and expertise is more important than getting caught up in the complexities of learning or refreshing a new programming language.</p><p>My goal was also to brush up on my Python skills and learn DDD and Clean Architecture practices. Hence, I chose Python.</p><h3>The Problem Space</h3><blockquote>Companies are using Slack for all internal communications, and with shared channels, outside members can also be part of the conversations. Being used to support customer queries, talk to customers, and collaborate with team members, and much more.</blockquote><blockquote>Managing conversations with customers and internal teams can be challenging, as it’s easy to get overwhelmed. To address this issue, I decided to build a SaaS application that seamlessly integrates with Slack and offers effective conversational support for teams and companies. This solution aims to streamline communication processes and enhance efficiency in providing support.</blockquote><p>In DDD, the first step is to understand the problem space. Now that we have some understanding of the problem that we are solving, we can focus on the solution space — the implementation details.</p><h3>Uncovering Entities &amp; Properties</h3><p>Entity is a domain object when we care about its individuality when distinguishing it from all the other objects in a system. It&#39;s a unique thing capable of being changed in its lifetime; changes can be so extensive that the object might seem different, yet it is the same object by identity.</p><p><strong>Tenant</strong></p><p>As we are building a SaaS, we want to represent our customers. It&#39;s typical to call them Tenants. Tenants can have users, customers, billing information, etc. We only have a little information on the Tenant; let&#39;s move on. We can add intrinsic details later.</p><pre>class Tenant(AbstractEntity):<br>    def __init__(self, tenant_id: str | None) -&gt; None:<br>        self.tenant_id = tenant_id<br><br>    def __eq__(self, other: object) -&gt; bool:<br>        if not isinstance(other, Tenant):<br>            return False<br>        return self.tenant_id == other.tenant_id<br><br>    def __repr__(self) -&gt; str:<br>        return f&quot;&quot;&quot;Tenant(<br>            tenant_id={self.tenant_id}<br>        )&quot;&quot;&quot;</pre><p>We will add more details as we build along; now, the entity looks fine for a start.</p><p><strong>User</strong></p><p>Tenants will have Users, and I can think of Users to have some role. We only have a little information on how Users will register or get created, but I know how to represent them as an entity. With these details, let&#39;s define the User entity.</p><pre>class UserRole(Enum):<br>    OWNER = &quot;owner&quot;<br>    ADMINISTRATOR = &quot;administrator&quot;<br>    MEMBER = &quot;member&quot;<br><br>class User(AbstractEntity):<br>    def __init__(<br>        self,<br>        tenant_id: str,<br>        user_id: str | None,<br>        name: str | None,<br>        role: UserRole.MEMBER,<br>    ) -&gt; None:<br>        self.tenant_id = tenant_id<br>        self.user_id = user_id<br>        self.name = name<br>        self.role = role<br><br>    def __eq__(self, other: object) -&gt; bool:<br>        if not isinstance(other, User):<br>            return False<br>        return (self.tenant_id == other.tenant_id) \<br>          and (self.user_id == other.user_id)<br><br>    def __repr__(self) -&gt; str:<br>        return f&quot;&quot;&quot;User(<br>            tenant_id={self.tenant_id},<br>            user_id={self.user_id},<br>            name={self.name},<br>            role={self.role.value}<br>        )&quot;&quot;&quot;</pre><p>We know that the User should be uniquely identifiable in the Tenant; hence, the equality implementation for the entity object checks for tenant_id and user_id properties.</p><p>Understanding __eq__ — in Python is out of the scope of this discussion. I will be writing about it in the future.</p><h4>Validation</h4><p>We can safely add some validation in the entity, for example, the User entity — making sure we have the tenant_id — When creating/initializing the User entity, e.g.</p><pre>...<br>def __init__(<br>        self,<br>        tenant_id: str,<br>        user_id: str | None,<br>        name: str | None,<br>        role: UserRole.MEMBER,<br>    ) -&gt; None:<br>        self.tenant_id = tenant_id<br>        self.user_id = user_id<br>        self.name = name<br>        self.role = role<br>        ...<br><br>        assert tenant_id is not None<br>        assert role is not None</pre><p>In the above code snippet, I&#39;m making sure we don&#39;t set the tenant_id as None/Null — enforcing the domain contract that the User is always part of the Tenant.</p><p>For now, I will skip these validations, but there is no harm in having those checks in the domain entity.</p><p>In the next issue, #2, I will focus on mapping Slack events APIs to entities and value objects. I will also explore value objects in more detail and intrinsic details on entities vs. value objects.</p><p>Till then, follow this series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15cb49f5dff8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Internet, Content & Experience]]></title>
            <link>https://medium.com/@sanchitrk/the-internet-content-experience-48399364acb?source=rss-168d94f65b17------2</link>
            <guid isPermaLink="false">https://medium.com/p/48399364acb</guid>
            <category><![CDATA[creators]]></category>
            <category><![CDATA[humans]]></category>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[opinion]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Sanchit Rk]]></dc:creator>
            <pubDate>Tue, 20 Jul 2021 08:25:50 GMT</pubDate>
            <atom:updated>2023-01-05T07:39:02.004Z</atom:updated>
            <content:encoded><![CDATA[<p>Among multiple definitions of content, Wikipedia defines it as “In publishing, art, and communication, content is the information and experiences that are directed toward an end-user or audience.” In the world of internet consumption, we call this content web content, as per Lou Rosenfeld and Peter Morville, who write, “We define content broadly as ‘the stuff in your Website.’”</p><p>Consumption of this content is what makes the internet “The Internet.” Google, the giant search engine and company that makes content accessible via its search engine, earns billions of dollars in revenue.</p><p>The internet is full of content to be consumed, but not all content can be consumed equally. It’s the experiences of the content that makes it consumable. For example, watching a movie you love on Netflix or perhaps watching your favorite YouTuber showcasing the latest in tech — you’ll gladly spend your time for the experience you gain.</p><p>Therefore, to make content valuable, it’s the experience you give to consumers — your audience and end users — that matters. This is one of the reasons why some content is highly valued, while some just get lost over the internet — after which even the giant doesn’t care.</p><p>The content largely flowing over the internet is created by humans. With the advent of AI and ML, it’s possible we’ll soon be consuming more and more content generated by machines, but it will still be humans who will be the key to the experience. Humans generating the content — the creators — are the backbone of the content we consume over the internet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48399364acb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>