<?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 Salman Shaikh on Medium]]></title>
        <description><![CDATA[Stories by Salman Shaikh on Medium]]></description>
        <link>https://medium.com/@salman3xs?source=rss-36b939242c45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3ixFdYT-w_j4o0C9aneOZQ.jpeg</url>
            <title>Stories by Salman Shaikh on Medium</title>
            <link>https://medium.com/@salman3xs?source=rss-36b939242c45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:40:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@salman3xs/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[The Missing Pieces of Circuit Breaker]]></title>
            <link>https://medium.com/@salman3xs/the-missing-pieces-of-circuit-breaker-a8243f43dbb4?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8243f43dbb4</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Wed, 28 Jan 2026 15:05:29 GMT</pubDate>
            <atom:updated>2026-01-28T15:05:29.362Z</atom:updated>
            <content:encoded><![CDATA[<p>Implementing the code is the easy part. Operating it at scale is where senior engineering comes in.</p><h3>1. Observability: If it’s not logged, it didn’t happen</h3><p>A Circuit Breaker fails silently by design (it stops errors from bubbling up). This is dangerous if operations teams aren’t aware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EA4sxiinpyrMPVIcTc5l-g.png" /></figure><h3>What to Monitor:</h3><ol><li><strong>State Changes:</strong> Log every transition (Closed → Open). This usually indicates an incident started.</li><li><strong>Failure Throughput:</strong> How many requests are being blocked by the breaker?</li><li><strong>Latency:</strong> Track the latency <em>before</em> the breaker trips.</li></ol><p><em>Example Prometheus Setup (Conceptual):</em><br>You should expose a metric circuit_breaker_state{service=”payments”}.</p><ul><li>0 = Closed</li><li>1 = Open</li><li>2 = Half-Open</li></ul><p><strong>Alert Rule:</strong> If circuit_breaker_state == 1 for &gt; 5 minutes, page the on-call engineer.</p><h3>2. Configuration: The “Timeout” Confusion</h3><p>A common interview question: <em>What is the difference between a Timeout and a Circuit Breaker?</em></p><ul><li><strong>Timeout:</strong> Limits the duration of <strong>one</strong> specific request (e.g., “Wait 2s then give up”).</li><li><strong>Circuit Breaker:</strong> Limits the impact of <strong>many</strong> failing requests on the system.</li></ul><p><strong>The Golden Rule:</strong> You must use <strong>BOTH</strong>.</p><p>If you have a Circuit Breaker but no timeout on the requests.get() call, your threads will still hang indefinitely until the breaker trips. The Timeout trips the failure; the Circuit Breaker notices the failure rate.</p><h3>3. Code vs. Infrastructure (Service Mesh)</h3><p>Should you write Python code for this?<br>As you scale to 50+ microservices in different languages (Python, Go, Node), maintaining pybreaker libraries in every repo becomes a nightmare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5ZHmJR7SPadMF4IMPwUOQ.png" /></figure><p><strong>The Service Mesh (Istio/Linkerd) Approach:</strong></p><ul><li><strong>How it works:</strong> You run a “Sidecar” proxy (Envoy) next to your Python container. The Sidecar handles the circuit breaking.</li><li><strong>Pros:</strong> Language agnostic. No code changes. Centralized config.</li><li><strong>Cons:</strong> It returns generic HTTP errors (503). It is very hard to implement custom “fallback logic” (like returning a cached product list) because the request never hits your application code.</li></ul><p><strong>Conclusion:</strong> Use <strong>Application-Level Breakers (Python)</strong> when you need business-logic fallbacks (e.g., “Show default recommendations”). Use <strong>Infrastructure Breakers (Istio)</strong> for generic protection against total service outages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8243f43dbb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Circuit Breaker Pattern]]></title>
            <link>https://medium.com/@salman3xs/the-circuit-breaker-pattern-5bf57527422c?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bf57527422c</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 13:52:23 GMT</pubDate>
            <atom:updated>2026-01-21T13:52:23.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u9f366iDtUwkhTfUTgqexg.png" /></figure><h3>1. The Problem: Cascading Failures</h3><p>In a distributed microservice architecture, the most dangerous failures are not the ones that happen instantly; they are the ones that happen <strong>slowly</strong>.</p><p>Imagine Service A (Order Service) depends on Service B (Inventory Service).<br>If Service B goes down completely and refuses connections (TCP RST), Service A fails instantly. This is fine.</p><p>However, if Service B is <strong>struggling</strong> — processing requests but taking 30 seconds to respond due to a locked database — Service A is in trouble.</p><ol><li>Service A sends a request and waits.</li><li>Service A holds a database connection, a request thread, and memory while waiting.</li><li>If 1000 users click “Buy,” Service A creates 1000 threads that all hang waiting for Service B.</li><li>Service A runs out of threads/RAM and crashes.</li><li><strong>Result:</strong> The entire platform goes down because of one slow database query in a sub-service.</li></ol><p>This is the <strong>Cascading Failure</strong>. The Circuit Breaker is not just about error handling; it is about <strong>Resource Preservation</strong>.</p><h3>2. The Solution: The Circuit Breaker State Machine</h3><p>The Circuit Breaker wraps the network call. It operates on a statistical model, not just a binary “up/down” model.</p><h3>The Deep Dive into States</h3><ol><li><strong>CLOSED (The Happy Path)</strong></li></ol><ul><li><strong>Logic:</strong> Requests flow freely. The breaker operates in the background, keeping a rolling window of metrics (e.g., “Last 60 seconds”).</li><li><strong>The Trip Condition:</strong> It monitors the <strong>Error Rate</strong> (e.g., 50% of requests failed) or <strong>Slow Call Rate</strong> (e.g., 80% of requests took &gt; 2s). If thresholds are met, it moves to OPEN.</li></ul><ol><li><strong>OPEN (The Cooling Off Period)</strong></li></ol><ul><li><strong>Logic:</strong> The link is severed. The breaker throws a CircuitBreakerOpenException immediately.</li><li><strong>Why is this vital?</strong> It releases the pressure on the failing service. If Service B is overloaded, hammering it with retries will kill it. The Open state gives Service B breathing room to recover (e.g., for an autoscaler to spin up new pods).</li></ul><ol><li><strong>HALF-OPEN (The Canary)</strong></li></ol><ul><li><strong>Logic:</strong> After a configured sleep_window, the breaker creates a new thread or allows a <em>single</em> request (the canary) to pass through.</li><li><strong>The Decision:</strong></li><li>If the canary succeeds: The breaker assumes health and resets to <strong>CLOSED</strong>.</li><li>If the canary fails: It assumes the service is still sick and returns to <strong>OPEN</strong> immediately, resetting the timer.</li></ul><h3>Architectural Diagram</h3><p>Ideally, the circuit breaker sits inside the <strong>Client’s process</strong> (Service A), not on the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtXe16Qc0r3xOAjZ2cwChA.png" /></figure><h3>3. Where to Use &amp; Limitations</h3><h3>Use Cases</h3><ul><li><strong>Synchronous RPC/HTTP:</strong> Any request where the client waits for a response.</li><li><strong>Database Connections:</strong> Preventing connection pool exhaustion when the DB is slow.</li></ul><h3>Limitations</h3><ol><li><strong>The Distributed State Problem:</strong> If you run 10 replicas of Service A, and you use an in-memory circuit breaker, one pod might be Open while another is Closed. This leaks traffic to the failing service. (Solution: Distributed storage like Redis, covered in Blog 2).</li><li><strong>Concurrency Limits:</strong> Standard circuit breakers don’t limit concurrency (bulkheading). If 100 requests hit the breaker simultaneously while it is Closed, all 100 pass through before the breaker realizes the service is down.</li><li><strong>Cold Starts:</strong> When a service restarts, the breaker has no data. It takes time to build the statistical window to know if it should trip.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bf57527422c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Microsoft Clarity in your Flutter app]]></title>
            <link>https://medium.com/@salman3xs/integrate-microsoft-clarity-in-your-flutter-app-063591d5778a?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/063591d5778a</guid>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[clarity]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Wed, 09 Jul 2025 08:27:19 GMT</pubDate>
            <atom:updated>2025-07-21T07:21:25.189Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qAkmknmN_FzBaSKUjTWkVg.png" /></figure><p>Ever wondered how people actually use your app?</p><p>What if you could see where they tap, where they get stuck, or why they drop off?</p><p>That’s where <strong>Microsoft Clarity</strong> comes in — and the best part? It’s <strong>100% free</strong>.</p><p>In this quick guide, I’ll show you how to add <strong>Clarity</strong> to your Flutter app step-by-step so you can start understanding your users better.</p><h3>🚀 What is Microsoft Clarity?</h3><p><strong>Clarity</strong> is a simple but powerful tool by Microsoft that lets you:</p><ul><li>Watch <strong>session replays</strong> of real users.</li><li>See <strong>heatmaps</strong> of where people touch on your app.</li><li>Get insights into user frustration and engagement.</li></ul><p>It’s basically like sitting next to your users and watching how they use your app — without invading their privacy.</p><h3>✏️ Step 1: Sign Up &amp; Get Your Project ID</h3><ol><li>Go to 👉 <a href="https://clarity.microsoft.com/signup">clarity.microsoft.com/signup</a></li><li>Sign up (you can use your Microsoft, Google, or Facebook account).</li><li>Create a new project.</li><li>Once done, you’ll get a <strong>Project ID</strong> — keep this handy, you’ll need it in the next step.</li></ol><h3>🛠 Step 2: Install the Clarity SDK in Flutter</h3><p>Open your Flutter project and add this to your pubspec.yaml file:</p><pre>dependencies:<br>  clarity_flutter: ^0.1.3</pre><p>Then run:</p><pre>flutter pub get</pre><h3>⚙️ Step 3: Initialize Clarity in Your App</h3><p>In your main.dart file, add this code:</p><pre>import &#39;package:clarity_flutter/clarity_flutter.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;</pre><pre>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();</pre><pre>final config = ClarityConfig(<br>    projectId: &quot;&lt;YOUR_PROJECT_ID&gt;&quot;,<br>    logLevel: LogLevel.Info,<br>  );</pre><pre>runApp(ClarityWidget(<br>    app: const MyApp(),<br>    clarityConfig: config,<br>  ));<br>}</pre><pre>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Clarity Demo&#39;,<br>      home: Scaffold(<br>        appBar: AppBar(title: Text(&#39;Clarity + Flutter&#39;)),<br>        body: Center(child: Text(&#39;Hello, Clarity!&#39;)),<br>      ),<br>    );<br>  }<br>}</pre><p>👉 <strong>Don’t forget:</strong> Replace &lt;YOUR_PROJECT_ID&gt; with the actual ID you got from Clarity.</p><h3>🔍 Step 4: Run Your App and See the Magic</h3><ol><li>Run your app on a device or emulator.</li><li>Interact with it normally — navigate around, click buttons, etc.</li><li>Head back to your <strong>Clarity Dashboard</strong> (<a href="https://clarity.microsoft.com/">clarity.microsoft.com</a>) and within a few minutes, you’ll start seeing your sessions appear.</li></ol><p>Yes, it’s that simple.</p><h3>👀 What Can You Do With Clarity?</h3><p>✅ See where users tap the most (or not at all)</p><p>✅ Watch session replays to spot confusing screens</p><p>✅ Catch bugs or navigation dead ends</p><p>✅ Improve onboarding or checkout flows</p><p>Clarity gives you actual data instead of guessing what’s going wrong.</p><h3>🙌 Why I Recommend Clarity</h3><ul><li>It’s <strong>free</strong> (seriously).</li><li>Easy to set up (5 minutes max).</li><li>Gives you actionable insights without needing a full analytics team.</li></ul><h3>Final Thoughts</h3><p>If you care about <strong>user experience</strong> (and you should), integrating Microsoft Clarity in your Flutter app is a no-brainer. It’s quick, painless, and helps you build better apps by understanding real-world behavior.</p><p>👉 <strong>Useful Links:</strong></p><ul><li>📖 <a href="https://learn.microsoft.com/en-us/clarity/mobile-sdk/flutter-sdk">Clarity Flutter SDK Docs</a></li><li>📝 <a href="https://clarity.microsoft.com/signup">Sign Up for Clarity</a></li></ul><p>If you found this helpful, give it a clap 👏 and feel free to ask questions in the comments!</p><p>Let me know if you want me to help design a thumbnail or add images too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=063591d5778a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey as a Developer: Moving from Service-Based to Product-Based Companies]]></title>
            <link>https://medium.com/@salman3xs/my-journey-as-a-developer-moving-from-service-based-to-product-based-companies-40943aff30e3?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/40943aff30e3</guid>
            <category><![CDATA[it]]></category>
            <category><![CDATA[product-based-companies]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Tue, 05 Nov 2024 17:48:25 GMT</pubDate>
            <atom:updated>2024-11-05T17:48:25.190Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vtvVdQkbp-viG8RQ" /><figcaption>Photo by <a href="https://unsplash.com/@mukukostudio?utm_source=medium&amp;utm_medium=referral">Mukuko Studio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction</strong></p><p>Switching from a service-based company to a product-based company was a big step for me as a developer. I’ve always loved coding, but this transition gave me a fresh perspective on what it means to truly <em>own</em> a product and create something lasting. Moving into a product-focused role has changed how I think about technical depth, user experience, and the long-term impact of my work. In this blog, I want to share my journey, diving into what I’ve learned about the technical aspects of each environment, and why working in a product-based setting has been so rewarding.</p><p><strong>Life in a Service-Based Company: What It’s Like for a Developer</strong></p><p><strong>1. Project Variety and the Need to Adapt Quickly</strong></p><p>• In a service-based company, you’re constantly jumping between projects. I worked across multiple industries, from e-commerce to finance to healthcare, all within short timeframes. Each client had different technical requirements, which kept things exciting and challenged me to learn fast. It was like a crash course in adaptability. Every week brought a new tech stack, a different codebase, and fresh client requests.</p><p>• But there was a downside: just as I’d get a good handle on one project, it would be time to move to the next. With tight deadlines, the goal was to get things done rather than make them perfect. For instance, with Flutter, we’d build functional UIs, but rarely did we have the time to focus on adding smooth animations or enhancing the UX. It often felt like we were delivering a solid product but missing the chance to make it truly engaging or unique.</p><p><strong>2. Limited Focus on UX and UI Enhancements</strong></p><p>• When you’re working on a client project, the focus is usually on meeting the minimum requirements rather than on the finer details that make an app truly stand out. This means that in a service-based environment, elements like animations, transitions, and micro-interactions were lower priority. Clients would often want the essentials and were focused on what they needed for launch.</p><p>• This approach was practical, but it didn’t allow much room for experimentation or a deep focus on user experience (UX). We built UIs that were solid and functional, but rarely did we get to obsess over how the user actually interacted with the app. As a Flutter developer, it was tough to resist the urge to make the app a little smoother, a little more enjoyable — there just wasn’t time for that.</p><p><strong>3. Working Within Tech Stack and Tooling Constraints</strong></p><p>• Service companies are driven by client requirements, which means adapting to whatever tech stack or tools the client prefers. Sometimes, we’d work with legacy systems, or I’d have to use older versions of dependencies, which wasn’t ideal but was necessary for the project.</p><p>• While I learned a lot about overcoming limitations and making things work, it felt like I wasn’t getting as much experience with the latest and greatest tech. Flutter’s new animation capabilities or cool libraries for better state management? Those would often be off the table. It was practical experience but not the deep-dive into modern Flutter features I was hoping for.</p><p><strong>Moving into a Product-Based Company: A New Perspective</strong></p><p><strong>1. End-to-End Product Development</strong></p><p>• In a product-based company, I got to experience what it’s like to truly <em>own</em> a product. This shift felt empowering. Unlike before, where I would hand over a project after it launched, I was now responsible for the product’s entire lifecycle. From initial planning to each update, I was there every step of the way.</p><p>• This continuity has allowed me to think long-term and take pride in what I’m building. Now, I can invest time in making sure the codebase is solid, reusable, and ready for future growth. As a Flutter developer, I’ve had the chance to really dig into making the UI scalable, optimizing for performance, and thinking carefully about the overall architecture. I can approach things with the confidence that what I build now will last and evolve, not just disappear after handoff.</p><p><strong>2. Focus on Optimization, Animation, and User Experience</strong></p><p>• One of the biggest perks in product-based development is the focus on UX. Here, we prioritize the <em>experience</em>, not just the functionality. I get to pay attention to the little details that make the app enjoyable, from smooth animations to interactive transitions that respond to user input. It’s a complete mindset shift.</p><p>• Every feature is backed by user data. We analyze how users interact with the app and where they struggle, which means I can address real pain points. It’s fulfilling to know that the time I spend refining animations or enhancing the UX has a direct impact on the product’s success. Flutter gives me the tools to create fluid, engaging UIs, and now, I finally have the freedom to use them to their full potential.</p><p><strong>3. Growing Through Specialization</strong></p><p>• Product-based companies often encourage developers to become experts in specific areas. In a service-based role, I was a generalist, constantly switching projects and tech stacks. Now, I get to dive deep into Flutter and grow as a specialist. I’ve been able to focus on state management, perfect custom animations, and create reusable components that elevate the app.</p><p>• This level of focus has been immensely rewarding. I feel like my skills have improved significantly in a shorter time because I’m dedicated to refining my work on a single product. It’s also boosted my confidence in my ability to create high-quality, user-centered features that align with our product goals.</p><p><strong>4. Building with Long-Term Code and System Architecture</strong></p><p>• In a product-based company, I have the freedom to think strategically about the code and architecture. Instead of rushing to meet a deadline, I can plan for the future. This includes using Flutter’s architecture principles, creating clean, maintainable code, and setting up testing frameworks that ensure stability as the app scales.</p><p>• I’ve had the opportunity to implement CI/CD pipelines and focus on code reviews, which makes for a smooth and efficient development process. It’s empowering to know that the choices I make today will impact the product down the line, so I take the time to do things right. Now, it’s about building something I can be proud of, something that will grow with the product and its users.</p><p><strong>Reflecting on the Journey: Final Thoughts</strong></p><p>Moving from a service-based to a product-based role has been transformative. I’ve found that in a product company, there’s room to innovate, experiment, and pay attention to the details that make an app enjoyable for users. The ability to engage deeply with a product, refine its features, and create a lasting impact has been incredibly fulfilling.</p><p>For any developer considering a similar move, I’d say go for it. The transition offers a chance to grow technically, hone your skills, and really focus on what makes an app great. If you love building meaningful, user-centered experiences, a product-based role might be exactly what you’re looking for.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40943aff30e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is FOMO Holding You Back? Discover How to Take Control]]></title>
            <link>https://medium.com/@salman3xs/is-fomo-holding-you-back-discover-how-to-take-control-6731c0a8d602?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/6731c0a8d602</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[peace]]></category>
            <category><![CDATA[fomo]]></category>
            <category><![CDATA[jomo]]></category>
            <category><![CDATA[lifestyle]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Wed, 06 Mar 2024 09:45:28 GMT</pubDate>
            <atom:updated>2024-03-06T09:45:28.299Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there! Have you ever felt that twinge of anxiety when scrolling through your social media feeds, seeing friends posting about their latest adventures or achievements? That’s the Fear of Missing Out (FOMO) creeping in, my friend. But fear not, because you’re not alone in this rollercoaster ride of emotions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*6b8dZ0b8x-WBz0-CM9Qd7Q.jpeg" /></figure><h3>Real Stories: Navigating FOMO in Mumbai</h3><p>Meet Raj, a software engineer hustling through the bustling streets of Mumbai. Raj used to be all about saying “yes” to every opportunity that came his way. But as time went on, he realized he was spreading himself too thin, trying to keep up with everyone else’s pace. Raj’s personality was deeply influenced by his likes and dislikes, but the pressure of FOMO blurred these lines, making him lose sight of what truly mattered to him.</p><p>In the midst of juggling multiple events on a single night, Raj had an epiphany. He realized that his well-being was taking a backseat to his FOMO-driven lifestyle. Determined to find balance, Raj started prioritizing self-care and setting boundaries. Today, he’s living life on his own terms, embracing the joy of missing out on activities that don’t resonate with him. His personality shines brighter than ever as he stays true to his authentic self, unswayed by external pressures.</p><h3>Is FOMO a gift?</h3><ol><li>Motivation and Inspiration: FOMO can be a double-edged sword, but it’s not all doom and gloom. Sometimes, seeing others achieve their goals can ignite a fire within us, pushing us to reach for our own dreams. However, when FOMO starts dictating our choices, it can blur our sense of self and lead to a disconnect from our true likes and dislikes.</li><li>Social Connectivity: FOMO can also lead us to forge deeper connections with others. Whether it’s attending events or reaching out to friends, the fear of missing out can spur us to prioritize meaningful relationships. However, when FOMO drives us to overcommit ourselves, we may find ourselves engaging in activities that don’t align with our personality or interests, leading to a sense of dissonance.</li><li>Exploration and Discovery: And let’s not forget the thrill of exploration! FOMO often nudges us to step out of our comfort zones and try new things. Who knows? You might just discover a hidden passion or two along the way. Yet, it’s essential to ensure that these explorations align with our authentic selves, rather than being driven solely by the fear of missing out on what others are doing.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KbnLigGZtv5E4utiggrkZA.jpeg" /></figure><h3>Or Curse?</h3><ol><li>Anxiety and Stress: Constantly feeling like we’re missing out on something can take a toll on our mental health. The pressure to keep up with what others are doing, combined with the fear of making the wrong choices, can lead to anxiety and stress, further exacerbating the disconnect between our personality and our actions.</li><li>Comparison and Envy: FOMO often stems from comparing ourselves to others and feeling envious of their seemingly perfect lives. This can breed dissatisfaction with our own circumstances and undermine our self-esteem, leading us to prioritize activities that don’t align with our personality in an attempt to keep up with the Joneses.</li><li>Overcommitment and Burnout: The fear of missing out can drive us to overcommit ourselves, saying “yes” to too many obligations and spreading ourselves too thin. This can result in burnout and exhaustion as we struggle to keep up with a packed schedule, further eroding our sense of self and leaving us feeling disconnected from our true likes and dislikes.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_ge5J2wR2Uw5aGOUR-ilA.jpeg" /></figure><h3>Can You Navigate FOMO?</h3><p>So, what’s the secret sauce to conquering FOMO without losing sight of your personality? It’s all about finding balance and staying true to yourself. Here are a few tips to help you navigate the FOMO minefield while honoring your personality:</p><ul><li>Stay True to Your Likes and Dislikes: Remember that your personality is shaped by what you genuinely enjoy and value. Don’t let FOMO sway you into activities or pursuits that don’t align with your authentic self.</li><li>Reflect on Your Priorities: Take the time to reflect on what truly matters to you and prioritize activities that resonate with your personality and values. Saying “no” to FOMO-induced opportunities can be empowering when it allows you to focus on what brings you genuine fulfillment.</li><li>Embrace Your Unique Path: Celebrate your individuality and embrace the beauty of your own journey. Your personality is a mosaic of your experiences, passions, and quirks, so don’t be afraid to march to the beat of your own drum, even if it means missing out on what others are doing.</li></ul><p>By staying true to your authentic self and navigating FOMO with intentionality, you can honor your personality while still embracing the opportunities for growth and connection that life has to offer. Remember, your likes and dislikes are what make you beautifully unique, so don’t let the fear of missing out dim your inner light.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6731c0a8d602" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preceptons: A new approach to machine learning with TensorFlow]]></title>
            <link>https://medium.com/@salman3xs/preceptons-a-new-approach-to-machine-learning-with-tensorflow-99047a1b1336?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/99047a1b1336</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Thu, 04 Jan 2024 03:16:10 GMT</pubDate>
            <atom:updated>2024-01-04T03:16:10.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6HtyqOTYyYUzUeERVXL8Ag.png" /></figure><p>Preceptons are a new type of machine learning algorithm that are inspired by the way the human brain works. Preceptons are able to learn complex patterns from data without the need for large amounts of labeled data. This makes them ideal for a wide range of tasks, including image recognition, natural language processing, and machine translation.</p><p>TensorFlow is an open-source software library for numerical computation using data flow graphs. It is used for machine learning and deep learning research and development.</p><p>Preceptons can be implemented in TensorFlow by using the following steps:</p><ol><li>Define the precepton network architecture. This includes defining the number of nodes in each layer of the network and the connections between the nodes.</li><li>Initialize the weights of the edges in the network.</li><li>Train the network using a dataset of input data and output data.</li><li>Evaluate the performance of the network on a test dataset.</li></ol><p>Here is a simple example of a precepton network implemented in TensorFlow:</p><p>Python</p><pre>import tensorflow as tf</pre><pre>class Preceptron(tf.keras.Model):<br>    def __init__(self, input_dim, output_dim):<br>        super(Preceptron, self).__init__()</pre><pre>        self.input_layer = tf.keras.layers.Dense(input_dim)<br>        self.output_layer = tf.keras.layers.Dense(output_dim)</pre><pre>    def call(self, inputs):<br>        outputs = self.input_layer(inputs)<br>        outputs = tf.nn.relu(outputs)<br>        outputs = self.output_layer(outputs)<br>        return outputs</pre><pre># Define the precepton network architecture<br>network = Preceptron(input_dim=784, output_dim=10)</pre><pre># Initialize the weights of the edges in the network<br>network.compile(loss=&#39;mse&#39;, optimizer=&#39;adam&#39;)</pre><pre># Train the network on the MNIST dataset<br>(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()<br>network.fit(x_train, y_train, epochs=10)</pre><pre># Evaluate the performance of the network on the test dataset<br>loss, accuracy = network.evaluate(x_test, y_test)<br>print(&#39;Loss:&#39;, loss)<br>print(&#39;Accuracy:&#39;, accuracy)</pre><p>This example shows how to implement a simple precepton network in TensorFlow to classify handwritten digits in the MNIST dataset.</p><p>Preceptons are a powerful new tool for machine learning. By using TensorFlow to implement precepton networks, we can easily train and deploy these models to solve a wide range of problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99047a1b1336" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top Flutter State Management Libraries in 2023]]></title>
            <link>https://medium.com/@salman3xs/top-flutter-state-management-libraries-in-2023-1428be0a4e2d?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/1428be0a4e2d</guid>
            <category><![CDATA[provider]]></category>
            <category><![CDATA[bloc]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Tue, 07 Nov 2023 04:57:56 GMT</pubDate>
            <atom:updated>2023-11-07T04:57:56.492Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*5pPylG0sdfJvGRbrTtylaQ.png" /></figure><p>Flutter is a popular cross-platform mobile development framework that uses Dart programming language. It is known for its hot reload feature, which allows developers to quickly iterate on their code and see changes in real time.</p><p>One of the challenges of developing Flutter apps is managing state. State refers to the data that changes over time in an app. For example, the state of a shopping cart app might include the items in the cart, the total price, and the user’s shipping address.</p><p>There are many different state management libraries available for Flutter. Each library has its own strengths and weaknesses, so it is important to choose the right one for your project.</p><h3>BLoC (Business Logic Component) :</h3><p><a href="https://bloclibrary.dev/#/"><em>Website</em></a></p><p>BLoC is a popular state management library that is recommended by Google. It is a reactive programming library that uses streams to manage state. BLoC is known for its simplicity and ease of use.</p><p>To use BLoC, you first need to create a BLoC class. This class will contain the state of your app. You then need to create a stream controller for each piece of state. The stream controller will emit events whenever the state changes.</p><p>To update the state of your app, you need to emit an event from the stream controller. The BLoC class will listen to the stream controller and update the state of your app accordingly.</p><p>BLoC is a good choice for small to medium-sized apps. It is easy to learn and use, and it is very efficient. However, it can be difficult to scale BLoC for large apps.</p><h3>Provider:</h3><p><a href="https://docs.flutter.dev/data-and-backend/state-mgmt/simple"><em>Website</em></a></p><p>Provider is another popular state management library. It is a simple and lightweight library that uses dependency injection to manage state. Provider is easy to learn and use, and it is well-suited for small to medium-sized apps.</p><p>To use Provider, you first need to create a provider class. This class will contain the state of your app. You then need to wrap your widgets in the provider class. The provider class will inject the state of your app into the widgets.</p><p>To update the state of your app, you need to update the state of the provider class. The provider class will automatically inject the new state into the widgets.</p><p>Provider is a good choice for small to medium-sized apps. It is easy to learn and use, and it is very efficient. However, it can be difficult to scale Provider for large apps.</p><h3>Riverpod:</h3><p><a href="https://riverpod.dev/"><em>Website</em></a></p><p>Riverpod is a newer state management library that is based on Provider. It provides some additional features, such as dependency injection, reactive programming, and code generation. Riverpod is a good choice for large and complex apps.</p><p>To use Riverpod, you first need to create a Riverpod provider. This provider will contain the state of your app. You then need to wrap your widgets in the Riverpod provider. The Riverpod provider will inject the state of your app into the widgets.</p><p>To update the state of your app, you need to update the state of the Riverpod provider. The Riverpod provider will automatically inject the new state into the widgets.</p><p>Riverpod is a good choice for large and complex apps. It is very efficient and scalable. However, it can be more difficult to learn than Provider.</p><h3>GetX:</h3><p><a href="https://github.com/jonataslaw/getx/blob/master/README.md"><em>Website</em></a></p><p>GetX is a powerful state management library that combines state management, routing, and dependency injection. It is a good choice for apps that need to be highly modular and testable.</p><p>To use GetX, you first need to create a GetX controller. This controller will contain the state of your app. You then need to use the GetX methods to update the state of your app.</p><p>GetX is a good choice for large and complex apps. It is very powerful and versatile. However, it can be more difficult to learn than Provider or Riverpod.</p><h3>MobX:</h3><p><a href="https://mobx.netlify.app/"><em>Website</em></a></p><p>MobX is a state management library that uses reactive programming to manage state. It is well-suited for complex apps with large amounts of state. MobX is known for its performance and its ability to handle complex state changes.</p><p>To use MobX, you first need to create a MobX observable. This observable will contain the state of your app. You then need to use the MobX methods to update the state of your app.</p><p>MobX is a good choice for complex apps with large amounts of state. It is very efficient and scalable. However, it can be more difficult to learn than Provider or Riverpod.</p><h3>Conclusion</h3><p>There are many great state management libraries available for Flutter. The best way to choose the right one for your project is to consider your specific needs and requirements. I hope this blog post has helped you to learn more about the top Flutter state management libraries in 2023.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1428be0a4e2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a GraphQL Server with Node.js, Express and MongoDB — Part 2]]></title>
            <link>https://medium.com/@salman3xs/building-a-graphql-server-with-node-js-express-and-mongodb-part-2-f926961987f0?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/f926961987f0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Wed, 18 Oct 2023 15:19:59 GMT</pubDate>
            <atom:updated>2023-10-18T15:19:59.606Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a GraphQL Server with Node.js, Express and MongoDB — Part 2</h3><h3>Starting Your GraphQL Journey: Part 2</h3><p>Welcome back to the second part of our series on building a GraphQL server with Node.js, Express, and MongoDB. In the previous blog post, we laid the foundation by setting up our development environment, creating the Express server, and defining the GraphQL schema.</p><p>Here’s Link to <a href="https://medium.com/@salman3xs/building-a-graphql-server-with-node-js-express-and-mongodb-part-1-9d14cc3dafe6"><em>PART ONE</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*G0ag4nizcbFXiJzmYI1u2w.png" /></figure><p>In this installment, we’ll dive deeper into the world of GraphQL and explore some advanced concepts and practices that will help you create a robust and efficient GraphQL server. Whether you’re a beginner or have some experience with GraphQL, this blog will provide valuable insights and practical tips to take your GraphQL skills to the next level.</p><p>We’re excited to embark on this journey with you, and we hope that by the end of this blog, you’ll feel confident in your ability to create powerful and efficient GraphQL servers. So, fasten your seatbelts, and let’s explore the fascinating world of GraphQL in more detail.</p><p>Shall we dive in?</p><p>We will be building creating an user, getting an user’s details and follow and unfollow user functionality.</p><h3>Defining the User Model Schema</h3><p>In the process of building our GraphQL server, one of the key components is defining the data models that represent the structure of our data in the database. The user model, as the name suggests, defines the structure of user data. In this part of the blog, we’ll explore how to create a user model using Mongoose, a popular Object Data Modeling (ODM) library for MongoDB.</p><pre>import mongoose, { Schema } from &quot;mongoose&quot;;<br><br>// Define the user model schema<br>const userModel = new Schema({<br>    // The user&#39;s ID<br>    id: String,<br>    // The user&#39;s name<br>    name: String,<br>    // The user&#39;s phone number<br>    phone: String,<br>    // An array of the user&#39;s posts<br>    post: Array,<br>    // An array of the users that the user is following<br>    following: Array,<br>});<br><br>// Export the user model<br>export default mongoose.model(&#39;User&#39;, userModel);</pre><p>Schema Fields:</p><ul><li>id: This field represents the user&#39;s ID. It is defined as a string, which might be a unique identifier for each user in your system.</li><li>name: The user&#39;s name, stored as a string. This field can hold the user&#39;s full name.</li><li>phone: The user&#39;s phone number, also stored as a string. This can be used for contact information.</li><li>post: This field is an array and can hold multiple user posts. Each post may have its own structure, which we likely define in another model.</li><li>following: Another array that stores the IDs of users that the current user is following. This establishes a many-to-many relationship between users.</li></ul><h3>Defining the UserType Schema</h3><p>In the previous part , we introduced the concept of creating a user model schema for our GraphQL server using Mongoose. Now, we’re going to explore how to define the GraphQL type schema that represents a user in our serve</p><pre>import { GraphQLObjectType, GraphQLString, GraphQLID, GraphQLList } from &quot;graphql&quot;;<br>import userModel from &#39;../models/userModel.js&#39;;<br><br>// Define the UserType type<br>export const UserType = new GraphQLObjectType({<br>    name: &quot;User&quot;,<br>    fields: () =&gt; ({<br>      id: { type: GraphQLID },<br>      name: { type: GraphQLString },<br>      phone: { type: GraphQLString },<br><br>      // Field to resolve the user&#39;s posts<br>      posts: {<br>        type: GraphQLList(GraphQLString),<br><br>      // Field to resolve the user&#39;s following<br>      following: {<br>        type: GraphQLList(UserType),<br>        resolve(parent, args) {<br>          // Create an empty array to store the following users<br>          var data = [];<br>  <br>          // Loop through the user&#39;s following IDs<br>          for (let index = 0; index &lt; parent.following.length; index++) {<br>            // Find the user by the following ID<br>            const user = userModel.findOne({ id: parent.following[index] });<br>  <br>            // Add the user to the data array<br>            data = [...data, user];<br>          }<br>  <br>          // Return the data array<br>          return data;<br>        },<br>      },<br>    }),<br>  });</pre><p>We will use different graphqlTypes for the datatypes as:</p><p>For id : GraphQLID</p><p>For String : GraphQLString</p><p>For List : GraphQLList</p><p>As for now we will give list of string for post</p><p>And for following users we give list of UserType .</p><p>and for graphql to understand what should be mapped in the list of followings we will update the resolve function.</p><p>Inshort we will use the queries of ORMs in resolve function.</p><p>Where the parent is current object and args is just arguments passed.</p><p>Resolving the following Field:</p><ul><li>following: This field represents the list of users that the current user is following. We define it as a list of UserType, indicating that each element in the list is another user.</li><li>In the resolve function, we customize how this field is resolved. We loop through the user&#39;s following IDs and use userModel.findOne to retrieve each user based on their ID. We add these users to the data array.</li><li>Finally, we return the data array, which contains the users that the current user is following</li></ul><p>Now we will update the RootQuery and Mutation that we defined in the first blog.</p><h3>Defining Root Queries for User Data</h3><p>In GraphQL, root queries are a fundamental component that allow clients to retrieve data from the server. Root queries define how clients can access data when making requests. Let’s explore the code that defines root queries for user data in our GraphQL schema:</p><pre>const RootQuery = new GraphQLObjectType({<br>    name: &quot;RootQueryType&quot;,<br>    fields: {<br><br>        // Field to resolve a user by their ID<br>        user: {<br>            type: UserType,<br>            args: {<br>                id: { type: new GraphQLNonNull(GraphQLID) },<br>            },<br>            resolve(parent, args) {<br>                // Find the user by the specified ID<br>                return userModel.findOne({ id: args.id });<br>            },<br>        },<br><br>        // Field to resolve all users<br>        allUser: {<br>            type: GraphQLList(UserType),<br>            args: {},<br>            resolve(parent, args) {<br>                // Find all users<br>                return userModel.find();<br>            },<br>        },<br>    },<br>});</pre><ol><li>Defining the user Query Field:</li></ol><ul><li>The user field allows clients to retrieve a user by specifying the user&#39;s ID. This field has the following properties:</li><li>type: UserType: Indicates that the result of this query will be of type UserType, which we previously defined in our schema.</li><li>args: Describes the arguments clients must provide. In this case, clients must provide the id argument as a non-null GraphQL ID.</li><li>resolve: The resolve function specifies how to fetch the data for this query. It takes the parent object, arguments (args), and resolves the query. In this case, it uses Mongoose to find a user by the provided id.</li></ul><p>2. Defining the allUser Query Field:</p><ul><li>The allUser field allows clients to retrieve a list of all users. This field has the following properties:</li><li>type: GraphQLList(UserType): Specifies that the result of this query is a list of UserType objects.</li><li>args : In this case, no additional arguments are required.</li><li>resolve: The resolve function fetches all user records from the database using Mongoose&#39;s userModel.find() method.</li></ul><pre>const Mutation = new GraphQLObjectType({<br>    name: &quot;Mutations&quot;,<br>    fields: {<br>        // Field to add a new user<br>        addUser: {<br>            type: UserType,<br>            args: {<br>                id: { type: new GraphQLNonNull(GraphQLID) },<br>                name: { type: new GraphQLNonNull(GraphQLString) },<br>                phone: { type: new GraphQLNonNull(GraphQLString) },<br>            },<br>            resolve(parent, args) {<br>                // Create a new user model instance<br>                let user = new userModel({<br>                    id: args.id,<br>                    name: args.name,<br>                    phone: args.phone,<br>                });<br><br>                // Save the user<br>                return user.save();<br>            },<br>        },<br><br>        // Field to follow or unfollow a user<br>        follow: {<br>            type: UserType,<br>            args: {<br>                userId: { type: new GraphQLNonNull(GraphQLID) },<br>                otherUserId: { type: new GraphQLNonNull(GraphQLID) },<br>            },<br>            async resolve(parent, args) {<br>                // Find the user who is trying to follow or unfollow another user<br>                let user = await userModel.findOne({ id: args.userId });<br><br>                // If the user is not already following the other user<br>                if (!user.following.includes(args.otherUserId)) {<br>                    // Add the other user to the user&#39;s following list<br>                    user.following = [...user.following, args.otherUserId];<br>                } else {<br>                    // Remove the other user from the user&#39;s following list<br>                    user.following = user.following.filter((v) =&gt; v != args.otherUserId);<br>                }<br><br>                // Save the user<br>                return user.save({ isNew: false });<br>            },<br>        },<br>    },<br>});</pre><h3>Mutations: Adding Users and Managing Follow Relationships</h3><p>In the world of GraphQL, mutations are operations that modify data. They enable clients to create, update, or delete data in the server. In our GraphQL schema, we’ve defined a Mutation type that includes two significant operations: adding a new user and managing follow relationships between users.</p><p>Let’s dive into the code that handles these mutations:</p><h3>Understanding Mutations for Adding Users and Managing Follow Relationships</h3><ol><li>Adding a New User:</li></ol><ul><li>The addUser mutation field allows clients to add a new user to the system. It has the following properties:</li><li>type: UserType: Specifies that the result of this mutation is a user, adhering to the UserType schema.</li><li>args: Defines the required input arguments for adding a user, including id, name, and phone.</li><li>In the resolve function, we create a new user instance using the provided arguments, save it to the database, and return the created use.</li></ul><p>2. Managing Follow Relationships:</p><ul><li>The follow mutation field allows clients to manage follow relationships between users. This field has the following properties:</li><li>type: UserType: Indicates that this mutation returns a user.</li><li>args: Specifies the required input arguments: userId (the user initiating the follow/unfollow) and otherUserId (the target user).</li><li>In the resolve function, we find the user who is initiating the follow/unfollow action. Depending on the situation, we either add or remove the otherUserId from the user&#39;s following list. We then save the user and return the updated user data.</li></ul><p>Now Export both the rootQuery and mutation as GraphQLSchema.</p><pre>export default new GraphQLSchema({<br>    query: RootQuery,<br>    mutation: Mutation<br>})</pre><p>Run the server if you were following the blog from part 1.</p><p>Now run the server with the code in the terminal</p><pre>nodemon app.js</pre><p>Open a browser and navigate to http://localhost:4000/graphql to access the GraphiQL interface, which allows you to interact with your GraphQL API.</p><h3>Querying User Data with GraphQL</h3><p>In our GraphQL-powered application, clients have the ability to fetch user data using queries. These queries allow clients to specify the data they want and retrieve it in a structured format. Let’s take a closer look at a GraphQL query example that retrieves user data, including the user’s ID, name, phone number, and the list of users they are following.</p><pre>query {<br>  user(id: &quot;6yalSLc08EO35fvN9ef2zTutKWA2&quot;) {<br>    id<br>    name<br>    phone<br>    following {<br>      id<br>    }<br>  }<br>}</pre><h3>Query Explanation:</h3><ul><li>query: This keyword is used to indicate that a query operation is being performed. It&#39;s the entry point for fetching data from the server.</li><li>user(id: &quot;6yalSLc08EO35fvN9ef2zTutKWA2&quot;): This part of the query is a field called user. It takes an argument id to specify the user to retrieve. In this example, we&#39;re fetching a user with the specified ID.</li><li>{ id, name, phone, following { id } }: Within the user field, we define the specific user data we want to retrieve. In this case, we want to fetch the user&#39;s id, name, and phone. Additionally, we&#39;re interested in the users they are following, and for each of those users, we want their id.</li></ul><h3>Expected Result:</h3><p>The result of this query will be structured in the same shape as the query itself. The query specifies that we want to retrieve specific fields for a user and the list of users they are following. Here’s a simplified example of what the result might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FxCRxJ26nTdj41nPK8Fxg.png" /></figure><h3>Retrieving a List of All Users with GraphQL</h3><p>One of the powerful aspects of GraphQL is the ability to retrieve data in a structured and controlled manner. In this section, we’ll explore a GraphQL query that retrieves a list of all users, including their IDs and names.</p><pre>query {<br>  allUser {<br>    id<br>    name<br>  }<br>}</pre><h3>Query Explanation:</h3><ul><li>query: This keyword signifies that we are making a query operation. Queries are used to retrieve data from the server.</li><li>allUser: This is a field that represents the query we are executing. It&#39;s designed to retrieve all user data.</li><li>{ id, name }: Inside the allUser field, we specify the fields we want to retrieve for each user. In this case, we&#39;re interested in the id and name fields.</li></ul><h3>Expected Result:</h3><p>The result of this query will be structured in the same way as the query itself. It will return a list of users, each with their id and name. Here&#39;s a simplified example of what the result might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYTGHdnL224K8nhOQa8TUw.png" /></figure><h3>Adding a New User with a GraphQL Mutation</h3><p>In GraphQL, mutations allow clients to modify data on the server, and one common use case is adding new data. In our GraphQL schema, we have a mutation named addUser that enables clients to create a new user. Let&#39;s explore a GraphQL mutation example that adds a new user with a specified name, phone number, and ID.</p><pre>mutation {<br>  addUser(name: &quot;New User&quot;, phone: &quot;12121212&quot;, id: &quot;asdasd&quot;) {<br>    id<br>    name<br>    phone<br>  }<br>}</pre><h3>Mutation Explanation:</h3><ul><li>mutation: The keyword indicates that a mutation operation is being performed. Mutations are used to modify data on the server.</li><li>addUser(name: &quot;New User&quot;, phone: &quot;12121212&quot;, id: &quot;asdasd&quot;): This part of the mutation is the addUser field. It takes arguments like name, phone, and id. These arguments are used to specify the details of the new user to be created. In this example, we&#39;re creating a user with the name &quot;New User,&quot; phone number &quot;12121212,&quot; and the unique ID &quot;asdasd.&quot;</li><li>{ id, name, phone }: Within the addUser field, we specify the user fields we want to retrieve as a result of the mutation. In this case, we want to retrieve the user&#39;s id, name, and phone.</li></ul><h3>Expected Result:</h3><p>The result of this mutation will be structured in the same shape as the query itself. It will return the data for the newly created user. Here’s a simplified example of what the result might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69RS-Hf_73WZNMM5KVIzHA.png" /></figure><p>In future parts of our blog series, we’ll delve deeper into more advanced queries and mutations, exploring how GraphQL can be used to build dynamic and interactive applications.</p><p>Stay tuned for more GraphQL insights and practical examples!</p><p>Github: <a href="https://github.com/salman3xs/social_backend">here</a></p><p>Live: <a href="https://carpal-winter-tile.glitch.me/graphql">he<em>re</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f926961987f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a GraphQL Server with Node.js, Express, and MongoDB - Part 1]]></title>
            <link>https://medium.com/@salman3xs/building-a-graphql-server-with-node-js-express-and-mongodb-part-1-9d14cc3dafe6?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d14cc3dafe6</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Tue, 17 Oct 2023 07:38:37 GMT</pubDate>
            <atom:updated>2023-10-18T14:53:23.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*wVRFrLsCffN5LNIr0j9K9w.png" /></figure><h3>GraphQL is a powerful query language for APIs, allowing clients to request exactly the data they need. In this blog, we’ll guide you through the steps to create a GraphQL server using Node.js, Express, and MongoDB. This combination provides a flexible and efficient backend for your applications. We’ll also discuss key files and their roles in the project.</h3><h3>Prerequisites</h3><p>Before we begin, ensure you have Node.js and MongoDB installed on your system. You can download and install them from their respective official websites.</p><h3>Step 1: Setting Up the Project</h3><p>Start by creating a new Node.js project and installing the required dependencies. Here’s how you can do it:</p><pre>mkdir graphql-mongodb-server<br>cd graphql-mongodb-server<br>npm init -y<br>npm install express express-graphql graphql mongoose cors body-parser</pre><h3>Step 2: Creating the Express Server</h3><p>In your main application file (let’s call it server.js), you&#39;ll create an Express server to run your GraphQL API. It&#39;s a good practice to encapsulate server configuration in a class, as demonstrated in the code below:</p><pre>// Import required packages<br>import express from &quot;express&quot;;<br>import { graphqlHTTP } from &quot;express-graphql&quot;;<br>import cors from &#39;cors&#39;;<br>import bodyParser from &quot;body-parser&quot;;<br>import mongoose from &quot;mongoose&quot;;<br><br>// Import your GraphQL schema (schemaql)<br><br>// Create the Express app<br>class App {<br>    constructor(port) {<br>        this.app = express();<br>        this.port = port;<br>        this.connectToDataBases();<br>        this.initialize();<br>    }<br><br>    initialize() {<br>        this.app.use(cors({ origin: [&#39;*&#39;] }));<br>        this.app.use(bodyParser.json());<br>        this.app.use(bodyParser.urlencoded({ extended: true }));<br>        this.app.use(<br>            &quot;/graphql&quot;,<br>            graphqlHTTP({<br>                schema: schemaql,<br>                graphiql: true,<br>            })<br>        );<br>    }<br><br>    connectToDataBases() {<br>        const uri = &quot;YOUR_MONGODB_URI&quot;;<br>        mongoose.connect(uri);<br>    }<br><br>    listen() {<br>        this.app.listen(this.port, () =&gt; {<br>            console.log(&quot;Running a GraphQL API server at http://localhost:4000/graphql&quot;);<br>        });<br>    }<br>}<br><br>export default App;</pre><p>Remember to replace &quot;YOUR_MONGODB_URI&quot; with your actual MongoDB connection string.</p><h3>Step 3: Creating Your GraphQL Schema</h3><p>Your GraphQL schema defines the structure of your API. It’s split into two parts: RootQuery and Mutation.</p><pre><br>const RootQuery = new GraphQLObjectType({<br>    name: &quot;RootQueryType&quot;,<br>    fields:{<br>      hello: {<br>            type: GraphQLString,<br>            resolve(parent, args) {<br>                return &quot;Hello&quot;<br>            }<br>        }<br>  }<br>}):<br><br>const Mutation = new GraphQLObjectType({<br>    name: &quot;Mutations&quot;,<br>    fields:{<br>      hello: {<br>            type: GraphQLString,<br>            resolve(parent, args) {<br>                return &quot;Hello&quot;<br>            }<br>        }<br>  }<br>});<br><br>export default new GraphQLSchema({<br>    query: RootQuery,<br>    mutation: Mutation<br>});</pre><ul><li>RootQuery : This defines the available queries like newsfeed, post, user, and allUser, allowing clients to retrieve data.</li><li>Mutation: This defines the actions that can change data, such as addUser, addPost, and follow.</li></ul><h3>Step 4: Running the Server</h3><p>Create an app.js file and create an instance of your App class and start the server:</p><pre>import App from &quot;./server&quot;;<br><br>const port = 4000;<br>const app = new App(port);<br><br>app.listen();</pre><p>now run the file with the code in the terminal</p><pre>nodemon app.js</pre><h3>Testing Your GraphQL Server</h3><p>To test your GraphQL server, you can use tools like Postman or a web browser. Open a browser and navigate to http://localhost:4000/graphql to access the GraphiQL interface, which allows you to interact with your GraphQL API.</p><p>It will look like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HjFts7LUIpyCPTL83SUyUA.png" /></figure><p>With this setup, you have a fully functional GraphQL server connected to a MongoDB database. You can expand upon this foundation to create more complex queries and mutations to power your application.</p><p>We will add queries and mutations in the next part so stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d14cc3dafe6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter VS React Native in 2023]]></title>
            <link>https://medium.com/@salman3xs/flutter-vs-react-native-in-2023-cfd042746827?source=rss-36b939242c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfd042746827</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[2023]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[Salman Shaikh]]></dc:creator>
            <pubDate>Mon, 18 Sep 2023 07:56:33 GMT</pubDate>
            <atom:updated>2023-09-18T07:56:33.758Z</atom:updated>
            <content:encoded><![CDATA[<p>Flutter VS React Native in 2023</p><p>The changes happening in Flutter and React Native in 2023 are making both frameworks more powerful and versatile. Flutter is gaining popularity for its high performance and expressive UI, while React Native is continuing to be a popular choice for its mature community and large library of plugins.</p><p>Flutter</p><ul><li>Flutter 3.0 was released in December 2022. It includes a number of new features and improvements, including:</li><li>A new rendering engine that is more efficient and produces better graphics</li><li>A new state management library called Riverpod</li><li>New widgets for building complex UIs</li><li>Support for web and desktop development</li><li>The new rendering engine, called Skia, is based on the same engine that powers Google Chrome. This makes Flutter apps more performant and visually appealing.</li><li>The new state management library, Riverpod, is a declarative state management library that is inspired by Redux. It makes it easier to manage the state of your app and reduce the amount of code you need to write.</li><li>The new widgets make it easier to build complex UIs with Flutter. They also include new features, such as theming and animations.</li><li>Flutter 3.0 also supports web and desktop development. This means that you can now use Flutter to build apps that run on all major platforms.</li><li>There are now a large number of plugins available for Flutter. This makes it easier to integrate with third-party services and libraries.</li></ul><p>React Native</p><ul><li>React Native 18</li><li>React Native 18 was released in March 2023. It includes a number of new features and improvements, including:</li><li>A new architecture that makes it easier to build complex apps</li><li>A new way to manage state that is more efficient</li><li>New APIs for working with native features</li><li>The new architecture is called Suspense. It makes it easier to manage the loading and rendering of asynchronous data.</li><li>The new state management library is called Recoil. It is a lightweight library that makes it easy to manage the state of your app.</li><li>The new APIs for working with native features make it easier to integrate with native code.</li><li>TypeScript is a superset of JavaScript that provides type safety. This can help to reduce errors and make code more maintainable.</li><li>The adoption of TypeScript is increasing in the React Native community. This is because TypeScript can help to improve the quality of code and make it easier to maintain.</li></ul><p>Conclusion</p><p>The best framework for you will depend on your specific needs and preferences. If you are looking for a framework that is fast, expressive, and has a large community of developers, then Flutter is a good choice. If you are looking for a framework that is mature, has a large library of plugins, and is easy to learn, then React Native is a good choice.</p><p>I hope this blog post has given you a better understanding of the changes happening in Flutter and React Native in 2023. If you have any other questions, please feel free to ask.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfd042746827" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>