<?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 Vikas Datir on Medium]]></title>
        <description><![CDATA[Stories by Vikas Datir on Medium]]></description>
        <link>https://medium.com/@vikasd27?source=rss-c10f1f8d809f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5EPN9-as7Sp3rV7LdZQ7MA.jpeg</url>
            <title>Stories by Vikas Datir on Medium</title>
            <link>https://medium.com/@vikasd27?source=rss-c10f1f8d809f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:37:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vikasd27/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[Architecture Patterns: From Knowing Technologies to Designing Systems]]></title>
            <link>https://medium.com/@vikasd27/architecture-patterns-from-knowing-technologies-to-designing-systems-b9e9755c97e4?source=rss-c10f1f8d809f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9e9755c97e4</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <dc:creator><![CDATA[Vikas Datir]]></dc:creator>
            <pubDate>Thu, 17 Sep 2026 16:39:11 GMT</pubDate>
            <atom:updated>2026-09-17T16:39:11.910Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1ro2bTp5fqHwu25HL12-g.png" /></figure><p>Knowing technologies is not the same as knowing how to design a system.</p><p>You may know Kafka, Kubernetes, AWS, Azure, databases, APIs, or LLMs. But architecture begins when you can answer a more important question:</p><blockquote><strong><em>How do I compose these technologies to solve a business problem reliably?</em></strong></blockquote><p>This is where architecture patterns become important.</p><h3>What is an Architecture Pattern?</h3><p>An architecture pattern is a <strong>reusable approach to solving a recurring system-design problem</strong>.</p><p>It describes how different parts of a system should be organized and interact, including:</p><ul><li>Components and responsibilities</li><li>Communication and data flow</li><li>Dependencies and boundaries</li><li>Scalability</li><li>Failure handling</li><li>Security</li><li>Operational behavior</li></ul><p>An architecture pattern is <strong>not a technology</strong>.</p><h4><strong>Example</strong></h4><p><strong>Event-driven architecture</strong> is a pattern. Kafka, Azure Event Hubs, AWS Kinesis, and Google Pub/Sub are technologies that can implement parts of that approach.</p><p>That distinction matters.</p><p>Instead of asking:</p><blockquote><em>“</em>Should we use Kafka?<em>”</em></blockquote><p>An architect first asks:</p><blockquote><em>“</em>Do we need asynchronous, decoupled, independently scalable communication?<em>”</em></blockquote><p>If the answer is yes, <strong>Event-driven architecture</strong> may be worth considering. Only then a specific technologies be evaluated.</p><h3>Architecture Patterns Are Everywhere</h3><p>Architecture patterns exist across different areas of system design.</p><p><strong>Application architecture</strong> includes layered architecture, modular monoliths, hexagonal architecture, clean architecture, and microservices.</p><p><strong>Distributed systems</strong> use patterns such as caching, replication, sharding, circuit breakers, retries, timeouts, bulkheads, rate limiting, and idempotency.</p><p><strong>Integration architecture</strong> includes APIs, messaging, publish/subscribe, event-driven architecture, webhooks, and adapters.</p><p><strong>Data architecture</strong> includes ETL, ELT, lakehouse, data mesh, CQRS, event sourcing, transactional outbox, and Change Data Capture.</p><p>And increasingly, <strong>AI systems</strong> have their own architectural patterns: RAG, AI gateways, model routing, agentic architectures, tool calling, human-in-the-loop, guardrails, evaluation pipelines, and AI observability.<br>You don’t need to memorize all of them.</p><p>You need to understand <strong>when and why to use them</strong>.</p><h3>Architecture Thinking = Problem → Pattern → Trade-offs</h3><p>Consider an order-processing system that needs to handle high traffic, multiple downstream systems, temporary failures, independent scaling, and near-real-time processing.</p><p>One possible architecture might combine:</p><p><strong>API Gateway → Order Service → Transactional Outbox → Event Broker → Payment / Inventory / Notification Services</strong></p><p>Notice something important.</p><p>There isn’t just one pattern.</p><p>The architecture may combine:</p><ul><li>API Gateway</li><li>Microservices</li><li>Transactional Outbox</li><li>Event-driven architecture</li><li>Pub/Sub</li><li>Retry</li><li>Circuit Breaker</li><li>Idempotency</li></ul><p>Real-world architectures are usually <strong>compositions of patterns</strong>, not isolated patterns.</p><h3>Every Pattern Has a Cost</h3><p>One of the biggest mistakes in architecture is treating patterns as universally good.</p><p>Take <strong>microservices</strong>.</p><p>Microservices can provide independent deployment, scaling, domain boundaries, team autonomy, and fault isolation.</p><p>But they also introduce complexity:</p><ul><li>Network communication</li><li>Distributed transactions</li><li>Observability challenges</li><li>Deployment complexity</li><li>Security complexity</li><li>Data consistency problems</li></ul><p>So the question shouldn’t be:</p><blockquote><em>“Are microservices better?”</em></blockquote><p>It should be:</p><blockquote><strong><em>“What problem are microservices solving, and is that benefit worth the additional complexity?”</em></strong></blockquote><p>Sometimes the answer may be a <strong>modular monolith that can evolve toward services later</strong>.</p><p>That’s architecture thinking: understanding the trade-off rather than following a trend.</p><h3>A Good Architect Also Studies Failure</h3><p>Architecture isn’t complete when the happy path works.</p><p>Suppose we build an event-driven system:</p><p><strong>Producer → Broker → Consumer A / Consumer B / Consumer C</strong></p><p>What happens if:</p><ul><li>Consumer B crashes?</li><li>An event is processed twice?</li><li>Events arrive out of order?</li><li>A consumer becomes too slow?</li><li>The broker becomes unavailable?</li><li>A message cannot be processed?</li><li>The event schema changes?</li></ul><p>These questions lead to additional patterns and engineering practices such as retries, dead-letter queues, idempotent consumers, schema evolution, backpressure, replay, monitoring, and alerting.</p><p>This is where <strong>architecture becomes engineering</strong>.</p><h3>Patterns Can Also Be Composed in AI Systems</h3><p>The same thinking applies to Gen AI System Designing.</p><p>An enterprise AI platform might combine:</p><p><strong>API Gateway → AI Gateway → Model Routing → RAG → Agent → Tools / APIs / Enterprise Data</strong></p><p>Around this flow, we may also need authorization, guardrails, human-in-the-loop controls, caching, observability, and evaluation.</p><p>Again, there is no single “AI architecture pattern.”</p><p>The architecture emerges from <strong>combining patterns to address specific business and technical requirements</strong>.</p><h3>How Should You Learn Architecture Patterns?</h3><p>For every pattern, ask the same questions:</p><ol><li><strong>What problem does it solve?</strong></li><li><strong>When does that problem occur?</strong></li><li><strong>What does the structure look like?</strong></li><li><strong>How do components communicate?</strong></li><li><strong>How does data flow?</strong></li><li><strong>What are the benefits?</strong></li><li><strong>What are the costs?</strong></li><li><strong>How can it fail?</strong></li><li><strong>How is it secured?</strong></li><li><strong>How does it scale?</strong></li><li><strong>How does it behave during partial failure?</strong></li><li><strong>How do we observe it?</strong></li><li><strong>What drives its cost?</strong></li><li><strong>What technologies can implement it?</strong></li></ol><p>Notice the last question.</p><p><strong>Technology comes last.</strong></p><p>First understand the architectural problem. Then understand the pattern. Then evaluate trade-offs. Finally select the technology.</p><h3>The Real Goal</h3><p>The goal of learning architecture patterns isn’t:</p><blockquote><strong><em>“I know 100 architecture patterns.”</em></strong></blockquote><p>The real goal is:</p><blockquote><strong><em>“Given a business problem, I can identify the architectural forces, select appropriate patterns, combine them, understand their failure modes, evaluate alternatives, and explain the trade-offs.”</em></strong></blockquote><p>That’s the transition from <strong>technology knowledge to architecture capability</strong>.</p><p>And for anyone moving toward <strong>Data, AI, or Solution Architecture</strong>, architecture patterns provide an important bridge between engineering experience and higher-level system design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9e9755c97e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preserving Salesforce RBAC in AI Applications Using Salesforce External Client App and…]]></title>
            <link>https://medium.com/@vikasd27/preserving-salesforce-rbac-in-ai-applications-using-salesforce-external-client-apps-and-bbe8819770c8?source=rss-c10f1f8d809f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbe8819770c8</guid>
            <category><![CDATA[connected-app-salesforce]]></category>
            <category><![CDATA[authorization-flow]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-rbac]]></category>
            <category><![CDATA[fastapi]]></category>
            <dc:creator><![CDATA[Vikas Datir]]></dc:creator>
            <pubDate>Sat, 20 Jun 2026 09:44:14 GMT</pubDate>
            <atom:updated>2026-06-20T09:49:47.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZxiA7vWnzKRw74JaX8naw.jpeg" /><figcaption>Salesforce RBAC in AI Applications</figcaption></figure><h3><strong>Preserving Salesforce RBAC in AI Applications Using Salesforce External Client App and User-Specific OAuth Token</strong></h3><h4>Introduction</h4><p>Generative AI is transforming how business users interact with enterprise applications. While LLMs make it possible to query enterprise data using natural language, one of the challenge is ensuring that users can only access data they are authorized to view.</p><p>To explore this challenge, I developed a POC that integrates Salesforce with an AI-powered conversational interface. The solution demonstrates how Salesforce External Client App and OAuth 2.0 can be leveraged to implement secure, user-specific access control while enabling natural language querying of Salesforce data.</p><p>This POC combines Salesforce Developer Edition, FastAPI, LangChain, LangGraph, and Streamlit to create an intelligent assistant capable of converting user questions into Salesforce Object Query Language (SOQL) queries and retrieving results based on the authenticated user’s permissions.</p><h4>Objective</h4><p>The primary objective of this POC was to answer the following question:</p><p><strong><em>Can we build an AI application on top of Salesforce while preserving Salesforce’s Role-Based Access Control (RBAC) model?</em></strong></p><p>Traditional AI applications often use a single service account to access enterprise data. While simple to implement, this approach bypasses user-level permissions and introduces significant security concerns.</p><p>This POC demonstrates an alternative approach where:</p><ul><li>Each user authenticates directly with Salesforce.</li><li>Salesforce issues a user-specific access token.</li><li>All Salesforce queries execute using the authenticated user’s token.</li><li>Salesforce continues to enforce its native RBAC, sharing rules, profiles, permission sets, and object-level security.</li></ul><p>As a result, users only see data they are already authorized to access within Salesforce.</p><h4>Solution Overview</h4><p>The solution consists of three primary components:</p><h4>1. Salesforce</h4><p>Salesforce acts as:</p><ul><li>Identity Provider</li><li>Authorization Server</li><li>Data Source</li><li>RBAC Enforcement Engine</li></ul><p>A Salesforce External Client Connected App is configured with OAuth 2.0 authorization flow enabled.</p><p>The Connected App allows users to:</p><ul><li>Authenticate using Salesforce credentials</li><li>Grant access to the AI application</li><li>Receive user-specific access tokens</li></ul><p>These tokens are later used for executing Salesforce REST API and SOQL query operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1HImJLHahJ09XmBknYjcYg.png" /><figcaption>External Connected App</figcaption></figure><h4>2. FastAPI Backend</h4><p>FastAPI serves as the middleware between Salesforce and the AI application.</p><p>The backend exposes four endpoints:</p><h4>/login</h4><p>Initiates Salesforce OAuth authentication.</p><p>Responsibilities:</p><ul><li>Redirect user to Salesforce login page</li><li>Generate OAuth authorization request</li></ul><h4>/callback</h4><p>Handles Salesforce OAuth callback.</p><p>Responsibilities:</p><ul><li>Receive authorization code</li><li>Exchange authorization code for access token</li><li>Retrieve user information</li><li>Store session details</li></ul><h4>/get_session</h4><p>Returns authenticated user session details.</p><p>Responsibilities:</p><ul><li>Validate session</li><li>Return user information</li><li>Verify authentication status</li></ul><h4>/chat</h4><p>Main AI interaction endpoint.</p><p>Responsibilities:</p><ul><li>Accept user question</li><li>Generate SOQL query using LLM</li><li>Execute SOQL against Salesforce</li><li>Return response to user</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVbWhnn3-syw33c8Q6weug.png" /></figure><h4>3. Streamlit User Interface</h4><p>Streamlit provides a lightweight conversational interface.</p><p>Capabilities include:</p><ul><li>Salesforce Login</li><li>Session Management</li><li>Chat Interface</li><li>Response Rendering</li><li>Logout Functionality</li></ul><p>The UI communicates exclusively with FastAPI and never directly with Salesforce APIs.</p><h4>AI Layer: LangChain and LangGraph</h4><p>The intelligence layer of the solution is built using LangChain and LangGraph.</p><h4>LangChain</h4><p>LangChain is used for:</p><ul><li>Prompt Management</li><li>LLM Integration</li><li>Structured Output Generation</li><li>SOQL Query Generation</li></ul><p>The framework converts natural language questions into valid SOQL statements.</p><p>Example:</p><p>User Question:</p><blockquote>give me opportunity details for account Edge Communications</blockquote><p>Generated SOQL:</p><pre>SELECT Id, Name, StageName, CloseDate, Amount, AccountId <br>FROM Opportunity <br>WHERE Account.Name = &#39;Edge Communications&#39;</pre><h4>LangGraph</h4><p>LangGraph orchestrates the workflow execution.</p><p>The workflow consists of:</p><ol><li>Receive User Question</li><li>Analyze Intent</li><li>Generate SOQL Query</li><li>Validate Query</li><li>Execute Salesforce Query</li><li>Process Results</li><li>Generate Natural Language Response</li></ol><p>This graph-based approach provides better control, observability, and extensibility compared to a simple sequential chain.</p><h4>Authentication Flow</h4><p>The authentication flow follows Salesforce OAuth 2.0 Authorization Code Grant.</p><h4>Step 1</h4><p>User clicks:</p><p><strong>Login with Salesforce</strong></p><p>from the Streamlit application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8F9E13qEibjZ5O6OZcvTQ.png" /><figcaption>Login Page</figcaption></figure><h3>Step 2</h3><p>Streamlit redirects the user to FastAPI’s /login endpoint. FastAPI redirects the user to Salesforce Login Page.</p><p>User authenticates using Salesforce credentials.</p><p>Salesforce returns an Authorization Code to the FastAPI /callback endpoint.</p><p>FastAPI exchanges the Authorization Code for:</p><ul><li>Access Token</li><li>Refresh Token</li><li>Instance URL</li><li>User Information</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4jVYRkrZxnSg54zXqV0o2g.png" /><figcaption>Redirected to Salesforce Login</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4dJNhz8NVdBVj7nT_pMffA.png" /><figcaption>Verify your identity using OTP</figcaption></figure><h3>Step 3</h3><p>User session is established. Chat requests use the user-specific access token to interact with Salesforce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BubzkgFYkRphWA689L53xQ.png" /><figcaption>Chat screen after successful login</figcaption></figure><h4>Conclusion</h4><p>This POC demonstrates how Salesforce Connected Apps can be effectively combined with modern AI frameworks such as LangChain and LangGraph to build secure enterprise AI applications.</p><p>By using Salesforce OAuth 2.0 and user-specific access tokens, the solution preserves Salesforce’s native Role-Based Access Control model while enabling users to interact with enterprise data using natural language.</p><p>The architecture eliminates the need to recreate complex authorization logic within the AI application and allows Salesforce to remain the source of truth for authentication and access control.</p><p>This approach provides a practical foundation for building secure and enterprise-ready AI assistants on top of Salesforce.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbe8819770c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>