<?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 Samad Saiyed on Medium]]></title>
        <description><![CDATA[Stories by Samad Saiyed on Medium]]></description>
        <link>https://medium.com/@samad.saiyed.ss?source=rss-1ff625a3100f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OkRs21cGauyTOsy07M7zqw.jpeg</url>
            <title>Stories by Samad Saiyed on Medium</title>
            <link>https://medium.com/@samad.saiyed.ss?source=rss-1ff625a3100f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:34:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samad.saiyed.ss/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 Job Search I Never Planned For]]></title>
            <link>https://medium.com/@samad.saiyed.ss/the-job-search-i-never-planned-for-6cef4406c777?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cef4406c777</guid>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[short-story]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Tue, 29 Sep 2026 08:55:53 GMT</pubDate>
            <atom:updated>2026-09-29T08:55:53.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="I thought leaving my job would be the beginning of something new." src="https://cdn-images-1.medium.com/max/1024/1*YNSKCYQbeBgYKB2JUCpWjQ.png" /></figure><p><strong>I thought leaving my job would be the beginning of something new.</strong></p><p>I didn’t expect it to become a long lesson in patience, self-doubt, and realizing that being good at what you do doesn’t always mean the right opportunity will find you.</p><p>Earlier this year, I found myself at a turning point in my career.</p><p>My company was going through a difficult period, with fewer projects coming in, and I was asked to start looking for my next opportunity. I was given around two months to figure out my next step.</p><p>There was no bad blood. In fact, I still have good relations with the people I worked with there.</p><p>Looking back, I think it was simply one of those moments in a career where circumstances change and you have to decide what comes next.</p><p>So I made a decision.</p><p>I decided to leave at the end of February.</p><p>I could have immediately jumped into another job, but instead, I decided to take a little time for myself.</p><p>After spending years working continuously, I thought I had earned a proper break.</p><p>So I went to Mecca and Medina with my family for around 20 days.</p><p>It was one of those experiences where you temporarily stop thinking about deadlines, Jira tickets, deployments, interviews, pull requests, and everything else that normally occupies your mind.</p><p>For a little while, life wasn’t about finding the next job.</p><p>It was just about being present.</p><p>Then I came back.</p><p>And in the first week of April, I started looking for work.</p><p>I honestly thought it would be relatively straightforward.</p><p>I had more than three years of professional experience. Over those years, I had grown considerably as a developer.</p><p>I started with frontend development, but gradually found myself working across much more of the stack.</p><p>React. Next.js. Node.js. Databases. DevOps. Cloud infrastructure. Mobile development.</p><p>I worked on projects from the initial idea all the way to deployment. I worked with clients, helped coordinate teams, handled production issues, built APIs, worked on databases, managed deployments, and took responsibility for whatever part of the project needed attention.</p><p>My responsibilities had grown significantly compared to when I started.</p><p>But one thing I had learned in those years was that career growth isn’t always perfectly synchronized.</p><p>Your responsibilities can grow faster than your title.</p><p>Your skills can grow faster than your compensation.</p><p>And sometimes, you don’t notice it because you’re so focused on doing the work and getting better at what you do.</p><p>That realization became much clearer once I entered the job market.</p><p>I started applying.</p><p>And applying.</p><p>And applying.</p><p>Some applications disappeared into silence.</p><p>Some received automated rejections.</p><p>Some led to interviews.</p><p>And some interviews actually went well, only for the compensation to make the opportunity difficult to justify.</p><p>There were opportunities in other cities where I would have had to relocate, take on additional living expenses, and completely change my routine — only to end up with compensation that wasn’t significantly different from what I had before.</p><p>That’s when I started thinking more seriously about my next move.</p><p>Not just about getting <em>a</em> job.</p><p>But about finding a role that actually makes sense for the experience I’ve accumulated.</p><p>Looking back, I probably should have explored the market earlier.</p><p>Not because my previous company was necessarily the wrong place for me.</p><p>It wasn’t.</p><p>I learned a lot there.</p><p>I got opportunities to work on things I probably wouldn’t have been exposed to elsewhere. I was trusted with responsibilities that helped me grow, and I had the chance to work with some genuinely good people.</p><p>But I think there is a lesson in that too.</p><p>Sometimes you become comfortable because you’re learning and contributing, and you don’t stop to ask whether it’s time to explore what else is out there.</p><p>That’s something I wish I had understood earlier.</p><p>And then there is another side to this experience that nobody really talks about.</p><p>The emotional side of looking for a job.</p><p>You apply.</p><p>You wait.</p><p>Nothing happens.</p><p>You apply again.</p><p>Still nothing.</p><p>You start questioning your resume.</p><p>Then your skills.</p><p>Then your experience.</p><p>Then yourself.</p><p>You see other developers announcing new jobs on LinkedIn.</p><p><em>“Excited to announce that I’ve joined…”</em></p><p>And you genuinely feel happy for them.</p><p>But somewhere in the back of your mind, there’s also that little voice asking:</p><p><strong>“When will it be my turn?”</strong></p><p>The hardest part isn’t always rejection.</p><p>Sometimes it’s the silence.</p><p>A rejection at least tells you something.</p><p>Silence makes you wonder whether anyone even saw your application.</p><p>And after enough unanswered applications, it’s very easy to start believing that something is wrong with you.</p><p>I’m trying not to fall into that mindset.</p><p>Because being between jobs doesn’t erase the experience I’ve gained.</p><p>A difficult job market doesn’t suddenly make the projects I’ve built less meaningful.</p><p>And the fact that my previous role came to an end doesn’t determine my worth as an engineer.</p><p>I’m still the same person who has built products from scratch.</p><p>The same person who has worked across frontend, backend and infrastructure.</p><p>The same person who has stayed late trying to fix production issues.</p><p>The same person who has learned new technologies because a project required them.</p><p>The same person who has taken responsibility when things needed to get done.</p><p>The only difference is that right now, I’m trying to convince someone new of that.</p><p>And that’s probably the most frustrating part of this entire phase.</p><p>You can know what you’re capable of.</p><p>You can have years of experience.</p><p>You can have projects you’re genuinely proud of.</p><p>But ultimately, someone has to give you the opportunity to prove it.</p><p><em>So I’m still applying.</em></p><p><em>Still learning.</em></p><p><em>Still improving my resume.</em></p><p><em>Still preparing for interviews.</em></p><p><em>Still building things.</em></p><p><em>Still trying.</em></p><p>I don’t know exactly when this chapter will end.</p><p>Maybe the next opportunity is around the corner.</p><p>Maybe it will take longer than I expect.</p><p>But I’ve learned something during these months that I probably wouldn’t have learned if everything had gone according to plan.</p><p><strong>A career isn’t always a straight line.</strong></p><blockquote>Sometimes you get promoted.</blockquote><blockquote>Sometimes you switch companies.</blockquote><blockquote>Sometimes you get rejected.</blockquote><blockquote>Sometimes circumstances force you to leave.</blockquote><blockquote>Sometimes you take a break.</blockquote><blockquote>Sometimes you spend months wondering what you’re doing wrong.</blockquote><blockquote>And sometimes, despite doing everything you can, you simply have to wait for the right opportunity to appear.</blockquote><p>I’m trying to remind myself that this period is just that — <strong>a period</strong>.</p><p>Not my entire career.</p><p>Not my identity.</p><p>Not a measure of my ability.</p><p><strong><em>Just a chapter.</em></strong></p><p>And hopefully, when I eventually look back at this period from a better place, I’ll realize that it wasn’t the time I was falling behind.</p><p>It was the time I was being pushed to slow down, reflect, and figure out where I want to go next.</p><p>For now, I just have to keep going.</p><p>If you’ve made it this far, I have one small request.</p><p>I’m still looking for my next opportunity as a Full Stack Developer. If you know of a team looking for someone with experience across React, Next.js, Node.js, databases, DevOps and mobile development, I’d genuinely appreciate an introduction, referral, or even just pointing me in the right direction.</p><p>And if you don’t have an opportunity to share, that’s completely okay too. Even sharing this post could help it reach someone who does.</p><p>You can reach me at <a href="/service/mailto:samad.saiyed.ss@gmail.com"><strong>samad.saiyed.ss@gmail.com</strong></a>.</p><p><em>Thank you for reading this far. I truly appreciate it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cef4406c777" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kickstart Your AI Journey: Essential Basics]]></title>
            <link>https://medium.com/@samad.saiyed.ss/kickstart-your-ai-journey-essential-basics-bd179c158365?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd179c158365</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 19:01:24 GMT</pubDate>
            <atom:updated>2025-09-17T19:01:24.016Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kickstart Your AI Journey: The Basics You Need to Get Ahead</h3><figure><img alt="Kickstart you AI Journey." src="https://cdn-images-1.medium.com/max/1024/1*tWS9z76CetfWLI0Lg4MiNA.png" /></figure><p>AI feels like a storm that everyone’s talking about — new models dropping every week, strange terms like <em>“tokens,”</em> <em>“vector databases,”</em> and <em>“fine-tuning”</em> being thrown around, and a sense that if you’re not already deep into it, you’re falling behind. It’s overwhelming, and honestly, it scares many people away before they even start.</p><p>But here’s the truth: you <strong>don’t need to train your own giant model</strong>, spend thousands on GPUs, or understand every buzzword to begin building something meaningful with AI. Just like you don’t need to know how to build a car engine to learn driving, you don’t need to dive into model training to start creating AI-powered apps.</p><p>In this guide, we’ll slow things down. We’ll strip away the jargon, explain concepts in plain human language, and walk through a real example (a simple textbook reader with question-answering). You’ll see how to connect the pieces together — lightweight models you can run <em>for free</em> on your laptop, a vector database, and a basic backend — without stress, confusion, or cost.</p><p>And here’s why this matters: having a <strong>clear understanding of these basics puts you ahead of most people</strong>. While many are still stuck in the noise, chasing hype or feeling intimidated, you’ll know how things <em>actually</em> work and how to start building right now. That kind of clarity is rare, and it gives you a real edge whether you’re a student, a developer, or someone just curious about AI.</p><p>Think of this as your <em>calm introduction to AI</em>: a way to finally make sense of what’s happening behind the scenes, so you can confidently join the conversation and, more importantly, start experimenting on your own.</p><h3>AI Terms Made Simple</h3><p>Before we dive in, let’s make sense of some words you’ll hear a lot:</p><ul><li><strong>Tokens</strong> → Imagine text as Lego blocks. A sentence gets broken into smaller pieces (tokens) before an AI can “read” it. More tokens = more cost/processing.</li><li><strong>Chunks</strong> → You can’t dump a whole book into an AI model. So we slice it into smaller parts (chunks), like dividing a textbook into paragraphs. Mostly it is done chapter wise and by each paragraph. Most standard approach is splitting a paragraph/text-block into 500 words (1 chunk).</li><li><strong>Embeddings</strong> → Think of these as <em>fingerprints for text</em>. They’re numbers that represent meaning. Two sentences with similar meaning will have embeddings close to each other. They’re a list of numbers that capture an item’s meaning. For example, the embedding for a picture of a cat and the embedding for the word “feline” will be very similar.</li><li><strong>Vector Database</strong> → This is just a specialized databases that store and quickly search these embeddings. Unlike a normal database that looks for exact matches (like the word “apple”), a vector database finds items that are <strong>conceptually similar</strong>, even if they’re not exactly the same.</li><li>In short, a vector database lets you search for things based on what they <strong>mean</strong>, not just what they’re called.</li></ul><blockquote>If you want to know more about VectorDB, (<a href="https://www.youtube.com/watch?v=72XgD322wZ8">click here</a>)</blockquote><p><strong>Why so many models?</strong></p><ul><li>Some are small and fast (run on your laptop).</li><li>Some are huge and powerful (need data centers).</li><li>Companies release models with different trade-offs (speed, cost, accuracy).</li><li>You don’t need them all — just pick one that fits your project.</li></ul><h3>The Bare Minimum Setup (Free &amp; Local)</h3><p>Here’s all you need to build your first AI app — without spending a rupee/dollar:</p><p><strong>Model:</strong> <a href="https://ollama.ai/">Ollama</a> running <strong>Phi-3</strong> (lightweight, runs locally).</p><p><strong>Vector DB:</strong> <a href="https://github.com/facebookresearch/faiss">FAISS</a> (free &amp; simple).</p><p><strong>Database:</strong> PostgreSQL (for book metadata).</p><p><strong>Backend:</strong> Python with <a href="https://fastapi.tiangolo.com/">FastAPI</a>.</p><p><strong>Frontend:</strong> Next.js (optional, just a chat screen calling APIs).</p><p>We’ll also use a <strong>job queue</strong> (like BullMQ or Celery) to process books in the background.</p><h3>Example: Building a Simple AI-Powered PDF Reader</h3><p>Let’s build a system that can read PDFs and answer questions from them.<br>I will also add some code snippets for better understanding</p><h3>1. Upload a Book</h3><p>When a user uploads a book, we create a record in Postgres:</p><pre># FastAPI route (simplified)<br>@app.post(&quot;/upload_book&quot;)<br>async def upload_book(file: UploadFile):<br>    book_id = str(uuid4())<br>    db.insert(&quot;books&quot;, {&quot;id&quot;: book_id, &quot;title&quot;: file.filename, &quot;status&quot;: &quot;processing&quot;})<br>    # send file to background queue for processing<br>    process_pdf.delay(book_id, file)<br>    return {&quot;book_id&quot;: book_id, &quot;message&quot;: &quot;Book is being processed&quot;}</pre><p>👉 The user immediately gets a response — no waiting for processing to finish.</p><h3>2. Process the Book (Background Job)</h3><p>Our background worker extracts text, chunks it, creates embeddings, and stores them in FAISS with a book_id.</p><pre>def process_pdf(book_id, file):<br>    text = extract_text_from_pdf(file)<br>    chunks = split_into_chunks(text, size=500)  # ~500 tokens<br>    for i, chunk in enumerate(chunks):<br>        vector = embedding_model.encode(chunk)<br>        faiss_index.add_with_ids([vector], [f&quot;{book_id}_{i}&quot;])<br>    db.update(&quot;books&quot;, book_id, {&quot;status&quot;: &quot;ready&quot;})</pre><h3>3. Show Processing Status</h3><p>Until embeddings are ready, the book shows up in Postgres as processing.<br> Users see: <em>“Your book is being processed, please check back in a minute.”</em></p><h3>4. Query a Book</h3><p>When the book is ready, the user can ask questions. We fetch <strong>only chunks from that book</strong> (using book_id), pass them into the model, and return the answer.</p><pre>@app.post(&quot;/ask&quot;)<br>async def ask(book_id: str, question: str):<br>    # fetch relevant chunks from FAISS<br>    vectors = embedding_model.encode([question])<br>    results = faiss_index.search(vectors, k=5)<br>    context = [get_chunk_text(res) for res in results if res.book_id == book_id]<br>    <br>    prompt = f&quot;Answer the question using the book:\n\n{context}\n\nQ: {question}\nA:&quot;<br>    answer = local_llm.generate(prompt)<br>    return {&quot;answer&quot;: answer}</pre><p>👉 By filtering with book_id, we:</p><ul><li>Prevent mixing different books.</li><li>Reduce CPU usage &amp; tokens.</li><li>Keep everything fast and cheap.</li></ul><p>Absolutely 👌 Let’s add a short, beginner-friendly explanation about <strong>splitting into chunks</strong> so readers understand what’s happening behind the scenes:</p><h3>How Splitting into Chunks Works</h3><p>When we process large documents (like PDFs), we can’t feed the entire text into an embedding model at once because:</p><ul><li>Models have <strong>token limits</strong> (they can only handle a certain amount of text).</li><li>Searching works better if we store smaller, meaningful text blocks.</li></ul><p>So, we break the text into <strong>chunks</strong> (e.g., ~500 tokens each).</p><p>There are different ways to do this:</p><p><strong>Simple string splitting</strong> — Just cut the text every 500 words/characters.</p><p><strong>Sentence/paragraph splitting</strong> — Keep sentences or paragraphs intact so the context makes sense.</p><p><strong>Sliding window (overlap)</strong> — Overlap some text between chunks (e.g., 50 tokens overlap) so ideas that span two chunks aren’t lost.</p><p>👉 Instead of writing your own function, you can use libraries that handle this for you:</p><p><strong>LangChain</strong> → RecursiveCharacterTextSplitter (smartly splits while preserving meaning).</p><p><strong>LlamaIndex</strong> → Has built-in text splitters optimized for embeddings.</p><p><strong>Example with LangChain:</strong></p><pre>from langchain.text_splitter import RecursiveCharacterTextSplitter</pre><pre>text_splitter = RecursiveCharacterTextSplitter(<br>    chunk_size=500,<br>    chunk_overlap=50<br>)</pre><pre>chunks = text_splitter.split_text(text)</pre><p>This way, you get a list of overlapping chunks that are model-friendly and context-preserving.</p><h3>Optimization Techniques</h3><p><strong>Chunk smartly</strong> → Too small = noisy, too big = costly. 400–600 tokens works well.</p><p><strong>Cache frequent queries</strong> → Save embeddings or answers for popular questions.</p><p><strong>Summarize context</strong> → If too many chunks, summarize before feeding to the model.</p><p><strong>Use small models first</strong> → Phi-3, Mistral 7B, etc. are great for local dev.</p><h3>Why This Approach Works</h3><p><strong>Free to start</strong> → Runs locally with open-source tools.</p><p><strong>Practical</strong> → You’ll understand how embeddings, vector DBs, and models connect.</p><p><strong>Scalable</strong> → Later you can add multi-book search, citations, or cloud models.</p><h3>Closing Thoughts</h3><p>AI sounds scary when you hear terms like <em>fine-tuning, embeddings, vector search, or models</em>. But at the base level, it’s just about breaking text into pieces, storing it smartly, and letting a model use that context to answer.</p><p>You don’t need a giant budget or months of research. You just need curiosity, a laptop, and some free tools.</p><p>Start small, build something useful (like this PDF reader), and you’ll already be ahead of most people still just reading about AI hype.</p><p><em>And if you try this out and get stuck — reach out. I’d be happy to help.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd179c158365" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tanstack Query Deep Dive: Features Most Devs Don’t Know]]></title>
            <link>https://medium.com/@samad.saiyed.ss/tanstack-query-deep-dive-features-most-devs-dont-know-18c8e7c42488?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/18c8e7c42488</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[tanstack-query]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 16:51:35 GMT</pubDate>
            <atom:updated>2025-06-27T16:51:35.678Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re building React apps and still manually managing your data fetching with useEffect and useState, it&#39;s time you met <a href="https://tanstack.com/query/latest"><strong>TanStack Query</strong></a> (commonly known as <strong>React Query</strong>). It’s one of those libraries you didn’t realize you desperately needed — until you use it.</p><p>Let’s dig into what it does, why it’s valuable, and uncover some lesser-known gems hidden in this powerful toolset.</p><figure><img alt="Tanstack Query and its hidden features" src="https://cdn-images-1.medium.com/max/1024/1*C2I0ackZ7EQnjTBGvXnFfg.png" /><figcaption>Tanstack Query and its hidden features</figcaption></figure><h3>🎯 What is TanStack Query (React Query)?</h3><p><a href="https://tanstack.com/query/latest"><strong>TanStack Query</strong></a> is a data-fetching and state management library for React and other frameworks (like Solid, Vue, and Svelte). It focuses solely on managing server-state — data that lives on a remote server and is accessed via API calls.</p><p>Where libraries like Redux manage local client state, <strong>React Query</strong> acts as your middleman for API requests, caching, background updates, and state synchronization. It’s like a smart remote data cache and synchronization manager for your app.</p><h3>🚀 Why Use React Query?</h3><p>A few problems developers often run into:</p><ul><li>Re-fetching data on page reloads or navigation</li><li>Managing multiple states: isLoading, isError, data</li><li>Caching and stale data control</li><li>Data synchronization between components</li><li>Handling background updates</li><li>Pagination, infinite scroll management</li><li>Avoiding over-fetching</li></ul><p><strong>React Query</strong> handles all of this out of the box — and then some.</p><h3>✨ Hidden Features &amp; Things Most People Don’t Use</h3><p>Here’s where it gets interesting. React Query has a treasure chest of features many devs don’t tap into:</p><h3>🔄 Query Refetch on Window Focus or Network Reconnect</h3><p>By default, React Query can automatically refetch your data if:</p><ul><li>The browser window regains focus</li><li>The device reconnects to the network</li></ul><p><strong>Why it’s useful:</strong><br>Keeps your data fresh and synchronized without manual intervention.</p><pre>useQuery([&#39;user&#39;], fetchUser, {<br>  refetchOnWindowFocus: true,<br>  refetchOnReconnect: true,<br>}); // You do not need to write this, it is true by default!</pre><h3>🕰️ Stale Time &amp; Cache Time Control</h3><p>You can finely tune how long data stays “fresh” before being considered stale and how long it remains in the cache after unmount.</p><pre>useQuery([&#39;posts&#39;], fetchPosts, {<br>  staleTime: 1000 * 60 * 5, // 5 minutes<br>  cacheTime: 1000 * 60 * 30, // 30 minutes<br>});</pre><p><strong>Why it’s useful:</strong><br> Reduces unnecessary API calls and optimizes app performance.</p><p>For beginners, caching the data means storing the fetched API response in memory so it can be quickly reused without making a new network request, until it becomes stale or is explicitly invalidated.</p><h3>📌 Query Invalidation</h3><p>A superpower feature — you can mark specific queries as invalid and force a refetch when needed.</p><p>Example: After updating a user’s profile, invalidate the user query.</p><pre>const queryClient = useQueryClient();<br>queryClient.invalidateQueries([&#39;user&#39;]);</pre><p><strong>Why it’s useful:</strong><br> Keeps related data in sync after mutations or external changes.</p><h3>📑 Dependent Queries (Query Chaining)</h3><p>Sometimes, one query depends on the result of another. React Query supports this elegantly.</p><pre>const { data: user } = useQuery([&#39;user&#39;], fetchUser);<br>const { data: posts } = useQuery(<br>  [&#39;posts&#39;, user?.id],<br>  () =&gt; fetchPostsByUser(user.id),<br>  { enabled: !!user }<br>);</pre><p><strong>Why it’s useful:</strong><br> No need to manage complex conditional logic or useEffect chains.</p><h3>📉 Query Cancellation</h3><p>Abort ongoing API calls if no longer needed (like on unmount or navigating away).</p><p>If your fetcher supports AbortController, React Query will handle it.</p><pre>const fetchPosts = ({ signal }) =&gt;<br>  fetch(&#39;/api/posts&#39;, { signal }).then(res =&gt; res.json());</pre><p><strong>Why it’s useful:</strong><br> Prevents race conditions and memory leaks.</p><h3>📦 Persistent Cache (LocalStorage / IndexedDB)</h3><p>You can persist your query cache to <strong>localStorage</strong>, <strong>sessionStorage</strong>, or <strong>IndexedDB</strong> using the <a href="https://tanstack.com/query/v5/docs/react/plugins/persistQueryClient">persistQueryClient</a> plugin.</p><pre>import { persistQueryClient } from &#39;@tanstack/react-query-persist-client&#39;;</pre><pre>persistQueryClient({<br>  queryClient,<br>  persistor: localStoragePersistor,<br>});</pre><p><strong>Why it’s useful:</strong><br>Offline-first apps and cache restoration after reloads.</p><h3>📊 Devtools Integration</h3><p>An incredibly useful dev tool comes with it:</p><pre>npm install @tanstack/react-query-devtools</pre><p>Then in your app:</p><pre>import { ReactQueryDevtools } from &#39;@tanstack/react-query-devtools&#39;;</pre><pre>&lt;ReactQueryDevtools initialIsOpen={false} /&gt;</pre><p><strong>Why it’s useful:</strong><br>See active queries, cache state, refetch timings, etc., live.</p><h3>🛑 Selective Mutation Rollbacks</h3><p>React Query allows for optimistic updates with rollback on failure.</p><pre>useMutation(updateTodo, {<br>  onMutate: async newTodo =&gt; {<br>    await queryClient.cancelQueries([&#39;todos&#39;]);<br>    const previousTodos = queryClient.getQueryData([&#39;todos&#39;]);<br>    queryClient.setQueryData([&#39;todos&#39;], old =&gt; [...old, newTodo]);<br>    return { previousTodos };<br>  },<br>  onError: (err, newTodo, context) =&gt; {<br>    queryClient.setQueryData([&#39;todos&#39;], context.previousTodos);<br>  },<br>  onSettled: () =&gt; {<br>    queryClient.invalidateQueries([&#39;todos&#39;]);<br>  },<br>}); // this seem a bunch of jargon, but trust me this shit rocks!!</pre><p><strong>Why it’s useful:</strong><br>Better UX with instant UI updates and graceful error handling.</p><h3>📖 Infinite Queries</h3><p>For infinite scroll or paginated APIs, useInfiniteQuery is a lifesaver.</p><pre>useInfiniteQuery([&#39;projects&#39;], fetchProjects, {<br>  getNextPageParam: (lastPage) =&gt; lastPage.nextCursor,<br>});</pre><p><strong>Why it’s useful:</strong><br>Simplifies infinite scroll logic, managing all the pagination state internally.</p><h3>🎁 Benefits Recap</h3><p>✅ Eliminate repetitive useState + useEffect for data fetching<br> ✅ Built-in caching, refetching, and background updates<br> ✅ Avoid stale data issues<br> ✅ Automatically handle loading/error states<br> ✅ Powerful devtools<br> ✅ Works beautifully with SSR (Next.js)<br> ✅ Extensible with plugins for persistence, offline, etc.</p><h3>🛠️ Should You Use It?</h3><p>If your React app involves any remote data — and you want clean, scalable, performant, and predictable data fetching — <strong>React Query should absolutely be your go-to tool.</strong></p><p>The more you dig, the more you’ll appreciate its thoughtful API design and powerful under-the-hood capabilities.</p><h3>📣 Final Thoughts</h3><p><strong>TanStack React Query</strong> is one of those libraries that quietly does a ton of heavy lifting in modern apps. While most people stick to its basic useQuery and useMutation hooks, there’s a goldmine of features that can drastically improve your codebase’s reliability and developer experience.</p><p>If you haven’t given it a proper spin yet — <strong>now’s the time</strong>.</p><h3>📌 What Did I Miss?</h3><p>If you’ve discovered any other lesser-known React Query features, optimizations, or hidden gems, drop them in the comments! Would love to learn what clever uses you’ve found.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18c8e7c42488" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Learned Next.js, Node.js, REST APIs, MongoDB & Postgres — What’s Next?]]></title>
            <link>https://medium.com/@samad.saiyed.ss/i-learned-next-js-node-js-rest-apis-mongodb-postgres-whats-next-92d12d57e5c0?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/92d12d57e5c0</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[full-stack]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 16:30:06 GMT</pubDate>
            <atom:updated>2025-06-27T16:31:44.443Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>I Learned Next.js, Node.js, REST APIs, MongoDB &amp; Postgres — What’s Next?</strong></h3><p>A few months ago, I was exactly where you might be right now. I’d picked up <strong>Next.js</strong> for building slick, SEO-friendly frontends. I got comfortable writing <strong>Node.js</strong> APIs, connected them to <strong>MongoDB</strong> and <strong>PostgreSQL</strong> databases, and even learned to deploy everything to a basic VPS or services like Vercel and Railway.<br>But then came the question:</p><blockquote><strong><em>“How do I make my app production-grade?”</em></strong></blockquote><p>Learning a tech stack is just the start — running a real-world, high-traffic app introduces new challenges. Things like caching, background job processing, rate limiting, and reliable deployment pipelines start to matter.</p><figure><img alt="Ladder to success after a being a beginner" src="https://cdn-images-1.medium.com/max/1024/1*pLn6bInHLj0AbFTL8DIbVA.png" /></figure><p>So in this post, I’ll walk you through the <strong>next steps after mastering the basics</strong>, and introduce you to beginner-friendly DevOps concepts and scalable system patterns you should gradually explore.</p><h3>🚀 What Comes After CRUD &amp; Deployments?</h3><p>Once your product starts gaining users, you’ll realize you can’t treat every request equally, or store everything in a single database forever. Performance and reliability matter. Here’s where things start getting interesting:</p><h3>🔹 Caching 101</h3><p><strong>Caching</strong> is one of the simplest and most effective ways to make your applications faster.</p><h3>Why Cache?</h3><ul><li>Avoid repetitive database queries</li><li>Reduce server load</li><li>Serve faster responses to users</li></ul><h3>Tools to Start With:</h3><p><strong>Redis:</strong> an in-memory key-value store, super fast, perfect for caching frequently requested data like homepage content, product listings, or user sessions.</p><p><strong>Node-cache:</strong> a lightweight in-process caching library for Node.js (good for small apps).</p><blockquote><em>We wont go too deep into Redis, but if you want to learn I have a blog on it </em><a href="https://medium.com/@samad.saiyed.ss/redis-explained-like-a-5-year-old-speed-atomic-operations-and-real-benefits-491d54608337"><em>right here</em></a></blockquote><p><strong>Example Use Case:<br></strong>Cache product categories for an e-commerce app that don’t change often.</p><h3>🔹 Background Job Queues</h3><p>When you need to perform <strong>time-consuming tasks asynchronously</strong> — like sending emails, generating reports, or processing payments — you shouldn’t block your API response.</p><h3>Enter: Job Queues</h3><h3>Tools:</h3><ul><li><strong>BullMQ:</strong> A Node.js job queue backed by Redis. Great for handling background tasks and retries.</li><li><strong>Agenda:</strong> Another job scheduler for Node, works well with MongoDB.</li></ul><p><strong>Example Use Case:<br></strong>A user uploads an image. You immediately respond with “Upload received!” while the image optimization and storage happen in the background via a queue.</p><h3>🔹 Scalable Application Structure</h3><p>When your app grows, structuring code in a maintainable, scalable way is essential.</p><h3>Concepts to Explore:</h3><ul><li><strong>Modularizing routes, services, and controllers</strong></li><li><strong>Environment-specific configurations</strong></li><li><strong>Separation of concerns (SoC)</strong></li><li><strong>Service-oriented or microservices architecture (if needed later)</strong></li></ul><h3>🔹 API Rate Limiting &amp; Throttling</h3><p>To protect your app from abuse and accidental server overload.</p><h3>Tools:</h3><ul><li><strong>express-rate-limit</strong></li><li><strong>Redis-backed rate limiting for distributed servers</strong></li></ul><p><strong>Example Use Case:</strong><br>Limit free-tier users to 100 API calls per day.</p><h3>🔹 <strong>Monitoring, Logging &amp; Error Handling</strong></h3><p>Know what’s happening in your app, even when you’re asleep.</p><h3>Tools:</h3><ul><li><strong>Winston / Pino:</strong> For structured server logs.</li><li><strong>PM2:</strong> Process manager for Node.js, restarts crashed apps and offers basic monitoring.</li><li><strong>Sentry:</strong> Error monitoring for both frontend and backend.</li></ul><h3>🔹 Basic CI/CD Concepts</h3><p>Automate deployments and testing so your updates reach users reliably.</p><h3>Beginner-Friendly Services:</h3><ul><li><strong>GitHub Actions:</strong> Free, easy to set up.</li><li><strong>Vercel / Netlify for frontend CI/CD</strong></li><li><strong>Railway / Render for backend CI/CD</strong></li></ul><h3>🔹 Next Step DevOps Tools You’ll Eventually Want to Learn</h3><p><em>(Once you get comfortable with the basics above)</em></p><ul><li><strong>Docker:</strong> Containerize your apps</li><li><strong>Nginx:</strong> For reverse proxy and load balancing</li><li><strong>Kubernetes:</strong> For orchestrating containerized apps at scale</li><li><strong>Grafana &amp; Prometheus:</strong> For advanced monitoring and metrics</li></ul><h3>📌 Closing Thoughts</h3><p>If you’ve mastered <strong>Next.js</strong>, <strong>Node.js</strong>, <strong>REST APIs</strong>, <strong>MongoDB</strong>, and <strong>PostgreSQL</strong>, the next natural step isn’t just learning more frameworks — it’s about making your applications reliable, fast, and scalable.</p><p>Start small:</p><ul><li>Add caching with Redis</li><li>Introduce a job queue</li><li>Structure your APIs cleanly</li><li>Set up logging and basic monitoring</li></ul><p>This is where development meets operations — the DevOps layer of modern web development.</p><h3>✨ Your Turn</h3><p>If you’re already using any of these tools or have other ideas on what developers should explore after mastering the basics — <strong>drop a comment below! Would love to hear your stack and approach.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92d12d57e5c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoid These Critical Web App Security Mistakes in Your Next Project]]></title>
            <link>https://medium.com/@samad.saiyed.ss/avoid-these-critical-web-app-security-mistakes-in-your-next-project-5f16edaec4e0?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f16edaec4e0</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[web-app-security]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 17:23:00 GMT</pubDate>
            <atom:updated>2025-06-21T17:23:00.580Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tFWoaCa6L39Eg99S" /><figcaption>Photo by <a href="https://unsplash.com/@blakeconnally?utm_source=medium&amp;utm_medium=referral">Blake Connally</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the rush to ship features and meet deadlines, security is often an afterthought for many web developers. The truth is, no matter how sleek your UI is or how fast your APIs perform, one overlooked vulnerability can expose your entire application and user base to attackers.</p><p>Even in 2025, many developers — both junior and experienced — still fall into the same security traps. In this post, let’s walk through the most common web app security mistakes developers make, why they matter, and how you can fix them today.</p><h3>1️⃣ Leaving API Keys &amp; Secrets in the Frontend</h3><p><strong>The Mistake:</strong><br>Hardcoding API keys or sensitive tokens directly in frontend code, or accidentally shipping .env.local files to production.</p><p><strong>Why It’s Risky:</strong><br>Frontend code is publicly visible. Anything bundled inside can be inspected and exploited.</p><p><strong>How to Fix It:</strong></p><ul><li>Store secrets on the server or as environment variables.</li><li>Use secure backend endpoints to proxy sensitive API requests.</li><li>Leverage environment-specific configurations like <a href="https://vercel.com/">Vercel </a>or <a href="https://www.netlify.com/">Netlify </a>environment variables.</li></ul><h3>2️⃣ Not Protecting Against CSRF (Cross-Site Request Forgery)</h3><p><strong>The Mistake:</strong><br>Assuming modern single-page apps (SPAs) are safe from CSRF attacks.</p><p><strong>Why It’s Risky:</strong><br>If your app uses cookies for authentication, attackers can trick users into performing unintended actions.</p><p><strong>How to Fix It:</strong></p><ul><li>Implement anti-CSRF tokens on sensitive requests.</li><li>Use SameSite cookie attributes (Strict or Lax) for authentication cookies.</li><li>Avoid using JWT in localStorage for highly sensitive applications.</li></ul><p>Remember storing tokens in localStorage is an old concept, beginners in web development usually do this mistake of storing crucial information in local storage</p><blockquote>You might ask, “<em>What is the problem with that?”, </em>and to answer it very simply, localStorage can be accessed by console, going to developer tools-&gt; Application and can be copied/altered/deleted!</blockquote><h3>3️⃣ Improper CORS Configurations</h3><p><strong>The Mistake:</strong><br>Using Access-Control-Allow-Origin: * in production or failing to configure CORS rules properly.</p><p><strong>Why It’s Risky:</strong><br> It allows any website to interact with your APIs, potentially stealing tokens or sensitive data.</p><p><strong>How to Fix It:</strong></p><ul><li>Whitelist trusted origins explicitly.</li><li>Differentiate between development and production CORS settings.</li><li>Use security middleware like cors in Express or Next.js custom API handlers.</li></ul><h3>4️⃣ Insecure Authentication &amp; Session Handling</h3><p><strong>The Mistake:</strong><br>Weak password policies, storing sensitive tokens unsafely, or using JWT without expiration controls.</p><p><strong>Why It’s Risky:</strong><br>Makes it easy for attackers to brute-force, steal, or replay authentication tokens.</p><p><strong>How to Fix It:</strong></p><ul><li>Hash passwords securely with <a href="https://www.npmjs.com/package/bcrypt">bcrypt</a> or <a href="https://www.npmjs.com/package/argon2">argon2</a>.</li><li>Prefer HTTP-only, SameSite cookies for session management.</li><li>Always set token expiries and consider implementing token rotation.</li></ul><blockquote>Mostly the token rotation time is set between 5–15 minutes.<br>Want to know more about token rotation, follow me! I will be posting next on tokens and how to secure tokens. It will also cover the concept of tokens if anyone of my friends here is new to web development. 😉</blockquote><h3>5️⃣ Open Redirect Vulnerabilities</h3><p><strong>The Mistake:</strong><br>Allowing arbitrary redirects after login or other actions based on user-provided URLs.</p><p><strong>Why It’s Risky:</strong><br>Attackers can redirect users to malicious websites.</p><p><strong>How to Fix It:</strong></p><ul><li>Validate redirect URLs against a safe allowlist.</li><li>Avoid using open redirect= query parameters without validation.</li></ul><h3>6️⃣ Relying Solely on Client-Side Validation</h3><p><strong>The Mistake:</strong><br>Trusting your frontend form validation without enforcing checks server-side.</p><p><strong>Why It’s Risky:</strong><br>Attackers can bypass client-side validation and send malicious data directly to your backend.</p><p><strong>How to Fix It:</strong></p><ul><li>Always perform server-side validation using libraries like <a href="https://www.npmjs.com/package/validator">validator.js</a>, <a href="https://www.npmjs.com/package/zod">zod</a>, or built-in validation tools.</li><li>Sanitize inputs to prevent XSS and injection attacks.</li></ul><blockquote>I would highly recommend using Zod as with the latest v4 it’s faster, slimmer, more tsc-efficient, and implements some long-requested features.</blockquote><h3>7️⃣ Insecure File Upload Handling</h3><p><strong>The Mistake:</strong><br>Allowing file uploads without proper validation of type, size, or content.</p><p><strong>Why It’s Risky:</strong><br>Attackers can upload malicious scripts disguised as harmless files.</p><p><strong>How to Fix It:</strong></p><ul><li>Validate file MIME types and extensions server-side.</li><li>Limit maximum file size.</li><li>Store files in cloud storage services with signed URLs and restricted access.</li></ul><h3>8️⃣ Over-Permissive Caching</h3><p><strong>The Mistake:</strong><br>Accidentally caching authenticated pages or sensitive API responses.</p><p><strong>Why It’s Risky:</strong><br>Leads to exposure of private data across users.</p><p><strong>How to Fix It:</strong></p><ul><li>Set proper Cache-Control headers like no-store or private for protected routes.</li><li>Configure CDN and reverse proxy caching rules carefully.</li></ul><blockquote>If you are using <strong><em>@tanstack/query</em></strong> this issue is very common, you have to set userID as a dependency to prevent using a different users cache results!<br>If you do not know what tanstack query is and how to effectively use it, follow me I will share how to make perfect use of swr!</blockquote><h3>9️⃣ Ignoring Rate Limiting &amp; Brute-Force Protections</h3><p><strong>The Mistake:</strong><br>Leaving login forms and API routes open to unlimited requests.</p><p><strong>Why It’s Risky:</strong><br>Allows attackers to brute-force credentials or overwhelm your API.</p><p><strong>How to Fix It:</strong></p><ul><li>Implement rate limiting using middleware like express-rate-limit.</li><li>Use CDN-level protections such as Cloudflare Rules or Vercel Edge Middleware.</li></ul><h3>🔟 Not Using Essential HTTP Security Headers</h3><p><strong>The Mistake:</strong><br>Neglecting to set important security headers.</p><p><strong>Why It’s Risky:</strong><br>Leaves your application vulnerable to XSS, clickjacking, and data sniffing.</p><p><strong>How to Fix It:</strong></p><ul><li>Use helmet middleware in Express or set headers in Next.js custom server configurations.</li></ul><p><strong>Recommended headers:</strong></p><ul><li><em>Content-Security-Policy</em></li><li><em>Strict-Transport-Security</em></li><li><em>X-Frame-Options</em></li><li><em>X-Content-Type-Options</em></li><li><em>Referrer-Policy</em></li></ul><blockquote>Setting custom headers can be a little tricky of apps running on purely ReactJS (i.e. create-react-app). There are various ways to do it based on how you deploy your app. You can <a href="https://medium.com/kristiyan-velkov/react-js-security-best-practices-37ebe38ee1c2">read this article</a>.</blockquote><h3>📌 Bonus Tip: Regularly Run Security Scans</h3><p>Make it a habit to scan your app for known vulnerabilities using tools like:</p><ul><li><a href="https://snyk.io/"><em>Snyk</em></a></li><li><a href="https://www.zaproxy.org/"><em>OWASP ZAP</em></a></li><li><em>Lighthouse Security Audits (learn more about it </em><a href="https://www.debugbear.com/blog/lighthouse-performance-audits"><em>here</em></a><em>)</em></li></ul><h3>💭✅ Final Thoughts</h3><p>Most security flaws aren’t complex hacks — they’re simple oversights. By actively checking for these vulnerabilities before going live, you’ll protect both your app and your users from avoidable risks.</p><p><strong>Do a quick audit of your project today — I guarantee you’ll spot a couple of these mistakes.</strong> 🔍</p><p><strong>Enjoyed this post? Bookmark it for your next project’s deployment checklist.</strong></p><h3>💬 Share Your Tips &amp; Experiences!</h3><p>Security is a moving target — and no single post can cover everything. I’d love to hear from you:</p><p>👉 Did I miss any important security practices you swear by?<br>👉 Faced any tricky security issues in your recent projects?</p><p><strong>Drop your tips, lessons learned, or horror stories in the comments!</strong> Let’s turn this post into a helpful resource for the entire developer community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f16edaec4e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis Explained Like a 5-Year-Old: Speed, Atomic Operations, and Real Benefits]]></title>
            <link>https://medium.com/@samad.saiyed.ss/redis-explained-like-a-5-year-old-speed-atomic-operations-and-real-benefits-491d54608337?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/491d54608337</guid>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[scaling]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Sat, 14 Jun 2025 12:04:54 GMT</pubDate>
            <atom:updated>2025-06-14T12:04:54.797Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A person trying to buy something online which has limited stock" src="https://cdn-images-1.medium.com/max/1024/0*f6abTNLsL4ZLUELI" /><figcaption>Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=medium&amp;utm_medium=referral">Campaign Creators</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever wondered how big apps like Uber, Netflix, or Instagram load things so quickly? or have you ever shopped during a big sale — like a midnight flash sale from a popular clothing brand — and wondered how their website manages to keep up with thousands of people trying to buy the same limited items at the same time?</p><p>Well, behind the scenes, a smart little tool called <strong>Redis</strong> often helps out. In this blog, I’ll explain what Redis is, how it works, and why it’s insanely fast — in the simplest way possible. No technical jargon, no confusing terms. Just plain, beginner-friendly explanations.</p><h3>📖1️⃣ What is Redis? (In Simple Terms)</h3><p>Redis is like a <strong>super-speedy notepad</strong> in your computer’s memory.</p><p>You can quickly:</p><ul><li>Write things down.</li><li>Look them up.</li><li>Erase them.</li></ul><p>It stores data in <strong>key-value pairs</strong>, like:</p><p>🗝️ <em>“stock:leather-jacket”</em>: 📝 <em>“25”</em></p><p>And since it lives in your computer’s <strong>RAM</strong> (the super-fast temporary memory), it’s much quicker than using a normal database that saves things to a hard disk.</p><p>And when someone buys one, you just subtract 1 from the stock count.</p><h3>📖2️⃣ What is Atomic in Redis?</h3><p>Here’s where Redis gets clever.</p><p>The word <strong>atomic</strong> in Redis means:</p><blockquote><em>Either a task fully happens, or it doesn’t happen at all. No in-between.</em></blockquote><p>Think of it like:</p><ul><li>If you say <em>“Add 1 to my points”</em>, Redis will either do it completely, or not do it at all — but it won’t mess up halfway.</li><li>It ensures your data doesn’t get mixed up when many people are using it at the same time.</li></ul><p><strong>Why it matters:</strong></p><ul><li>Imagine two people ordering the last slice of pizza at the same time.</li><li>Redis makes sure one gets it, and the other gets a clear message — without confusion.</li></ul><h3>📖3️⃣ How Fast is Redis?</h3><p>Redis can handle <strong><em>over a million operations per second</em></strong> on an average machine.</p><p>That means it can:</p><ul><li>It can save your hoodie order.</li><li>Check if an item is in stock.</li><li>Reduce the count when it’s bought.</li><li>Remove expired sale items.</li></ul><p>This is because:</p><ul><li>It works directly in RAM (like reading from a scratchpad instead of a book)</li><li>Its operations are atomic — so no waiting in line for who’s first.</li></ul><h3>📖4️⃣ What Do People Use Redis For?</h3><p>In simple terms:</p><ul><li><strong>Saving things temporarily</strong> so apps don’t have to keep looking them up in slow databases.</li><li><strong>Making apps faster</strong> by reducing wait time.</li><li><strong>Storing real-time info</strong> like game scores, chat messages, or online user counts.</li><li><strong>Managing session info</strong> like remembering you’re logged in.</li></ul><p><strong><em>Without Redis:</em></strong></p><ul><li>You request your profile → Server asks database → Response (slow)</li></ul><p><strong><em>With Redis:</em></strong></p><ul><li>You request your profile → Redis gives the answer instantly (fast!)</li></ul><h3>📖5️⃣ Is Redis a Database?</h3><p>People new to redis often ask this question, and the simplest answer is Kind of — but a special one:</p><ul><li>Regular databases are like libraries.</li><li>Redis is like a <strong>whiteboard you can write and erase on instantly.</strong></li><li>Perfect for things you need right now and can delete later.</li></ul><h3>👕 Real-World Example: Clothing Brand Big Sale</h3><p>Let’s make it even clearer.<br><strong>Scenario: Midnight Sale</strong></p><p>A clothing brand puts <strong>500 limited-edition T-shirts</strong> on sale.<br>Within the first minute, <strong>10,000 people</strong> try to buy them.</p><p><strong>Without Redis:</strong></p><ul><li>Every time someone clicks “Add to Cart,” the system asks the main database.</li><li>The database struggles to respond to thousands of requests.</li><li>Stock counts get messed up.</li><li>Some people pay for a product already sold out.</li><li>Angry customers, refund issues, and a ruined sale.</li></ul><p><strong>With Redis:</strong></p><ul><li>Redis keeps the current stock count in memory.</li><li>Every time someone clicks “Buy Now,” Redis instantly checks and updates the stock.</li><li>No two people can buy the same last item, because the stock number is <strong>atomically reduced</strong>. <em>(It happens so instantly, that once you use it you will come to know !! )</em></li><li>The website stays fast and responsive, even with tens of thousands of users.</li></ul><p>This is one of the biggest reasons major online stores, ticketing platforms, and gaming apps use Redis during heavy traffic situations.</p><h3>Conclusion</h3><p>Redis is a super-fast, memory-based helper that makes apps quicker, smarter, and more reliable — especially during high-pressure situations like flash sales or viral events.</p><p>Thanks to its <strong>atomic operations</strong>, it keeps data clean and correct, even when thousands of people hit your website at once. And with the ability to handle <strong>over a million operations per second</strong>, it’s no wonder some of the biggest apps in the world rely on it.</p><p>If you’re a beginner or someone curious about how big websites manage insane amounts of traffic without breaking down — <strong>Redis is one of the secret ingredients.</strong></p><h3>📣 Your Turn</h3><ul><li>Try installing Redis on your machine. (<em>You can use free services like Upstash to host a redis server)</em></li><li>Play with simple key-value pairs.</li><li>You’ll be surprised how simple &amp; blazingly fast it feels once you use it.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=491d54608337" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Next.js 15.3 Authentication & Authorization: Mastering Middleware for Secure Access Control]]></title>
            <link>https://medium.com/@samad.saiyed.ss/next-js-15-3-authentication-authorization-mastering-middleware-for-secure-access-control-e8ac149a8682?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8ac149a8682</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Sat, 24 May 2025 13:07:49 GMT</pubDate>
            <atom:updated>2025-05-24T13:08:21.021Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R9Y43mBnmhrdOJQ_cRuN8Q.png" /></figure><p>In the ever-evolving landscape of web development, securing your Next.js applications is paramount. With the introduction of Next.js 15.3, developers have powerful tools at their disposal to implement robust authentication and authorization mechanisms. This guide delves into leveraging middleware to control access to specific pages based on conditions like user login status.</p><h3>🚪 Understanding Authentication vs. Authorization</h3><p>Before diving into implementation, it’s crucial to distinguish between authentication and authorization:</p><ul><li><strong>Authentication</strong>: Verifies the identity of a user. It’s the process of confirming that someone is who they claim to be, typically through login credentials.</li><li><strong>Authorization</strong>: Determines what an authenticated user is allowed to do. It controls access to resources based on permissions.</li></ul><p>In Next.js 15.3, middleware plays a pivotal role in enforcing these security measures. [<a href="https://vercel.com/blog/postmortem-on-next-js-middleware-bypass?utm_source=chatgpt.com">Vercel</a>]</p><h3>🧰 Leveraging Middleware in Next.js 15.3</h3><p>Middleware in Next.js allows you to run code before a request is completed. This capability is instrumental in implementing authentication and authorization checks.</p><h4>🔧 Setting Up Middleware</h4><p>Create a middleware.ts file at the root of your project:</p><pre>// middleware.ts<br>import { NextResponse } from &#39;next/server&#39;;<br>import type { NextRequest } from &#39;next/server&#39;;<br><br>export function middleware(request: NextRequest) {<br>  const token = request.cookies.get(&#39;auth_token&#39;)?.value;<br><br>  if (!token) {<br>    return NextResponse.redirect(new URL(&#39;/login&#39;, request.url));<br>  }<br><br>  return NextResponse.next();<br>}</pre><p>This middleware checks for the presence of an auth_token cookie. If absent, it redirects the user to the login page.</p><h4>🎯 Targeting Specific Routes</h4><p>To apply middleware to specific routes, use the matcher configuration:</p><pre>// middleware.ts<br>export const config = {<br>  matcher: [&#39;/dashboard/:path*&#39;, &#39;/admin/:path*&#39;],<br>};</pre><p>This configuration ensures that the middleware runs only on the /dashboard and /admin routes.</p><h3>🔐 Implementing Role-Based Access Control (RBAC)</h3><p>For more granular control, implement RBAC to restrict access based on user roles.</p><h4>🛠️ Middleware with Role Checks</h4><pre>// middleware.ts<br>import { NextResponse } from &#39;next/server&#39;;<br>import type { NextRequest } from &#39;next/server&#39;;<br><br>export function middleware(request: NextRequest) {<br>  const token = request.cookies.get(&#39;auth_token&#39;)?.value;<br><br>  if (!token) {<br>    return NextResponse.redirect(new URL(&#39;/login&#39;, request.url));<br>  }<br><br>  const userRole = getUserRoleFromToken(token); // Implement this function to extract role from token<br><br>  const url = request.nextUrl.pathname;<br><br>  if (url.startsWith(&#39;/admin&#39;) &amp;&amp; userRole !== &#39;admin&#39;) {<br>    return NextResponse.redirect(new URL(&#39;/unauthorized&#39;, request.url));<br>  }<br><br>  return NextResponse.next();<br>}</pre><p>In this example, users without the ‘admin’ role are redirected away from the /admin route.</p><h3>🚨 Addressing Security Vulnerabilities</h3><p>Recent reports have highlighted a critical vulnerability (CVE-2025–29927) in Next.js middleware, allowing attackers to bypass authorization checks by manipulating the x-middleware-subrequest header. [<a href="https://checkmarx.com/zero-post/critical-cve-2025-29927-research-nextjs-middleware-authorization-bypass/?utm_source=chatgpt.com">link</a>]</p><h4>🛡️ Mitigation Strategies</h4><p><strong>Upgrade Next.js</strong>: Ensure you’re using version 15.2.3 or later, where the vulnerability is patched. [<a href="https://news.ycombinator.com/item?id=43448723&amp;utm_source=chatgpt.com">Hacker News</a>]</p><ul><li><strong>Validate Headers</strong>: Implement checks to ignore or sanitize unexpected headers like x-middleware-subrequest.</li><li><strong>Use Server-Side Checks</strong>: Complement middleware checks with server-side validations to ensure security.</li></ul><h3>🧪 Testing and Validation</h3><p>Regularly test your authentication and authorization flows:</p><ul><li><strong>Unit Tests</strong>: Write tests for your middleware functions to ensure they behave as expected.</li><li><strong>Integration Tests</strong>: Simulate user interactions to validate the entire authentication flow.</li><li><strong>Security Audits</strong>: Periodically audit your application for vulnerabilities and keep dependencies up to date.</li></ul><h3>📚 Further Resources</h3><ul><li><a href="https://nextjs.org/docs/app/guides/authentication">Next.js Authentication Guide</a></li><li><a href="https://nextjs.org/docs/app/building-your-application/routing/middleware">Next.js Middleware Documentation</a></li><li><a href="https://checkmarx.com/zero-post/critical-cve-2025-29927-research-nextjs-middleware-authorization-bypass/">CVE-2025–29927 Vulnerability Report</a></li></ul><p>By effectively utilizing middleware in Next.js 15.3, you can implement robust authentication and authorization mechanisms, ensuring that your application remains secure and user-friendly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8ac149a8682" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is the Next.js Era Finally Over? Not So Fast]]></title>
            <link>https://medium.com/@samad.saiyed.ss/is-the-next-js-era-finally-over-not-so-fast-e778c00839d9?source=rss-1ff625a3100f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e778c00839d9</guid>
            <category><![CDATA[nextjs-15]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[framework]]></category>
            <dc:creator><![CDATA[Samad Saiyed]]></dc:creator>
            <pubDate>Sat, 03 May 2025 21:06:35 GMT</pubDate>
            <atom:updated>2025-05-03T21:06:35.791Z</atom:updated>
            <content:encoded><![CDATA[<p><em>2025 is shaping up to be one of the most exciting years for frontend development. New frameworks are vying for attention, while Next.js continues to evolve. Is it still the best choice, or should developers start jumping ship? Let’s dive in.</em></p><figure><img alt="Is NextJS Dead in 2025?" src="https://cdn-images-1.medium.com/max/1024/1*0eRZ8rao-2S_aORcAJxVZQ.png" /></figure><h4>🚀 What is Next.js, and Why Has It Dominated for So Long?</h4><p><a href="https://nextjs.org/"><strong>Next.js</strong></a> is a React-based meta-framework created and maintained by <a href="https://vercel.com/"><strong>Vercel</strong></a>. It brought server-side rendering (SSR), static site generation (SSG), incremental static regeneration (ISR), API routes, image optimization, and more — making it the go-to framework for modern web apps.</p><p>It transformed React from a purely client-side library into a full-fledged application framework.</p><p>But we are not here to talk about how NextJs works. The topic of discussion lies whether our beloved framework is loosing its touch, and getting overthrown by competitors?</p><h4>🔥 Next.js in 2025: What’s New?</h4><p>Next.js didn’t sit still. In 2025, it boasts:</p><ul><li><em>Full Server Components support</em></li><li><em>Improved Edge-first architecture</em></li><li><em>Better caching and CDN strategies</em></li><li><em>Turbopack for faster builds</em></li><li><em>Native ESM and TypeScript integration</em></li><li><em>Advanced App Directory routing and layouts</em></li></ul><p>This makes it one of the most future-ready, scalable solutions for both startups and enterprises.</p><h4>🎯 Why Next.js Still Holds the Throne</h4><p>Even with rising competition, Next.js maintains its dominance due to:</p><p><strong>✅ Exceptional Developer Experience<br></strong>Tight integration with React’s latest features, streamlined configuration, and tools like Turbopack make for a frictionless workflow.</p><p><strong>✅ Enterprise-Ready Ecosystem<br></strong>Backed by Vercel and trusted by companies like Netflix, Uber, and TikTok — Next.js is proven in production.</p><p><strong>✅ Hybrid Rendering Flexibility<br></strong>Whether you need SSR, SSG, ISR, or Edge rendering, Next.js allows fine-grained control at the route level.</p><p><strong>✅ Edge-Optimized Future<br></strong>With Edge Middleware and serverless functions globally deployed via Vercel, it offers low-latency experiences worldwide.</p><h4>⚠️ The Developer Pain Points in 2025</h4><p>It’s not all perfect, though. Common frustrations include:</p><ul><li><em>Complex App Directory &amp; Server Components syntax</em></li><li><em>Turbopack migration hurdles in large projects</em></li><li><em>Vendor lock-in concerns with Vercel-exclusive features</em></li><li><em>Edge Middleware limitations</em></li><li><em>Bundle size management challenges with Server Components</em></li></ul><h4>🥊 The Competition in 2025: Can They Take the Throne?</h4><p>Here’s a quick rundown of who’s competing for the frontend crown:</p><pre>| Framework      | Strengths                                                                  | Limitations                                               |<br>| :------------- | :------------------------------------------------------------------------- | :-------------------------------------------------------- |<br>| **SvelteKit**  | Ultra-lightweight, fast, no virtual DOM.                                   | Smaller ecosystem, enterprise adoption still catching up. |<br>| **Remix**      | Progressive enhancement, native web APIs, server-first rendering.          | Learning curve, smaller community.                        |<br>| **Qwik**       | Groundbreaking resumability, near-instant interactivity.                   | New ecosystem, fewer large-scale case studies.            |<br>| **Astro**      | Fantastic for content-heavy static sites, supports multiple UI frameworks. | Not ideal for dynamic or SSR-heavy apps.                  |<br>| **Nuxt (Vue)** | Polished Vue-based alternative with SSR/SSG support.                       | Vue-specific, smaller job market compared to React.       |</pre><h3>📣 Your Thoughts?</h3><p>Which framework are you betting on in 2025? Are you sticking with Next.js or experimenting with SvelteKit, Remix, or Qwik? Share your thoughts in the comments — let’s discuss!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e778c00839d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>