<?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 Vijay on Medium]]></title>
        <description><![CDATA[Stories by Vijay on Medium]]></description>
        <link>https://medium.com/@vijaykarthik9868?source=rss-884350d9a6ee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*n_JitLq9Y8hZrtRz</url>
            <title>Stories by Vijay on Medium</title>
            <link>https://medium.com/@vijaykarthik9868?source=rss-884350d9a6ee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:43:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vijaykarthik9868/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 Constant of Concentration]]></title>
            <link>https://blog.coffeeinc.in/the-constant-of-concentration-920effeb707c?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/920effeb707c</guid>
            <category><![CDATA[work]]></category>
            <category><![CDATA[neuroscience]]></category>
            <category><![CDATA[focus]]></category>
            <category><![CDATA[brain]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 11:38:19 GMT</pubDate>
            <atom:updated>2026-11-03T11:38:19.830Z</atom:updated>
            <content:encoded><![CDATA[<h4>Focus is a breath, not a grip</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ijHMYoKA15k0danv-SeD8w.jpeg" /><figcaption><em>Steady practice, one breath at a time.</em></figcaption></figure><p>We think of focus as a force. Something we summon when the deadline is close, grip tightly, and hold until the work is done.</p><p>Then it slips. A notification. A new tab. A half-thought about something else. We pull it back, and it slips again. By evening we have been busy all day and finished very little.</p><p><em>Perhaps the trouble is the grip itself.</em></p><p>There is a boy in <strong><em>Demon Slayer </em></strong>who learns this the long way. <strong>Tanjiro Kamado </strong>sets out to save his sister with little more than a borrowed sword, and discovers, fight by fight, that his strength does not come from his arms. It comes from his breath. He calls it Total Concentration, and by the end of his training it runs through him even while he sleeps.</p><p>Our brains have their own version of that breath. Picture a small IT office: a support desk notices what needs attention, a team lead chooses where to work, and a project manager keeps the task moving. There is room for a creative colleague and time away from the desk, too. These roles are a way to picture how attention works. Follow Tanjiro’s journey closely, and the jobs become familiar.</p><h3>How Attention Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tiv3SNeyzl0ff9QvfJRtjA.png" /><figcaption><em>Phase 1 — Notice, Aim, Hold: A glowing white thread stretching taut from the edge of a dark sword blade through a shadowy forest toward its target. The scent flags what matters (Salience), the thread narrows the beam (Dorsal Attention Network), and the steady breath holds it in place (Central Executive Network).</em></figcaption></figure><p>You sit down to work. Before you open the code, a message arrives: someone cannot log in. Among the tabs, reminders and half-finished thoughts, this is the problem you decide needs your attention.</p><p>For Tanjiro, that first signal comes through his nose. He smells a demon before he sees it. At your desk, it is the message that makes you look up. You notice it, judge that it matters and decide the other requests can wait. <strong>Notice.</strong></p><p>Now you open the login code and try to reproduce the error. For a while, the rest of the screen fades into the background. In a fight, Tanjiro sees a faint thread leading to the gap in his opponent’s guard. You have your own thread: find out why this login fails. <strong>Aim.</strong></p><p>Then comes the harder part: staying with it. You trace the error, test a possible fix and remember what you are trying to solve. A request to change a button colour appears. You leave yourself a note to return to it later and continue with the login issue. For Tanjiro, it is the steady breath behind the sword. For you, it is coming back to the same task. <strong>Hold.</strong></p><p><em>Nose, thread, breath.<br>Notice, aim, hold.</em></p><p>But while you work, you keep noticing. A chat badge lights up. Your phone buzzes. You wonder whether another message needs an answer. Tanjiro’s nose never switches off; your attention keeps picking up new signals, too. The difficulty is that a routine notification can feel as urgent as the problem you chose to fix. You open it for a moment, and lose your place in the code.</p><p>Even when the phone stays silent beside the keyboard, you may find yourself wondering what you are missing. You turn it face down, but still feel the pull to check. Part of your effort goes into resisting it instead of understanding the error.</p><p>So you change the room a little. You mute routine alerts, keep a way for genuinely urgent messages to reach you and put the phone in another room. Then you return to the line of code you were reading. You have made it easier to stay with the choice you already made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Locido2o6ZKj62UxJEHpsg.png" /></figure><h3>Mind-Wandering and Creativity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RhjoiHt1HmHVlh5SqzLt2g.png" /><figcaption><em>Eyes closed, Zenitsu settles into his Thunderclap and Flash stance: the scene behind this section’s metaphor for letting go.</em></figcaption></figure><p>Of course, not every good moment comes from holding the beam.</p><p>Tanjiro learns this from Zenitsu, the nervous boy who soon joins him on the road. Awake, Zenitsu trembles and begs to go home. Then he faints and, fast asleep, rises and strikes like lightning. It is played for laughs, but it hints at something true: the mind has a second mode, and it does some of its best work when the project manager steps back.</p><p>Imagine a <strong>creative developer</strong> who steps away from the assigned ticket and starts connecting ideas. A conversation from yesterday meets a problem from last week, and a possible solution appears. The mind can do something similar when we daydream, walk or allow ourselves to be bored. It is why an answer sometimes arrives in the shower or while staring out of a train window.</p><p>Think of the project manager and creative developer sharing the day. Sometimes we need a clear plan and steady execution; sometimes we need space to explore. They can help each other: a wandering thought suggests an approach, and focused work tests it. <strong><em>Tanjiro awake and aimed, Zenitsu asleep and brilliant: the story gives us a memorable picture of both.</em></strong></p><p>What the creative developer needs most is room. Every gap we fill with a scroll, in the queue, in the lift, while the kettle boils, is a gap for ideas that we give away. A little boredom, chosen on purpose, leaves room to make connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EoHt3eCxgc9pYHWZm7rdtA.png" /></figure><h3>The Cost of Multitasking</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4F1XqYsq0Xh--5DFCJLpg.png" /><figcaption><em>Tanjiro unleashes Hinokami Kagura against Rui, pushing beyond his familiar Water Breathing technique.</em></figcaption></figure><p>If one mode at a time is the rule, it is worth seeing what happens when we break it.</p><p>On Mount Natagumo, cornered by a demon stronger than any before, Tanjiro switches mid-fight from Water Breathing to the Hinokami Kagura, a fire dance he remembers from his father. It is powerful, but his body has never trained for the change, and moving between the two pushes him past his limit. He collapses.</p><p>We make that kind of switch dozens of times a day and call it multitasking. <strong>In truth, the brain cannot run two focused tasks at once</strong>. It can only <strong>switch</strong>, putting one task down, picking another up, and coming back. Every switch is a payment, and we pay in mental energy.</p><p>The cost is easy to feel for ourselves. Take a timer and a sheet of paper. Write the sentence “<em>Switching has a cost”</em>, then, on the line below, the numbers 1 to 17. Time it. Now do it again, alternating: S, 1, w, 2, i, 3, until both lines are done. Same letters, same numbers, yet most people take nearly twice as long the second time, and make more mistakes. Only the switching changed.</p><p>Stretch that across a working morning. Three tasks, a report, a set of slides and a client reply, each need thirty minutes of real attention, and each switch costs about two and a half minutes of remembering where we were.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTNzw6ju7iyFM8ZXXo3xoQ.png" /></figure><p>Done one by one, the first result lands in half an hour. Done in parallel, nothing is finished for nearly ninety minutes, and the whole morning runs twenty minutes longer. Even after we switch back, part of the mind lingers on the last task, like a developer still thinking about the previous ticket after opening the next one.</p><p>Like Tanjiro on that mountain, we feel the bill all at once, usually around six in the evening. The tiredness is not from the work.</p><p>It is from the switching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhSC8bPCWMtPQEVSlc8K9g.png" /></figure><h3>Stress, Burnout and Recovery</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4iCXZYUuLJJwehjBAp0-g.png" /><figcaption><em>Phase 4 — Active Detachment: Sunlight filtering into the wooden engawa of the Butterfly Mansion, with wooden reflex cups on a table and purple butterflies drifting across a lush courtyard. Real recovery isn’t passive scrolling — it is active, absorbing play.</em></figcaption></figure><p>After Natagumo, Tanjiro and his friends are too broken to carry on, so they are sent to the Butterfl Mansion to heal.</p><p>What is striking is<em>how</em>the Mansion heals them. Once they can stand, they are not left in bed. They play reflex games with cups of medicine, chase one another around the courtyard and push their breathing to the edge. Recovery there is active, absorbing, and nothing like the fight they came from.</p><p>Think of stress as an <strong>on-call engineer</strong> whose alerts keep firing: too many demands, too little time to settle after each one. When that pressure keeps going without enough recovery, work can start to feel exhausting and empty. Getting away from it means more than closing the laptop. It means time when we are not still answering tickets in our heads.</p><p>The surprise is that lying on the sofa rarely gets us there. A resting mind drifts straight back to the inbox. What works is something demanding enough to fill our attention completely: a hard run, a long walk in nature, climbing, cooking, an instrument. A Butterfly Mansion of our own.</p><p>Give recovery three places in the calendar. <strong>Short daily breaks</strong>, about ten minutes a few times a day, let us step away between tasks. <strong>Longer weekly breaks</strong>, around two hours for a game, a class or time in the garden, give us something else to become absorbed in. <strong>Occasional time fully off</strong>, a half-day to a full day each month, means no messages and no quiet checking. Like an on-call rota, a break works best when we are allowed to hand over.</p><p>The slayers never treat their time at the Mansion as time away from training. It is part of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbWOCWR9RFGT3xvPlN0cVA.png" /></figure><h3>Habits and Identity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*faIQrhH6jJvRE2c8PvfMvA.png" /><figcaption><em>The boulder finally splits: Tanjiro sees the result of months of practice on Mount Sagiri. Demon Slayer: Kimetsu no Yaiba</em></figcaption></figure><p>The Mansion gives Tanjiro something else, too: time to remember where it all began.</p><p>Long before the demons, he spent season after season at the foot of a mountain, running, falling, and swinging at a boulder that would not split. Most of those days changed nothing he could see. He simply came back, and one day the boulder broke. Now, at the Mansion, he carries that patience further, learning to keep Total Concentration going all day and all night until it is simply how he breathes. The slayers call it Total Concentration, Constant.</p><p>That is what a habit really is: a choice repeated until it stops being a choice. It is also why vague goals fail. “Focus more” gives the brain nothing to hold, while a <strong>tiny habit</strong>, anchored to something we already do, gives it a path: one page after the morning tea, one minute of breathing before opening email. Small enough that we cannot fail, repeated enough that we no longer have to decide.</p><p>Slowly, those repetitions become part of our personal story. When the pain becomes too much, Tanjiro tells himself that he is the eldest son, and the eldest son can endure. It is not a fact about his body. It is a story, and the story holds him up. Our own stories work the same way, for better or worse.<em>I get distracted easily. I’m not a morning person. I never finish what I start.</em>They quietly tell attention what to look for and when to give up. Every small action is a vote for a different story, and once the evidence piles up, attention follows.</p><p><em>Repetition becomes habit.<br>Habit becomes identity.<br>Identity becomes belief.</em></p><p>This is what sits behind the so-called “billionaire brain”, the limitless feeling ultra-achievers describe. It is rarely a different brain, just an ordinary one pointed in one direction for a very long time, with a story of its own agency built from thousands of small proofs. Tanjiro does not believe he can keep going because he was born strong. He believes it because he has seen the boulder split.</p><h3>Why We Crave Distraction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7yLVqmjg93UjRmk8-9Bdw.png" /><figcaption><em>Phase 6 — The Sweet Dream of the Feed: Passengers slumped in warm, golden slumber inside a vintage steam-train carriage hurtling through the dark night. Like Enmu’s spell, the infinite scroll doesn’t force us in — it offers a gentle escape from feelings we don’t want to sit with.</em></figcaption></figure><p>Healed, and breathing steadier than ever, Tanjiro boards his next mission: the Mugen Train, the Infinity Train.</p><p>This time the enemy does not attack. A demon named Enmu simply puts every passenger into a sweet, endless dream. Tanjiro dreams of home, his family alive and the snow quiet, and it is so gentle that he does not want to wake.</p><p>The feed works in much the same way. It rarely drags us in. It offers somewhere softer to be. The pull towards the scroll, the snack or the next episode is seldom about the thing itself. It is a way out of a feeling we would rather not sit with, whether tiredness, stress, worry or shame. Tanjiro does not stay in the dream for the dream. He stays for the grief it lets him forget.</p><p>Underneath, an old routine is running. A feeling arrives, and the thumb moves before we have decided anything. Think of a <strong>product team</strong> offering a surprise behind every refresh: perhaps a funny clip, a message or something new. The possibility keeps us checking, while the real need, for comfort, connection or rest, goes unmet.</p><p>The longer we ride, the more familiar that routine becomes. After constant novelty, a book or a long film can feel harder to settle into. Imagine the office’s <strong>documentation specialist</strong> trying to write useful notes while someone changes the screen every few seconds. There is little room to pause and make sense of what happened. An hour of scrolling can leave the same thin impression. And like the passengers, each lost in a private dream, we end up surrounded by others and quietly alone.</p><p>It even disguises itself as rest. We finish a task, open the app and call it a break, yet research on breaks suggests that scrolling restores us about as well as no break at all. Everyone on that train is asleep, but no one is recovering.</p><h3>The One-Minute Pause</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hfZFUAps0LqZjdnXuEdxGg.png" /><figcaption><em>Phase 7 — The Pattern Interrupt: Standing on an infinite mirror-sky of water inside Tanjiro’s subconscious as a single white breath cloud rises in the still air. Sixty seconds of noticing breaks the spell and puts the operator back in charge.</em></figcaption></figure><p>And yet Tanjiro does wake. Somewhere inside the dream, he notices that something is off, and that single moment of noticing is what sets him free.</p><p>We can build that moment on purpose. Call it a <strong>one-minute pause</strong>. When we feel ourselves reaching for the phone or the remote, we stop before the usual routine finishes. Then we turn Tanjiro’s nose inwards and ask what we are actually feeling. Tired? Anxious? Avoiding something hard? Often the urge is a messenger, not a need. Finally, we close our eyes and breathe slowly for sixty seconds, a small Total Concentration of our own.</p><p>Those sixty seconds are like asking the project manager to review a new ticket before the whole team drops its work. Do we need to act now? What are we actually trying to solve? We might still pick up the phone afterwards, but now it is a choice rather than a reflex.</p><p>The pause comes even more easily with a <strong>simple rule decided ahead of time</strong>. <em>If I reach for my phone out of boredom, then I breathe for sixty seconds first. If I sit down at my desk, then the phone goes in the drawer.</em> Like an agreed office procedure, the decision is made once, so we do not have to debate it each time.</p><h3>Your Best Hours and the 5 AM Club</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDMbJV0856TauXlPOFRHkA.png" /><figcaption><em>Phase 8 — Working with Your Clock: A weathered wooden box resting on a mountain path as the sky transitions from deep midnight indigo to warm dawn gold. Night hunters and morning larks run on different clocks — focus comes from guarding your peak hours, not fighting your biology.</em></figcaption></figure><p>When Tanjiro steps off the train, the sky is still dark, as it always is when the Demon Slayer Corps is at work. Demons walk only at night, so the slayers hunt after sunset and sleep when the sun comes up, while Nezuko rests through the day in a wooden box on her brother’s back.</p><p>Their clock is set by the work. Ours has its own rhythm. Some of us are sharpest soon after waking. Others warm up later in the day. Most fall somewhere in between. Think of colleagues who do their best work on different shifts: sharing an office does not mean sharing the same best hours.</p><p>That is the quiet problem with the ‘5 AM Club’. For an early starter, it may suit the day beautifully. For someone who becomes alert later, an early alarm can simply cut sleep short. Even the best documentation specialist needs time to finish the day’s notes; we need sleep to help us remember and return ready to work. A 5 AM alarm will not turn a night hunter into a morning person. It may only make them tired.</p><p>A better question than<em>when should we wake up</em>is <em>when are we at our sharpest</em>. Watch a week of ordinary days. Notice when hard thinking comes easily and when it drags. Then guard those hours for deep work, and leave the emails and calls for the rest.</p><p>Looking back, Tanjiro’s journey was never really about stronger arms. It was about learning to breathe. To notice the scent, follow the thread and hold steady. To let the mind wander when it needed to. To rest for real. And to wake from the dreams that only looked like rest.</p><p>Focus asks the same of us. It is not a test of will. It is a rhythm, and rhythms can be trained.</p><p><em>Clear the room.<br>Pause before the pull.<br>Rest for real.</em></p><p><em>Focus is not held. It is breathed.</em></p><p><em>Until it becomes constant.</em></p><p><em>With thanks to Dr. Sahar Yousef, cognitive neuroscientist at UC Berkeley, whose conversation on focus, habits and stress shaped this piece.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=920effeb707c" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/the-constant-of-concentration-920effeb707c">The Constant of Concentration</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Docker Your Vibe Coded Full Stack App with Docker]]></title>
            <link>https://blog.coffeeinc.in/best-practices-for-docker-your-vibe-coded-full-stack-app-with-docker-d76d5161991c?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/d76d5161991c</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[monorepo]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 06:55:05 GMT</pubDate>
            <atom:updated>2026-02-19T11:49:37.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Best Practices for Deploying Your Vibe Coded Full Stack App with Docker</h3><h4>Building a Container for a Next.js Frontend and Python Backend</h4><p>It is so easy to build full stack apps through combining AI assisted coding, reusable templates, and frameworks such as Next.js and Python FastAPI to assemble complete products quickly. Vibe coding has allowed us to move from idea to working product in days instead of months. However, how do you get it out there in the real world? While one-click deployment works for Next.js and React apps, when it comes to full-stack, there is some amount of setup needed at the server end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*LInuw6UrP0qkS5mc" /></figure><p>Do we deploy Next.js and Python separately? How do we set the environment? How do we support maintenance at scale?</p><p>For a Next.js/Python full stack app, each part has its own dependencies, runtime requirements, and configuration. Running everything reliably across developer machines, staging environments, and production systems becomes hard to maintain and keep track of. So, how do we combine both and bundle it up?</p><p>Docker containers help exactly with that. By packaging each service together with its runtime, libraries, and configuration, containers ensure that the Next.js frontend and the Python backend behave identically wherever they run. This dramatically reduces environment related issues and makes deployments predictable, repeatable, and easy to automate.</p><p>In this guide, we will walk through how to dockerize a full stack app. We will take an example that contains: a Next.js frontend and a Python backend.</p><p>Whether you are new to Docker or looking to apply it to a multi-service project, this guide will give you a clear, step-by-step process to get everything running smoothly in containers.</p><h3>Understanding the Repository Structure</h3><p>Consider a typical ecommerce monorepo structured as follows:</p><pre>ecom-monorepo/<br>  frontend/      # Next.js application<br>  backend/       # Python API services<br>  docker-compose.yml</pre><p>The frontend handles user interaction and rendering. The backend provides APIs, authentication, and business logic. Each of these components will run inside its own container, allowing independent scaling and easier maintenance.</p><h3>Dockerizing Your Web App</h3><h4>Getting Started: Prerequisites</h4><p>Before diving in, make sure you have the essentials installed:</p><ul><li><strong>Docker: </strong>To build and run containers.</li><li><strong>Docker Compose: </strong>For orchestrating multiple containers in local development.</li><li><strong>Git: </strong>To clone the repository and manage version control.</li></ul><p>Once these are set up, we’re ready to containerize!</p><h4>1. Containerizing the Frontend</h4><p>We begin by containerizing the frontend service. Navigate to the frontend directory and create a Dockerfile:</p><pre>FROM node:20-alpine<br><br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm install<br><br>COPY . .<br>RUN npm run build<br><br>EXPOSE 3000<br>CMD [&quot;npm&quot;, &quot;start&quot;]</pre><p>Build the frontend image:</p><pre>cd frontend<br>docker build -t ecom-frontend:latest .</pre><p>This process leverages a <strong>Node.js base image</strong>, installs dependencies, compiles assets, and sets up a production-ready server.</p><h4>2. Containerizing the Backend</h4><p>Inside the backend directory create a Dockerfile for the Python service:</p><pre>FROM python:3.11-slim<br><br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br>COPY . .<br><br>EXPOSE 8000<br>CMD [&quot;uvicorn&quot;, &quot;main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;8000&quot;]</pre><p>Build the backend image:</p><pre>cd backend<br>docker build -t ecom-backend:latest .</pre><p>Each backend service can follow the same pattern, allowing multiple APIs to run independently.</p><h4>3. Managing Services with Docker Compose</h4><p>To streamline local development, we use Docker Compose to manage the frontend and backend together. Create a docker-compose.yml file in the root directory:</p><pre>version: &#39;3.8&#39;<br><br>services:<br>  frontend:<br>    build:<br>      context: ./frontend<br>      dockerfile: Dockerfile<br>    ports:<br>      - &quot;3000:3000&quot;<br>    environment:<br>      - NODE_ENV=production<br>  backend:<br>    build:<br>      context: ./backend<br>      dockerfile: Dockerfile<br>    ports:<br>      - &quot;8000:8000&quot;<br>    environment:<br>      - ENV=production</pre><p>Docker Compose creates a shared network so that the frontend and backend communicate using service names.</p><h3>Running the Application</h3><p>With everything set up, let’s bring our application to life.</p><p><strong>Build all containers:</strong></p><pre>docker-compose build</pre><p><strong>Start all services:</strong></p><pre>docker-compose up -d</pre><p><strong>Stop all services:</strong></p><pre>docker-compose down</pre><h3>Development vs. Production</h3><h4>Local Development Workflow</h4><p>For development, consider using a docker-compose.dev.yml file with:</p><ul><li>Hot-reloading enabled</li><li>Development dependencies installed</li></ul><p>This ensures a smooth coding experience without needing to rebuild containers constantly.</p><h4>Production Deployment</h4><p>When deploying to production, optimize your containers by:</p><ul><li>Using <strong>multi-stage builds</strong> to reduce image size</li><li>Implementing <strong>security best practices</strong> to prevent vulnerabilities</li><li>Managing configurations through <strong>environment variables</strong></li></ul><h3>Best Practices for Containerized Monorepos</h3><ul><li>Keep images small by using slim base images</li><li>Structure Dockerfiles to maximize layer caching</li><li>Separate development and production Compose configurations</li><li>Avoid storing secrets inside images</li><li>Add health checks so orchestration systems can restart failing services</li><li>Centralize logging for easier debugging</li></ul><h3>Troubleshooting Common Issues</h3><p>Even with a well-structured setup, issues can arise. Here’s how to tackle some common ones:</p><ul><li><strong>Container networking issues?</strong> Ensure services can communicate via docker network ls.</li><li><strong>Volume mounting problems?</strong> Check permissions and paths in docker-compose.yml.</li><li><strong>Environment variable conflicts?</strong> Validate .env files and runtime configurations.</li></ul><h3>Ongoing Maintenance</h3><p>Once everything is up and running, keep your containers in top shape:</p><ul><li><strong>Apply security updates</strong> regularly.</li><li><strong>Clean up unused images</strong> with docker system prune.</li><li><strong>Monitor performance</strong> using Docker stats and logging tools.</li></ul><h3>Final Thoughts</h3><p>While building features has become faster with vibe coding, reliable deployment still depends on having a consistent execution environment across development, staging, and production systems. Docker solves this challenge by ensuring that every service runs in a predictable and portable way.</p><p>With Docker and Docker Compose in place, the entire stack can be started locally with a single command, integrated seamlessly into CI pipelines, and deployed to any container supported infrastructure without environment specific adjustments. Each service can evolve, scale, and be updated independently while still remaining part of a unified system.</p><p>As full stack development continues to accelerate, containerization becomes not just an infrastructure choice but a foundational practice. It allows rapidly built Python and Next.js applications to move from prototype to production with stability, repeatability, and operational simplicity.</p><p>For more service-specific details, refer to the docker <a href="https://docs.docker.com/">official documentations.</a> Happy containerizing!</p><p><em>At </em><a href="https://coffeeinc.in/"><em>Coffee</em></a><em>, we engineer AI and systems that scale. If you are looking to build your next product or upgrade your existing toolset, reach out to us at </em><a href="/service/mailto:coffee@coffeeinc.in"><em>coffee@coffeeinc.in</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d76d5161991c" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/best-practices-for-docker-your-vibe-coded-full-stack-app-with-docker-d76d5161991c">Best Practices for Docker Your Vibe Coded Full Stack App with Docker</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complete Guide: Push Notifications in PWA with Firebase Cloud Messaging]]></title>
            <link>https://blog.coffeeinc.in/complete-guide-push-notifications-in-pwa-with-firebase-cloud-messaging-a515965372f7?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/a515965372f7</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[notifications]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Tue, 20 Jan 2026 06:26:39 GMT</pubDate>
            <atom:updated>2026-01-20T06:26:39.092Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to set up FCM notifications for your vibe coded app?</h4><p>Vibe coding has made it remarkably easy to get applications up and running. Modern AI builders can assemble interfaces, wire databases, and deploy working products in minutes. The tools are powerful, but it often struggles with third party integrations, particularly push notifications.</p><p>Among these, Firebase Cloud Messaging is the integration that most frequently breaks when built through purely vibe driven workflows. Reliable push notifications in a PWA requires coordination across the browser, service workers, hosting environment, and backend. When any one of these layers is slightly misconfigured, notifications fail without obvious clues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s9KgQghQ879gGoW0.png" /></figure><p>It is this very failure loop that I got stuck in before I realized that configuring FCM is better done manually. I have outlined the process of implementing Firebase Cloud Messaging push notifications in your PWA from scratch, including all necessary setup steps and practical debugging techniques.</p><h3>How It Works</h3><p>At a high level, push notifications follow a predictable sequence.</p><ol><li>User grants notification permission</li><li>Firebase generates a unique FCM token for the device</li><li>Token is stored on your server for targeting</li><li>Server sends push requests to Firebase</li><li>Firebase delivers notifications to the user’s device</li><li>Service worker handles notification display and user interactions</li></ol><h3>Where vibe coding commonly fails with Firebase</h3><p>Recently, when I was building out a web app with Claude Code, I got great results until it came to FCM integration. My conversations with Claude started entering a loop and I realized that part of the reason was the version of docs it was following. There were few other issues I was able to identify:</p><h4><strong>1. Service worker confusion</strong></h4><p>Auto generated setups often register multiple service workers or place Firebase logic in the wrong file. Sometimes the dedicated firebase-messaging-sw.js is not served from the root scope, or it gets replaced during a build. The result is predictable: FCM tokens appear to work, yet background notifications never arrive.</p><h4><strong>2. Misconfig in development and production environments</strong></h4><p>The local configuration is different from that of production. Common patterns include using the wrong VAPID key, mixing Firebase projects, or forgetting to update service worker credentials after deployment. Notifications may work locally over HTTPS, then break entirely once the app is live.</p><h4><strong>3. Token generation without durable storage</strong></h4><p>I also noticed that without a persistent storage, I was able to trigger notifications, but tokens disappear when users switch devices, clear storage, or reinstall the PWA. <strong>Worse, sometimes, the token is rarely tied to a user identity, making real notification targeting unreliable.</strong></p><h4><strong>4. Poor permission flow</strong></h4><p>Generated interfaces tend to request notification permission immediately on page load. Users often deny it, and the app provides no clear way to recover or explain the value of notifications. This permanently reduces deliverability.</p><h4><strong>5. iOS blind spots</strong></h4><p>Most testing I did was in Chrome on Android or desktop. On iOS, notifications require the PWA to be added to the home screen, strict HTTPS configuration, and a correctly structured manifest. This was not clear until I went live.</p><h4><strong>6. Backend mismatch for real notifications</strong></h4><p>Manual sending from the Firebase console always worked well. But when trying to get the backend to actually send messages, there are a number of additional steps of config need..</p><h4><strong>7. Silent failures instead of clear errors</strong></h4><p>Perhaps the biggest issue is invisibility. Tokens may be null, service workers may not register, or VAPID keys may be wrong, yet nothing clearly surfaces in the UI. This guide explicitly shows how to inspect each layer so failures become visible and fixable.</p><h3>Prerequisites</h3><p>Before starting, ensure you have:</p><ul><li><strong>HTTPS Website</strong>: Push notifications require secure connections</li><li><strong>Service Worker</strong>: Essential for background notification handling</li><li><strong>Web App Manifest</strong>: Defines how your PWA appears when installed</li><li><strong>Node.js</strong>: For development and build tools</li><li><strong>Firebase Account</strong>: For FCM services</li><li><strong>Modern Browser</strong>: Chrome, Firefox, Safari, or Edge</li></ul><h3>Setting up a Project in Firebase Console</h3><h4>Step 1: Create Firebase Project</h4><p>You begin by creating a Firebase project in the Firebase Console and registering your web application.</p><p><strong>Navigate to Firebase Console<br></strong>Go to <a href="https://console.firebase.google.com/">Firebase Console</a><br>Sign in with your Google account</p><p><strong>Create New Project</strong><br>Click “Add project” → Enter project name → Continue</p><p><strong>Configure Google Analytics</strong> (Optional but recommended)<br>Choose existing account or create new → Select region → Accept terms</p><p><strong>Project Creation<br></strong>Click “Create project” → Wait for setup completion</p><h4>Step 2: Add Web App to Project</h4><p><strong>Register Web App</strong> (Project Overview → Add app → Web (&lt;/&gt;) icon)</p><p><strong>App Configuration</strong> (App nickname: “Your PWA Name” → Firebase Hosting: ☑️ (optional) → Click “Register app”)</p><p><strong>Save Firebase Configuration</strong></p><pre>// Copy this configuration object<br>const firebaseConfig = {<br>  apiKey: &quot;your-api-key&quot;,<br>  authDomain: &quot;your-project.firebaseapp.com&quot;,<br>  projectId: &quot;your-project-id&quot;,<br>  storageBucket: &quot;your-project.appspot.com&quot;,<br>  messagingSenderId: &quot;123456789012&quot;,<br>  appId: &quot;1:123456789012:web:abcdef123456&quot;<br>};</pre><h4>Step 3: Enable Cloud Messaging</h4><p><strong>Navigate to Cloud Messaging</strong> (Project settings → Cloud Messaging tab)</p><p><strong>Generate VAPID Keys</strong> (Web configuration → Web Push certificates → Generate key pair)</p><blockquote><strong>Important</strong>: Save the generated VAPID key — you’ll need it for client-side implementation.</blockquote><h3>Setting up Service Accounts</h3><p>If you do need service account setup, here is how to create one:</p><h4>Step 1: Create Service Account</h4><ul><li><strong>Access Service Accounts in the Google Cloud Console</strong>: (Project settings → Service accounts tab)</li><li><strong>Generate Private Key</strong>: (Firebase Admin SDK → Generate new private key → Generate key)</li><li><strong>Download JSON File</strong>: A serviceAccountKey.json file will be downloaded</li></ul><blockquote><strong>Security Warning</strong>: Never commit this file to version control!</blockquote><h4>Step 2: Service Account JSON Structure</h4><p>Your downloaded file will look like this:</p><pre># json <br>{<br>  &quot;type&quot;: &quot;service_account&quot;,<br>  &quot;project_id&quot;: &quot;your-project-id&quot;,<br>  &quot;private_key_id&quot;: &quot;key-id&quot;,<br>  &quot;private_key&quot;: &quot;-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n&quot;,<br>  &quot;client_email&quot;: &quot;firebase-adminsdk-xxxxx@your-project.iam.gserviceaccount.com&quot;,<br>  &quot;client_id&quot;: &quot;123456789012345678901&quot;,<br>  &quot;auth_uri&quot;: &quot;https://accounts.google.com/o/oauth2/auth&quot;,<br>  &quot;token_uri&quot;: &quot;https://oauth2.googleapis.com/token&quot;,<br>  &quot;auth_provider_x509_cert_url&quot;: &quot;https://www.googleapis.com/oauth2/v1/certs&quot;,<br>  &quot;client_x509_cert_url&quot;: &quot;https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-xxxxx%40your-project.iam.gserviceaccount.com&quot;<br>}</pre><h4>Step 3: Secure Storage for Different Environments</h4><p><strong>For Supabase Edge Functions:</strong></p><pre>sql<br>-- Store as encrypted secrets in Supabase<br>-- Dashboard → Project Settings → Edge Functions → Environment Variables<br><br>FIREBASE_SERVICE_ACCOUNT_KEY={&quot;type&quot;:&quot;service_account&quot;,...}<br>FIREBASE_PROJECT_ID=your-project-id</pre><p><strong>For Client-Side API Routes (Next.js):</strong></p><pre># Store in environment variables<br>VERCEL_PUBLIC_FIREBASE_SERVICE_ACCOUNT_KEY=&#39;{&quot;type&quot;:&quot;service_account&quot;,...}&#39;<br>VERCEL_PUBLIC_FIREBASE_PROJECT_ID=your-project-id<br><br># Add to .gitignore<br>serviceAccountKey.json<br>.env.local</pre><p><strong>For Serverless Functions (Vercel, Netlify):</strong></p><pre># Store as environment variables in deployment platform<br>FIREBASE_SERVICE_ACCOUNT_KEY={&quot;type&quot;:&quot;service_account&quot;,...}<br>FIREBASE_PROJECT_ID=your-project-id</pre><h4>Step 4: Integration Examples</h4><p><strong>Supabase Edge Function Example:</strong></p><pre>// supabase/functions/send-notification/index.ts<br>import { serve } from &quot;https://deno.land/std@0.168.0/http/server.ts&quot;<br>import { initializeApp, cert } from &quot;https://deno.land/x/firebase_admin@v1.0.0/mod.ts&quot;<br><br>const firebaseConfig = {<br>  credential: cert(JSON.parse(Deno.env.get(&#39;FIREBASE_SERVICE_ACCOUNT_KEY&#39;)!)),<br>  projectId: Deno.env.get(&#39;FIREBASE_PROJECT_ID&#39;)<br>}<br>const app = initializeApp(firebaseConfig)<br>serve(async (req) =&gt; {<br>  const { userToken, title, body, data } = await req.json()<br>  <br>  try {<br>    const message = {<br>      token: userToken,<br>      notification: { title, body },<br>      data: data || {}<br>    }<br>    <br>    const response = await app.messaging().send(message)<br>    return new Response(JSON.stringify({ success: true, messageId: response }))<br>  } catch (error) {<br>    return new Response(JSON.stringify({ error: error.message }), { status: 500 })<br>  }<br>})</pre><p><strong>Server-Side API Route Example (Next.js):</strong></p><pre>// pages/api/send-notification.js<br>import admin from &#39;firebase-admin&#39;<br><br>if (!admin.apps.length) {<br>  admin.initializeApp({<br>    credential: admin.credential.cert(JSON.parse(process.env.FIREBASE_SERVICE_ACCOUNT_KEY)),<br>    projectId: process.env.FIREBASE_PROJECT_ID<br>  })<br>}<br>export default async function handler(req, res) {<br>  if (req.method !== &#39;POST&#39;) {<br>    return res.status(405).json({ error: &#39;Method not allowed&#39; })<br>  }<br>  <br>  const { token, title, body, data } = req.body<br>  <br>  try {<br>    const message = {<br>      token,<br>      notification: { title, body },<br>      data: data || {},<br>      webpush: {<br>        fcmOptions: {<br>          link: data?.url || &#39;/&#39;<br>        }<br>      }<br>    }<br>    <br>    const response = await admin.messaging().send(message)<br>    res.status(200).json({ success: true, messageId: response })<br>  } catch (error) {<br>    res.status(500).json({ error: error.message })<br>  }<br>}</pre><h3>Environment Setup</h3><h4>Step 1: Install Dependencies</h4><pre># For React/Vite PWA<br>npm install firebase vite-plugin-pwa workbox-window<br><br># For vanilla JavaScript<br>npm install firebase</pre><h4>Step 2: Environment Variables</h4><p>Create .env file:</p><pre># Client-side Firebase config<br>VITE_FIREBASE_API_KEY=your-api-key<br>VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com<br>VITE_FIREBASE_PROJECT_ID=your-project-id<br>VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com<br>VITE_FIREBASE_MESSAGING_SENDER_ID=123456789012<br>VITE_FIREBASE_APP_ID=1:123456789012:web:abcdef123456<br>VITE_WEBPUSH_NOTIFICATION_KEY=your-vapid-key</pre><h3>Implementation Steps</h3><h4>Step 1: Firebase Configuration</h4><p>Create src/firebase/config.js:</p><pre>import { initializeApp } from &#39;firebase/app&#39;;<br>import { getMessaging, getToken, onMessage } from &#39;firebase/messaging&#39;;<br><br>const firebaseConfig = {<br>  apiKey: import.meta.env.VITE_FIREBASE_API_KEY,<br>  authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,<br>  projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,<br>  storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,<br>  messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,<br>  appId: import.meta.env.VITE_FIREBASE_APP_ID<br>};<br>// Initialize Firebase<br>const app = initializeApp(firebaseConfig);<br>// Initialize Firebase Cloud Messaging<br>const messaging = getMessaging(app);<br>export { messaging, getToken, onMessage };</pre><h4>Step 2: Service Worker Setup</h4><p>Create public/firebase-messaging-sw.js:</p><pre>// Import Firebase scripts<br>importScripts(&#39;https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js&#39;);<br>importScripts(&#39;https://www.gstatic.com/firebasejs/9.0.0/firebase-messaging-compat.js&#39;);<br><br>// Initialize Firebase in service worker<br>firebase.initializeApp({<br>  apiKey: &quot;your-api-key&quot;,<br>  authDomain: &quot;your-project.firebaseapp.com&quot;,<br>  projectId: &quot;your-project-id&quot;,<br>  storageBucket: &quot;your-project.appspot.com&quot;,<br>  messagingSenderId: &quot;123456789012&quot;,<br>  appId: &quot;1:123456789012:web:abcdef123456&quot;<br>});<br>const messaging = firebase.messaging();<br>// Handle background messages<br>messaging.onBackgroundMessage((payload) =&gt; {<br>  console.log(&#39;Received background message:&#39;, payload);<br>  <br>  const notificationTitle = payload.notification.title;<br>  const notificationOptions = {<br>    body: payload.notification.body,<br>    icon: &#39;/icon-192x192.png&#39;,<br>    badge: &#39;/badge-72x72.png&#39;,<br>    tag: &#39;notification-tag&#39;,<br>    data: payload.data,<br>    actions: [<br>      {<br>        action: &#39;open&#39;,<br>        title: &#39;Open App&#39;<br>      },<br>      {<br>        action: &#39;close&#39;,<br>        title: &#39;Close&#39;<br>      }<br>    ]<br>  };<br>  self.registration.showNotification(notificationTitle, notificationOptions);<br>});<br>// Handle notification clicks<br>self.addEventListener(&#39;notificationclick&#39;, (event) =&gt; {<br>  console.log(&#39;Notification clicked:&#39;, event);<br>  <br>  event.notification.close();<br>  <br>  if (event.action === &#39;close&#39;) {<br>    return;<br>  }<br>  <br>  // Navigate to app<br>  event.waitUntil(<br>    clients.matchAll({ type: &#39;window&#39; }).then((clientList) =&gt; {<br>      for (const client of clientList) {<br>        if (client.url === &#39;/&#39; &amp;&amp; &#39;focus&#39; in client) {<br>          return client.focus();<br>        }<br>      }<br>      if (clients.openWindow) {<br>        return clients.openWindow(&#39;/&#39;);<br>      }<br>    })<br>  );<br>});</pre><h4>Step 3: Notification Permission Handler</h4><p>Create src/utils/notificationPermission.js:</p><pre>import { messaging, getToken } from &#39;../firebase/config&#39;;<br><br>const VAPID_KEY = import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY;<br>export function isNotificationSupported() {<br>  return &#39;Notification&#39; in window &amp;&amp; &#39;serviceWorker&#39; in navigator;<br>}<br>export async function requestNotificationPermission() {<br>  if (!isNotificationSupported()) {<br>    throw new Error(&#39;Notifications not supported&#39;);<br>  }<br>  const permission = await Notification.requestPermission();<br>  <br>  if (permission === &#39;granted&#39;) {<br>    // Register service worker first<br>    const registration = await navigator.serviceWorker.register(&#39;/firebase-messaging-sw.js&#39;);<br>    <br>    // Get FCM token<br>    const token = await getToken(messaging, { <br>      vapidKey: VAPID_KEY,<br>      serviceWorkerRegistration: registration<br>    });<br>    <br>    console.log(&#39;FCM Token:&#39;, token);<br>    <br>    // Send token to your server<br>    await sendTokenToServer(token);<br>    <br>    return token;<br>  } else {<br>    throw new Error(`Permission denied: ${permission}`);<br>  }<br>}<br>async function sendTokenToServer(token) {<br>  try {<br>    await fetch(&#39;/api/fcm-token&#39;, {<br>      method: &#39;POST&#39;,<br>      headers: {<br>        &#39;Content-Type&#39;: &#39;application/json&#39;,<br>      },<br>      body: JSON.stringify({ token, userId: getCurrentUserId() })<br>    });<br>  } catch (error) {<br>    console.error(&#39;Failed to send token to server:&#39;, error);<br>  }<br>}<br>function getCurrentUserId() {<br>  // Return current user ID from your auth system<br>  return &#39;user-123&#39;;<br>}</pre><h4>Step 4: FCM Token Service</h4><p>Create src/services/FCMTokenService.js:</p><pre>import { messaging, getToken, onMessage } from &#39;../firebase/config&#39;;<br>import { requestNotificationPermission } from &#39;../utils/notificationPermission&#39;;<br><br>export class FCMTokenService {<br>  static async registerFCMToken() {<br>    try {<br>      if (Notification.permission === &#39;granted&#39;) {<br>        const token = await getToken(messaging, {<br>          vapidKey: import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY<br>        });<br>        <br>        if (token) {<br>          await this.saveTokenToDatabase(token);<br>          return true;<br>        }<br>      }<br>      return false;<br>    } catch (error) {<br>      console.error(&#39;FCM token registration failed:&#39;, error);<br>      return false;<br>    }<br>  }<br>  static async saveTokenToDatabase(token) {<br>    // Store token in your preferred storage solution<br>    // Example with localStorage<br>    localStorage.setItem(&#39;fcmToken&#39;, token);<br>    localStorage.setItem(&#39;fcmTokenTimestamp&#39;, Date.now().toString());<br>    <br>    // Or integrate with your database/API<br>    console.log(&#39;FCM token saved:&#39;, token);<br>  }<br>  static setupForegroundNotifications() {<br>    onMessage(messaging, (payload) =&gt; {<br>      console.log(&#39;Foreground message received:&#39;, payload);<br>      <br>      // Display notification manually for foreground messages<br>      if (Notification.permission === &#39;granted&#39;) {<br>        new Notification(payload.notification.title, {<br>          body: payload.notification.body,<br>          icon: payload.notification.icon || &#39;/icon-192x192.png&#39;,<br>          data: payload.data<br>        });<br>      }<br>    });<br>  }<br>  static async clearToken() {<br>    try {<br>      // Clear token from local storage<br>      localStorage.removeItem(&#39;fcmToken&#39;);<br>      localStorage.removeItem(&#39;fcmTokenTimestamp&#39;);<br>      console.log(&#39;FCM token cleared&#39;);<br>    } catch (error) {<br>      console.error(&#39;Failed to clear FCM token:&#39;, error);<br>    }<br>  }<br>}<br>function getAuthToken() {<br>  // Return your auth token if using authentication<br>  // For demo purposes, return a placeholder<br>  return &#39;demo-auth-token&#39;;<br>}</pre><h4>Step 5: React Component Integration</h4><p>Create src/components/NotificationPermissionDialog.jsx:</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br>import { FCMTokenService } from &#39;../services/FCMTokenService&#39;;<br>import { requestNotificationPermission, isNotificationSupported } from &#39;../utils/notificationPermission&#39;;<br><br>export function NotificationPermissionDialog() {<br>  const [permissionState, setPermissionState] = useState(Notification.permission);<br>  const [showDialog, setShowDialog] = useState(false);<br>  useEffect(() =&gt; {<br>    // Show dialog if notifications are supported but not granted<br>    if (isNotificationSupported() &amp;&amp; Notification.permission === &#39;default&#39;) {<br>      const timer = setTimeout(() =&gt; setShowDialog(true), 2000);<br>      return () =&gt; clearTimeout(timer);<br>    }<br>    <br>    // Set up foreground notifications if already granted<br>    if (Notification.permission === &#39;granted&#39;) {<br>      FCMTokenService.setupForegroundNotifications();<br>      FCMTokenService.registerFCMToken();<br>    }<br>  }, []);<br>  const handleEnableNotifications = async () =&gt; {<br>    try {<br>      await requestNotificationPermission();<br>      setPermissionState(&#39;granted&#39;);<br>      setShowDialog(false);<br>      <br>      // Set up notifications<br>      FCMTokenService.setupForegroundNotifications();<br>    } catch (error) {<br>      console.error(&#39;Failed to enable notifications:&#39;, error);<br>      setPermissionState(&#39;denied&#39;);<br>    }<br>  };<br>  const handleDismiss = () =&gt; {<br>    setShowDialog(false);<br>  };<br>  if (!showDialog || !isNotificationSupported()) {<br>    return null;<br>  }<br>  return (<br>    &lt;div className=&quot;notification-dialog&quot;&gt;<br>      &lt;div className=&quot;dialog-content&quot;&gt;<br>        &lt;h3&gt;Enable Notifications&lt;/h3&gt;<br>        &lt;p&gt;<br>          Get notified about important updates and messages. <br>          You can change this setting anytime.<br>        &lt;/p&gt;<br>        &lt;div className=&quot;dialog-actions&quot;&gt;<br>          &lt;button onClick={handleDismiss} className=&quot;btn-secondary&quot;&gt;<br>            Not Now<br>          &lt;/button&gt;<br>          &lt;button onClick={handleEnableNotifications} className=&quot;btn-primary&quot;&gt;<br>            Enable<br>          &lt;/button&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>Step 6: Supabase Database Integration</h3><p>Since you’re using Supabase, here’s how to integrate push notifications with your database:</p><h4>Database Schema for FCM Tokens:</h4><pre>-- Create table for storing FCM tokens<br>CREATE TABLE user_fcm_tokens (<br>  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,<br>  user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,<br>  fcm_token TEXT NOT NULL,<br>  device_info JSONB DEFAULT &#39;{}&#39;,<br>  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),<br>  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),<br>  UNIQUE(user_id, fcm_token)<br>);<br><br>-- Enable RLS<br>ALTER TABLE user_fcm_tokens ENABLE ROW LEVEL SECURITY;<br>-- Policy for users to manage their own tokens<br>CREATE POLICY &quot;Users can manage their own FCM tokens&quot; ON user_fcm_tokens<br>  FOR ALL USING (auth.uid() = user_id);</pre><h4>Updated FCM Token Service for Supabase:</h4><pre>import { createClient } from &#39;@supabase/supabase-js&#39;<br><br>const supabase = createClient(<br>  import.meta.env.VITE_SUPABASE_URL,<br>  import.meta.env.VITE_SUPABASE_ANON_KEY<br>)<br>export class FCMTokenService {<br>  static async registerFCMToken() {<br>    try {<br>      const { data: { user } } = await supabase.auth.getUser()<br>      if (!user) throw new Error(&#39;User not authenticated&#39;)<br>      if (Notification.permission === &#39;granted&#39;) {<br>        const token = await getToken(messaging, {<br>          vapidKey: import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY<br>        });<br>        <br>        if (token) {<br>          await this.saveTokenToSupabase(user.id, token)<br>          return true<br>        }<br>      }<br>      return false<br>    } catch (error) {<br>      console.error(&#39;FCM token registration failed:&#39;, error)<br>      return false<br>    }<br>  }<br>  static async saveTokenToSupabase(userId, token) {<br>    try {<br>      const deviceInfo = {<br>        userAgent: navigator.userAgent,<br>        platform: navigator.platform,<br>        timestamp: new Date().toISOString()<br>      }<br>      const { error } = await supabase<br>        .from(&#39;user_fcm_tokens&#39;)<br>        .upsert({<br>          user_id: userId,<br>          fcm_token: token,<br>          device_info: deviceInfo,<br>          updated_at: new Date().toISOString()<br>        }, {<br>          onConflict: &#39;user_id,fcm_token&#39;<br>        })<br>      if (error) throw error<br>      console.log(&#39;FCM token saved to Supabase&#39;)<br>    } catch (error) {<br>      console.error(&#39;Failed to save FCM token to Supabase:&#39;, error)<br>      throw error<br>    }<br>  }<br>  static async clearUserTokens() {<br>    try {<br>      const { data: { user } } = await supabase.auth.getUser()<br>      if (!user) return<br>      const { error } = await supabase<br>        .from(&#39;user_fcm_tokens&#39;)<br>        .delete()<br>        .eq(&#39;user_id&#39;, user.id)<br>      if (error) throw error<br>      console.log(&#39;FCM tokens cleared from Supabase&#39;)<br>    } catch (error) {<br>      console.error(&#39;Failed to clear FCM tokens:&#39;, error)<br>    }<br>  }<br>  static setupForegroundNotifications() {<br>    onMessage(messaging, (payload) =&gt; {<br>      console.log(&#39;Foreground message received:&#39;, payload)<br>      <br>      if (Notification.permission === &#39;granted&#39;) {<br>        new Notification(payload.notification.title, {<br>          body: payload.notification.body,<br>          icon: payload.notification.icon || &#39;/icon-192x192.png&#39;,<br>          data: payload.data<br>        })<br>      }<br>    })<br>  }<br>}</pre><h3>Platform-Specific Configuration</h3><h4>iOS PWA Setup</h4><p><strong>Requirements for iOS notifications:</strong></p><ol><li><strong>Add to Home Screen</strong>: Users must add your PWA to their home screen</li><li><strong>HTTPS</strong>: Mandatory for all PWA features</li><li><strong>Web App Manifest</strong>: Must include proper configuration</li></ol><p>Update your manifest.json:</p><pre>{<br>  &quot;name&quot;: &quot;Your PWA Name&quot;,<br>  &quot;short_name&quot;: &quot;PWA&quot;,<br>  &quot;display&quot;: &quot;standalone&quot;,<br>  &quot;start_url&quot;: &quot;/&quot;,<br>  &quot;theme_color&quot;: &quot;#000000&quot;,<br>  &quot;background_color&quot;: &quot;#ffffff&quot;,<br>  &quot;icons&quot;: [<br>    {<br>      &quot;src&quot;: &quot;/icon-192x192.png&quot;,<br>      &quot;sizes&quot;: &quot;192x192&quot;,<br>      &quot;type&quot;: &quot;image/png&quot;,<br>      &quot;purpose&quot;: &quot;any maskable&quot;<br>    },<br>    {<br>      &quot;src&quot;: &quot;/icon-512x512.png&quot;,<br>      &quot;sizes&quot;: &quot;512x512&quot;,<br>      &quot;type&quot;: &quot;image/png&quot;,<br>      &quot;purpose&quot;: &quot;any maskable&quot;<br>    }<br>  ]<br>}</pre><p><strong>Apple-specific meta tags</strong> in index.html:</p><pre>&lt;meta name=&quot;apple-mobile-web-app-capable&quot; content=&quot;yes&quot;&gt;<br>&lt;meta name=&quot;apple-mobile-web-app-status-bar-style&quot; content=&quot;default&quot;&gt;<br>&lt;meta name=&quot;apple-mobile-web-app-title&quot; content=&quot;Your PWA&quot;&gt;<br>&lt;link rel=&quot;apple-touch-icon&quot; href=&quot;/apple-touch-icon.png&quot;&gt;</pre><h4>Android PWA Setup</h4><p><strong>Enhanced features for Android:</strong></p><ol><li><strong>Notification Channels</strong>: Better organization</li><li><strong>Rich Notifications</strong>: Custom actions and layouts</li><li><strong>Background Sync</strong>: Offline capability</li></ol><p>Update service worker for Android features:</p><pre>// In firebase-messaging-sw.js<br>messaging.onBackgroundMessage((payload) =&gt; {<br>  const notificationOptions = {<br>    body: payload.notification.body,<br>    icon: &#39;/icon-192x192.png&#39;,<br>    badge: &#39;/badge-72x72.png&#39;,<br>    tag: &#39;android-notification&#39;,<br>    requireInteraction: true, // Keep notification visible<br>    actions: [<br>      {<br>        action: &#39;view&#39;,<br>        title: &#39;View&#39;,<br>        icon: &#39;/action-view.png&#39;<br>      },<br>      {<br>        action: &#39;dismiss&#39;,<br>        title: &#39;Dismiss&#39;,<br>        icon: &#39;/action-dismiss.png&#39;<br>      }<br>    ],<br>    data: {<br>      url: payload.data?.url || &#39;/&#39;,<br>      timestamp: Date.now()<br>    }<br>  };<br><br>self.registration.showNotification(<br>    payload.notification.title,<br>    notificationOptions<br>  );<br>});</pre><h3>Development Testing</h3><h4><strong>1. Local HTTPS Setup</strong>:</h4><pre># Using Vite with HTTPS<br>npm run dev -- --https<br><br># Or use mkcert for local certificates<br>npm install -g mkcert<br>mkcert -install<br>mkcert localhost</pre><h4><strong>2. Test Notification Flow</strong></h4><pre>// Test component<br>function TestNotificationButton() {<br>  const testNotification = async () =&gt; {<br>    if (Notification.permission === &#39;granted&#39;) {<br>      new Notification(&#39;Test Notification&#39;, {<br>        body: &#39;This is a test notification&#39;,<br>        icon: &#39;/icon-192x192.png&#39;<br>      });<br>    }<br>  };<br><br>  return (<br>    &lt;button onClick={testNotification}&gt;<br>      Test Notification<br>    &lt;/button&gt;<br>  );<br>}</pre><h4><strong>3. Get FCM Token for Testing</strong></h4><pre>// Add this to your app to copy token for Firebase Console testing<br>function FCMTokenDisplay() {<br>  const [token, setToken] = useState(&#39;&#39;);<br>  <br>  useEffect(() =&gt; {<br>    const getToken = async () =&gt; {<br>      if (Notification.permission === &#39;granted&#39;) {<br>        const fcmToken = await getFCMToken();<br>        setToken(fcmToken);<br>      }<br>    };<br>    getToken();<br>  }, []);<br>  <br>  const copyToken = () =&gt; {<br>    navigator.clipboard.writeText(token);<br>    alert(&#39;Token copied to clipboard!&#39;);<br>  };<br>  <br>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;FCM Token: {token}&lt;/p&gt;<br>      &lt;button onClick={copyToken}&gt;Copy Token&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>Testing with Supabase Integration</h3><h4>Test Database-Triggered Notifications</h4><pre>// Component to test Supabase integration<br>function TestSupabaseNotification() {<br>  const sendViaSupabase = async () =&gt; {<br>    try {<br>      // Call your Supabase Edge Function<br>      const { data, error } = await supabase.functions.invoke(&#39;send-notification&#39;, {<br>        body: {<br>          title: &#39;Test from Supabase&#39;,<br>          body: &#39;This notification was sent via Supabase Edge Function&#39;,<br>          data: { source: &#39;test&#39; }<br>        }<br>      });<br>      <br>      if (error) throw error;<br>      console.log(&#39;Notification sent via Supabase:&#39;, data);<br>    } catch (error) {<br>      console.error(&#39;Failed to send notification via Supabase:&#39;, error);<br>    }<br>  };<br><br>return (<br>    &lt;button onClick={sendViaSupabase}&gt;<br>      Test Supabase Notification<br>    &lt;/button&gt;<br>  );<br>}</pre><h3>Firebase Console Testing</h3><h4><strong>1. Get FCM Token from Database</strong></h4><pre>-- Query to get FCM tokens for testing<br>SELECT fcm_token, device_info <br>FROM user_fcm_tokens <br>WHERE user_id = &#39;your-user-id&#39;;</pre><h4><strong>2. Send Test Message via Firebase Console</strong></h4><p>Firebase Console → Cloud Messaging → Send your first message<br>→ Notification title and text<br>→ Target: Single device (paste FCM token from database)<br>→ Send</p><h3>Production Deployment</h3><h4><strong>1. Build and Deploy</strong></h4><pre>npm run build   <br><br>/* Deploy to your hosting provider <br>   # For Firebase Hosting: firebase deploy  <br>   # For Netlify: netlify deploy --prod  <br>   # For Vercel: vercel --prod</pre><h4><strong>2. Test on Real Devices</strong></h4><ul><li><strong>iOS</strong>: Add to home screen, test notifications</li><li><strong>Android</strong>: Test in browser and as installed PWA</li><li><strong>Desktop</strong>: Test in Chrome, Firefox, Edge</li></ul><h3>Firebase Console Testing</h3><h4><strong>1. Send Test Message</strong></h4><p>Firebase Console → Cloud Messaging → Send your first message</p><h4><strong>2. Target Testing</strong></h4><p>Single device (FCM token)<br>User segment<br>Topic subscribers</p><h3>Common Issues</h3><h4>1. Notifications Not Appearing</h4><p><strong>Symptoms</strong>: FCM token generated but notifications not received</p><p><strong>Solutions</strong>:</p><pre>// Check service worker registration<br>navigator.serviceWorker.getRegistrations().then(registrations =&gt; {<br>  console.log(&#39;Service Workers:&#39;, registrations);<br>});<br><br>// Verify notification permission<br>console.log(&#39;Permission:&#39;, Notification.permission);<br>// Check for errors in service worker<br>navigator.serviceWorker.addEventListener(&#39;error&#39;, event =&gt; {<br>  console.error(&#39;SW Error:&#39;, event);<br>});</pre><h4>2. iOS Notifications Not Working</h4><p><strong>Symptoms</strong>: Works on Android but not iOS</p><p><strong>Solutions</strong>:</p><ul><li>Ensure PWA is added to home screen</li><li>Check Safari settings for notifications</li><li>Verify HTTPS certificate validity</li><li>Test with Safari Technology Preview</li></ul><h4>3. Service Worker Not Updating</h4><p><strong>Symptoms</strong>: Old service worker cached</p><p><strong>Solutions</strong>:</p><pre>// Force service worker update<br>if (&#39;serviceWorker&#39; in navigator) {<br>  navigator.serviceWorker.getRegistrations().then(registrations =&gt; {<br>    registrations.forEach(registration =&gt; {<br>      registration.update();<br>    });<br>  });<br>}</pre><h4>4. FCM Token Not Generated</h4><p><strong>Symptoms</strong>: getToken() returns null</p><p><strong>Solutions</strong>:</p><pre>// Debug token generation<br>import { getToken } from &#39;firebase/messaging&#39;;<br><br>async function debugTokenGeneration() {<br>  try {<br>    console.log(&#39;VAPID Key:&#39;, import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY);<br>    console.log(&#39;Permission:&#39;, Notification.permission);<br>    <br>    const registration = await navigator.serviceWorker.getRegistration();<br>    console.log(&#39;SW Registration:&#39;, registration);<br>    <br>    const token = await getToken(messaging, {<br>      vapidKey: import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY,<br>      serviceWorkerRegistration: registration<br>    });<br>    <br>    console.log(&#39;FCM Token:&#39;, token);<br>  } catch (error) {<br>    console.error(&#39;Token generation failed:&#39;, error);<br>  }<br>}</pre><h3>Performance Optimization</h3><h4>1. Lazy Load Firebase</h4><pre>// Load Firebase only when needed<br>async function loadFirebase() {<br>  if (!window.firebase) {<br>    const { initializeApp } = await import(&#39;firebase/app&#39;);<br>    const { getMessaging } = await import(&#39;firebase/messaging&#39;);<br>    <br>    const app = initializeApp(firebaseConfig);<br>    window.firebase = { app, messaging: getMessaging(app) };<br>  }<br>  <br>  return window.firebase;<br>}</pre><h4>2. Efficient Token Management</h4><pre>// Cache token in memory<br>let cachedToken = null;<br><br>export async function getFCMToken() {<br>  if (cachedToken) return cachedToken;<br>  <br>  cachedToken = await getToken(messaging, {<br>    vapidKey: VAPID_KEY<br>  });<br>  <br>  return cachedToken;<br>}</pre><h3>Security Best Practices</h3><h4>1. Environment Variables</h4><p><strong>Never expose sensitive data in client-side code:</strong></p><pre>// ❌ Wrong - sensitive data in client<br>const serviceAccount = {<br>  privateKey: &quot;-----BEGIN PRIVATE KEY-----...&quot;,<br>  clientEmail: &quot;firebase-adminsdk@project.iam.gserviceaccount.com&quot;<br>};<br><br>// ✅ Correct - only public config in client<br>const firebaseConfig = {<br>  apiKey: import.meta.env.VITE_FIREBASE_API_KEY,<br>  projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID<br>};</pre><h4>2. Token Validation</h4><p><strong>Client-side token management:</strong></p><pre>// Validate token format<br>function isValidFCMToken(token) {<br>  return token &amp;&amp; <br>         typeof token === &#39;string&#39; &amp;&amp; <br>         token.length &gt; 100 &amp;&amp; // FCM tokens are typically 160+ characters<br>         !token.includes(&#39; &#39;); // No spaces in valid tokens<br>}<br><br>// Token refresh handling<br>async function refreshFCMTokenIfNeeded() {<br>  try {<br>    const storedToken = localStorage.getItem(&#39;fcmToken&#39;);<br>    const tokenTimestamp = localStorage.getItem(&#39;fcmTokenTimestamp&#39;);<br>    <br>    // Refresh token if older than 24 hours<br>    const twentyFourHours = 24 * 60 * 60 * 1000;<br>    const now = Date.now();<br>    <br>    if (!storedToken || !tokenTimestamp || <br>        (now - parseInt(tokenTimestamp)) &gt; twentyFourHours) {<br>      <br>      const newToken = await getToken(messaging, {<br>        vapidKey: import.meta.env.VITE_WEBPUSH_NOTIFICATION_KEY<br>      });<br>      <br>      if (newToken) {<br>        localStorage.setItem(&#39;fcmToken&#39;, newToken);<br>        localStorage.setItem(&#39;fcmTokenTimestamp&#39;, now.toString());<br>      }<br>      <br>      return newToken;<br>    }<br>    <br>    return storedToken;<br>  } catch (error) {<br>    console.error(&#39;Token refresh failed:&#39;, error);<br>    return null;<br>  }<br>}</pre><h4>3. Rate Limiting</h4><p><strong>Implement client-side rate limiting:</strong></p><pre>class NotificationRateLimiter {<br>  constructor(maxNotifications = 10, timeWindow = 60000) { // 10 notifications per minute<br>    this.maxNotifications = maxNotifications;<br>    this.timeWindow = timeWindow;<br>    this.notifications = [];<br>  }<br>  <br>  canSendNotification() {<br>    const now = Date.now();<br>    <br>    // Remove old notifications outside time window<br>    this.notifications = this.notifications.filter(<br>      timestamp =&gt; (now - timestamp) &lt; this.timeWindow<br>    );<br>    <br>    // Check if under limit<br>    return this.notifications.length &lt; this.maxNotifications;<br>  }<br>  <br>  recordNotification() {<br>    this.notifications.push(Date.now());<br>  }<br>}<br>const rateLimiter = new NotificationRateLimiter();<br><br>function sendNotificationWithRateLimit(title, options) {<br>  if (!rateLimiter.canSendNotification()) {<br>    console.warn(&#39;Notification rate limit exceeded&#39;);<br>    return false;<br>  }<br>  <br>  if (Notification.permission === &#39;granted&#39;) {<br>    new Notification(title, options);<br>    rateLimiter.recordNotification();<br>    return true;<br>  }<br>  <br>  return false;<br>}</pre><h4>4. Content Sanitization</h4><p><strong>Sanitize notification content:</strong></p><pre>function sanitizeNotification(notification) {<br>  return {<br>    title: notification.title?.substring(0, 100) || &#39;Notification&#39;,<br>    body: notification.body?.substring(0, 300) || &#39;&#39;,<br>    icon: isValidUrl(notification.icon) ? notification.icon : &#39;/default-icon.png&#39;<br>  };<br>}<br><br>function isValidUrl(string) {<br>  try {<br>    new URL(string);<br>    return true;<br>  } catch (_) {<br>    return false;<br>  }<br>}</pre><h3>Conclusion</h3><p>By following this approach, you gain a clear, reliable, and production ready push notification system for your PWA.</p><p>You get cross platform support, secure token management, structured debugging, and a foundation that scales from simple manual notifications to fully automated backend workflows.</p><p>Vibe coding is excellent for getting started, but durable systems require understanding. This guide is meant to bridge that gap.</p><p>Remember to:</p><ol><li><strong>Test thoroughly</strong> on all target platforms</li><li><strong>Monitor user engagement</strong> and adjust notification frequency</li><li><strong>Respect user preferences</strong> and provide easy opt-out options</li><li><strong>Keep dependencies updated</strong> for security and performance</li><li><strong>Follow platform guidelines</strong> for notification best practices</li></ol><p>For additional resources and detailed documentation, visit:</p><ul><li><a href="https://firebase.google.com/docs/cloud-messaging">Firebase Cloud Messaging Documentation</a></li><li><a href="https://tools.ietf.org/html/rfc8030">Web Push Protocol Specification</a></li><li><a href="https://web.dev/push-notifications-overview/">PWA Notification Best Practices</a></li><li><a href="https://serviceworke.rs/">Service Worker Cookbook</a></li></ul><p>Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a515965372f7" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/complete-guide-push-notifications-in-pwa-with-firebase-cloud-messaging-a515965372f7">Complete Guide: Push Notifications in PWA with Firebase Cloud Messaging</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does Lovable create a lovable development experience?]]></title>
            <link>https://blog.coffeeinc.in/does-lovable-create-a-lovable-development-experience-826cc1850f80?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/826cc1850f80</guid>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[lovable]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 10:14:23 GMT</pubDate>
            <atom:updated>2025-08-26T10:14:23.368Z</atom:updated>
            <content:encoded><![CDATA[<h4>From vibe coding to production</h4><p>I have built several applications using Lovable, taking them from initial concept to production-ready deployments. The journey has been a mixed experience with both bright spots and challenges. While it can provide a genuinely rewarding development experience, the repetitive tasks and limitations can also be frustrating at times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Im0MuKSAC3efd-GMh0mFGA.png" /></figure><p>I keep seeing the same pattern: people either think it is magic that will build their entire app, or they dismiss it completely after hitting the first roadblock. Both perspectives are misguided.</p><h3>Where It Really Shines</h3><h4><strong>Quick Working Prototypes</strong></h4><p>Lovable really stands out here. I am not talking about basic mockups, I mean actual working apps with real login systems, smooth database connections to Supabase, realistic sample data, working menus, and buttons that actually do something when you click them.</p><p>When you need to show your team an idea or test something out, it is incredibly fast, way faster than building it from scratch or just a Figma design. We built complete app workflows with all the screens and realistic data in just one day. That is quite impressive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9lv7TviZ8E9fusOkPSV4w.png" /></figure><h4>An Interactive Build</h4><p>If you are testing ideas, building demos, or need to show quick progress or a working prototype, Lovable is a game-changer. It will not build your final production app, but it will give you something interactive to work with much faster than regular development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2r4jB7WXgKdoSVaYQjl43g.png" /><figcaption>A quick prototype of a Product Catalog for enquiries (Made with lovable in minutes)</figcaption></figure><h3>Where Things Fall Apart</h3><h4>External Integrations Are a Nightmare</h4><p>The moment you need to connect to anything outside Lovable’s ecosystem, you are on your own. Want push notifications? Email services? Custom APIs? Good luck with that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEP6KXaKeOW9v4v5aQ8gFA.png" /><figcaption>Doesn’t support Google sheets integration out of the box.</figcaption></figure><p>There is a “Fix by Me” button that handles basic syntax errors, but it has no clue about configuration issues or external service setup. You will end up doing that work manually anyway.</p><h4>The Loop Problem</h4><p>This is where it gets frustrating. When you try to scale beyond basic prototypes, Lovable starts repeating the same failed fixes over and over. I have watched it attempt the same Supabase integration fix literally 10 times in a row.</p><p><strong>My workflow now: </strong>when it starts looping, I stop, figure out the fix myself (Stack Overflow is still your friend), implement it manually, then continue with AI assistance. Trying to prompt your way out of these loops only wastes time.</p><h4>Component Chaos</h4><p>Lovable treats every screen like it is completely separate. Instead of creating reusable components, it copies the same code everywhere. You end up with:</p><ul><li>The same button component written 15 different ways</li><li>Styling scattered across files</li><li>A codebase that is impossible to maintain</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*CzfSsNyssPj_roQk" /></figure><p>Want to change button styling across your app? Hope you enjoy editing 20 files.</p><h4><strong>Over-engineering</strong></h4><p>Need a simple two-line fix? Lovable will rewrite your entire component. I have seen it change perfectly working code just because it felt like “improving” things. You have to babysit every change because it will mess with things you did not ask it to touch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*si12A0jefvWzHgLnWnIsCw.png" /></figure><h3>Version Control and Syncing Issues</h3><h4>The Good Part</h4><p>Lovable’s commit system is actually nice — every prompt is one commit, so you can revert when things break. <em>And they will break.</em></p><h4>The Annoying Part</h4><p>Here’s the catch: when you revert code changes, your Supabase database doesn’t revert with it. So you get this weird state where your UI is back to working, but your database schema is still broken from three iterations ago.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXwQ5orjbonemzYTqlWI6g.png" /></figure><p>After a few rounds of changes, you’re basically managing two different version control systems. It gets messy fast.</p><h3>Everything Looks the Same</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*h0QEryT9LocKyD00bjL4Zg.png" /></figure><p>All Lovable apps have this… vibe. The styling patterns, layouts, even color choices follow similar templates. You can break out of it, but it takes effort and specific prompting from the start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxmQ3dGenvsqT77A_6IpnQ.png" /><figcaption>That very same shadcn popup (Product Catalog project)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6PBk5YACiFTcb6D0a8EOg.png" /><figcaption>Generate New Report (ReportGen project)</figcaption></figure><p>If you want something that doesn’t look like every other Lovable app, plan for custom styling work and be super specific about design requirements upfront.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6EyQzpGtYTnTb7MMTc_2YA.png" /><figcaption>ReportGen Dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9QIqsq_0jw3DSs-HllrqAQ.png" /><figcaption>Construction Management Dashboard</figcaption></figure><h3>How I Actually Use It Now</h3><p>Lovable is great for a quick start, but it all comes down to your spec.</p><ol><li>Create a spec sheet that you can adhere to.</li><li>Identify integration points early, anything external I will handle manually.</li><li>Use Lovable for initial prototyping (it’s genuinely good here).</li><li>Plan “human developer” phases for scaling and production work.</li><li>Keep the codebase clean, don’t let AI create component chaos.</li></ol><p>Lovable is a development accelerator, not a replacement for learning to code. Some key tips to keep in mind:</p><ul><li>Recognize when to step in and solve problems manually.</li><li>Don’t get stuck in debugging loops, sometimes the old way is faster. Get into the code and sort it out yourself.</li><li>Plan for manual work from the beginning, don’t rely 100% on AI.</li></ul><h3>Real Talk</h3><p>Lovable speeds up certain parts of development, but you still need to know how to code. It is great for prototypes and getting started quickly, but anything you actually ship to users will need human intervention.</p><p>The platforms will get better, probably a lot better. But right now, the winning approach combines AI assistance with solid development fundamentals. Know when to use each approach.</p><p>For now, treat tools like Lovable as really good kickstarters that get you moving fast, but don’t expect them to handle the complex production stuff. That’s still on us, and honestly, that’s fine.</p><p>The future is definitely interesting, but we are not at “describe an app and get production code” yet. Until then, it’s about finding the right balance between AI assistance and traditional development skills.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=826cc1850f80" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/does-lovable-create-a-lovable-development-experience-826cc1850f80">Does Lovable create a lovable development experience?</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Annotation System for Data Extraction: System Thinking for Interactive Interfaces]]></title>
            <link>https://blog.coffeeinc.in/building-an-annotation-system-for-data-extraction-system-thinking-for-interactive-interfaces-b7a6145a3955?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7a6145a3955</guid>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 13:43:52 GMT</pubDate>
            <atom:updated>2025-07-18T12:26:24.510Z</atom:updated>
            <content:encoded><![CDATA[<h4>Where System Design, Grade School Math, State Data and Event Patterns meet</h4><p>Recently, I found myself building an annotation module, which was a key part of the workflow pipeline for <a href="https://www.coffeeinc.in/products/adeos-fe/">Adeos</a>. And let me tell you, this project completely changed how I think about interface design.</p><p>Here’s the thing about annotations: they look very simple on the surface. User draws a rectangle, marks an area, done. Right? Or so I thought, until I digged deeper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hgsa44mCqnDsISVb8jV2Qg.png" /></figure><p>Underneath that simplicity is this whole ecosystem that has to transform static documents into responsive, interactive canvases. I actually had to dust off my math skills for this one, and honestly, I am glad I had “Everything You Need to Ace Math in One Big Fat Notebook” sitting in the office library.</p><p><a href="https://www.amazon.in/Everything-You-Need-Math-Notebook-ebook/dp/B07BGGB9DX">Everything You Need to Ace Math in One Big Fat Notebook: The Complete Middle School Study Guide (Big Fat Notebooks)</a></p><blockquote>This book isn’t about coding or programming concepts, it is simply a great resource that simplifies the math we learned in our school days, making those foundational concepts easier to understand and apply.</blockquote><p>But here’s why I mention it: those basic concepts around coordinate geometry and transformations? They are very important when you are building systems like this.</p><p>In this article, I attempt to document the design patterns and system thinking that went into building an annotation system that actually feels natural and responsive. Because once you understand what’s happening under the hood, you realize that building great interactive interfaces is really about bridging the gap between human intuition and precise digital representation.</p><h3>I. Foundation: The System Design</h3><p>When building an annotation system, we are essentially creating a multi-layered interaction framework. The annotation system follows a clear separation of concerns through distinct layers:</p><ul><li><strong>Presentation Layer<em> (spatial representation)</em></strong>: Handles visual rendering and immediate user feedback</li><li><strong>Interaction Layer <em>(user interaction orchestration)</em></strong>: Orchestrates user input and coordinate transformations</li><li><strong>State Management Layer <em>(state persistence)</em></strong>: Handles persistence and synchronization</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UG3vgMPYA5jfvS2YtFjXw.jpeg" /></figure><p>This layered approach allows each concern to evolve independently while maintaining clear interfaces between components.</p><h4>The Core Data Model</h4><p>The annotation data model serves as the foundation of our entire system. Rather than thinking of annotations as simple UI elements, we design them as spatial entities with behavioral contracts:</p><pre>interface Annotation {<br>  id: string;                    // Identity layer<br>  type: AnnotationType;          // Behavioral classification  <br>  bbox: [number, number, number, number]; // Spatial contract<br>  rotation?: number;             // Transformation state<br>  isSelected?: boolean;          // Interaction state<br>  isAdjusting?: boolean;         // Manipulation mode<br>}</pre><p>This interface represents an annotation. every annotation must fulfill these spatial and behavioral requirements.</p><ul><li>The bbox coordinates establish our spatial coordinate system,</li><li>The type determines the annotation’s behavioral characteristics and visual representation.</li></ul><h3>II. Coordinate System Design (The Math Behind it)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TgRHtbvtbz6ldvqiScr2nw.png" /></figure><p>One of the most critical design decisions involves creating the coordinate transformation system. This isn’t just about converting mouse coordinates, but it is about establishing a mathematical framework that remains consistent across all system states.</p><h4>Dual Coordinate System Design</h4><p>We design our system around two distinct coordinate spaces:</p><ol><li>Screen Space (what users see) and</li><li>Document Space (where annotations actually exist).</li></ol><p>This design separation ensures annotations maintain their relationships to content regardless of user interface transformations. The transformation system handles zoom, pan, and rotation operations through a centralized coordinate transformation service:</p><pre>const useCoordinateTransformation = (stageRef: RefObject&lt;Konva.Stage&gt;) =&gt; {<br>  const screenToDocumentCoordinates = useCallback((e: KonvaEventObject&lt;MouseEvent&gt;) =&gt; {<br>    const stage = stageRef.current;<br>    const pointerPos = stage.getPointerPosition();<br>    <br>    // Apply inverse transformation matrix<br>    const transform = stage.getAbsoluteTransform().copy();<br>    transform.invert();<br>    <br>    return transform.point(pointerPos);<br>  }, [stageRef]);<br><br>  return { screenToDocumentCoordinates };<br>};</pre><p>This design pattern ensures that all coordinate-dependent operations remain consistent and predictable, regardless of viewport transformations.</p><h3>III. Interaction System: Handling User Events</h3><p>User interaction in annotation systems needs careful planning. Think of it like managing different modes in a drawing app:</p><ul><li>ready to draw,</li><li>actively drawing, and</li><li>finishing up.</li></ul><p>We organize this as a state machine that tracks what the user is currently doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*phKtH2TDa9DjrpnUuL6DGQ.png" /></figure><h4>Drawing State Management</h4><p>The drawing process follows a simple but well-organized pattern with four clear states:</p><ul><li><strong>Idle State</strong>: Just waiting. User hasn’t started drawing yet</li><li><strong>Drawing State</strong>: User is actively dragging to create a rectangle</li><li><strong>Finalizing State</strong>: User finished dragging, and we are checking if it’s valid</li><li><strong>Adjusting State</strong>: User is resizing or moving an existing annotation</li></ul><p>Each state knows what can happen next and what actions are allowed. This prevents confusing situations and keeps the user experience smooth:</p><pre>const useAnnotationDrawing = () =&gt; {<br>const [drawingState, setDrawingState] = useState(&#39;idle&#39;);<br>const [previewAnnotation, setPreviewAnnotation] = useState&lt;number[] | null&gt;(null);<br><br><br>const handleMouseDown = useCallback((e: KonvaEventObject&lt;MouseEvent&gt;) =&gt; {<br>    const documentPos = screenToDocumentCoordinates(e);<br>    // Transition to drawing state<br>    setDrawingState(&#39;drawing&#39;);<br>    setPreviewAnnotation([documentPos.x, documentPos.y, documentPos.x, documentPos.y]);<br>  }, []);<br><br>const handleMouseUp = useCallback(() =&gt; {<br>    if (drawingState !== &#39;drawing&#39;) return;<br>    <br>    // Transition to finalizing state<br>    setDrawingState(&#39;finalizing&#39;);<br>    <br>    const [x1, y1, x2, y2] = normalizeRectangle(previewAnnotation);<br>    <br>    if (Math.abs(x2 - x1) &gt; MIN_ANNOTATION_SIZE) {<br>      createAnnotation({ bbox: [x1, y1, x2, y2] });<br>    }<br>    <br>    // Return to idle state<br>    setDrawingState(&#39;idle&#39;);<br>    setPreviewAnnotation(null);<br>  }, [drawingState, previewAnnotation]);<br>  return { drawingState, previewAnnotation, handleMouseDown, handleMouseUp };<br>};</pre><p>Think of this like a traffic light system: each state knows exactly what comes next and prevents invalid transitions. When a user clicks, we move from “waiting” to “drawing.” When they release, we move to “finishing” and then back to “waiting.” This organized approach prevents bugs and creates predictable behavior.</p><h4>Event Delegation Pattern</h4><p>Rather than handling events at individual annotation components, we design a centralized event delegation system. This pattern improves performance and simplifies event coordination across multiple annotations.</p><h3>IV. Visual System: Rendering and Performance Design</h3><p>The visual system must handle potentially hundreds of annotations while maintaining smooth interaction. We solve this through a hierarchical rendering system with performance optimization patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6YyMnTZvZipsJYkaL7hOg.png" /></figure><h4>Component Hierarchy Design</h4><p>The rendering system follows a clear hierarchy:</p><ul><li><strong>AnnotationCanvas</strong>: Root container managing viewport and transformations</li><li><strong>AnnotationLayer</strong>: Handles annotation collection rendering and culling</li><li><strong>AnnotationRect</strong>: Individual annotation rendering and local interactions</li><li><strong>SelectionHandles</strong>: Manipulation interface for selected annotations</li></ul><p>Each level has specific responsibilities and optimization strategies:</p><pre>const AnnotationLayer = memo(({ annotations, viewportBounds }) =&gt; {<br>  // Design pattern: Viewport culling for performance<br>  const visibleAnnotations = useMemo(() =&gt; {<br>    return annotations.filter(annotation =&gt; {<br>      const [x1, y1, x2, y2] = annotation.bbox;<br>      return rectanglesIntersect({ x1, y1, x2, y2 }, viewportBounds);<br>    });<br>  }, [annotations, viewportBounds]);<br><br>return (<br>    &lt;Group&gt;<br>      {visibleAnnotations.map(annotation =&gt; (<br>        &lt;AnnotationRect key={annotation.id} annotation={annotation} /&gt;<br>      ))}<br>    &lt;/Group&gt;<br>  );<br>});</pre><h4>Visual Type System Design</h4><p>We design a visual type system that provides consistent annotation classification. This isn’t just about colors — it’s about establishing a visual language that users can learn and predict:</p><pre>const getAnnotationColors = (type: AnnotationType, isSelected: boolean = false) =&gt; {<br>  const typeSystemColors = {<br>    TEXT: { stroke: &quot;#22c55e&quot;, fill: &quot;rgba(34, 197, 94, 0.15)&quot; },<br>    TABLE: { stroke: &quot;#eab308&quot;, fill: &quot;rgba(234, 179, 8, 0.15)&quot; },<br>    DIAGRAM: { stroke: &quot;#a855f7&quot;, fill: &quot;rgba(168, 85, 247, 0.15)&quot; },<br>    FIELDS: { stroke: &quot;#3b82f6&quot;, fill: &quot;rgba(59, 130, 246, 0.15)&quot; }<br>  };<br>  <br>  return typeSystemColors[type];<br>};</pre><p>This visual type system creates consistency across the entire annotation ecosystem.</p><h3>V. State Management: The Data Flow Design</h3><p>Effective annotation systems require sophisticated state management. We design this as a centralized store with clear data flow patterns and update strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7jz9DX216smr9YXLuDtLA.png" /></figure><h4>Store Design Pattern</h4><p>The annotation store follows a domain-driven design where annotations are organized by their natural boundaries (pages) with efficient access patterns:</p><pre>const useAnnotationStore = () =&gt; {<br>  const [store, setStore] = useState({<br>    annotations: {},  // Keyed by page for efficient access<br>    selection: { selectedIds: new Set(), activeId: null },<br>    drawing: { mode: false, type: AnnotationType.TEXT }<br>  });<br>// Design pattern: Immutable updates with referential integrity<br>  const createAnnotation = useCallback((pageNumber: number, annotation) =&gt; {<br>    const newAnnotation = { ...annotation, id: generateUniqueId() };<br>    <br>    setStore(prev =&gt; ({<br>      ...prev,<br>      annotations: {<br>        ...prev.annotations,<br>        [pageNumber]: [...(prev.annotations[pageNumber] || []), newAnnotation]<br>      }<br>    }));<br>    <br>    return newAnnotation.id;<br>  }, []);<br>  return { store, createAnnotation };<br>};</pre><h4>Selection System Design</h4><p>Selection management requires careful design consideration because it affects multiple system layers. We design this as a centralized selection service that coordinates between visual feedback, interaction capabilities, and keyboard shortcuts:</p><pre>const useAnnotationSelection = () =&gt; {<br>  const [selectionState, setSelectionState] = useState({<br>    primary: null,      // Primary selected annotation<br>    secondary: new Set(), // Multi-selection set<br>    adjusting: null     // Currently being manipulated<br>  });<br>const selectAnnotation = useCallback((annotationId: string, isMultiSelect = false) =&gt; {<br>    setSelectionState(prev =&gt; {<br>      if (isMultiSelect) {<br>        const newSecondary = new Set(prev.secondary);<br>        newSecondary.add(annotationId);<br>        return { ...prev, secondary: newSecondary };<br>      }<br>      <br>      return { ...prev, primary: annotationId, secondary: new Set() };<br>    });<br>  }, []);<br>  return { selectionState, selectAnnotation };<br>};</pre><h3>VI. Advanced Interaction Patterns</h3><p>Professional annotation systems require advanced interaction patterns. We design these as composable behaviors that can be mixed and matched based on application requirements.</p><h4>Manipulation Interface Design</h4><p>The manipulation interface provides handles for resizing and moving annotations. This is designed as a separate concern that activates based on selection state:</p><pre>const SelectionHandles = ({ rect, zoomLevel, onResize }) =&gt; {<br>  const handleSize = 8 / zoomLevel;  // Scale-invariant handle size<br>  <br>  const handlePositions = useMemo(() =&gt; [<br>    { x: rect.x - handleSize/2, y: rect.y - handleSize/2, cursor: &#39;nw-resize&#39; },<br>    { x: rect.x + rect.width - handleSize/2, y: rect.y - handleSize/2, cursor: &#39;ne-resize&#39; },<br>    { x: rect.x + rect.width - handleSize/2, y: rect.y + rect.height - handleSize/2, cursor: &#39;se-resize&#39; },<br>    { x: rect.x - handleSize/2, y: rect.y + rect.height - handleSize/2, cursor: &#39;sw-resize&#39; }<br>  ], [rect, handleSize]);<br>  <br>  return (<br>    &lt;Group&gt;<br>      {handlePositions.map((handle, index) =&gt; (<br>        &lt;Rect <br>          key={index} <br>          {...handle} <br>          width={handleSize} <br>          height={handleSize}<br>          onMouseDown={(e) =&gt; startResize(e, index)}<br>        /&gt;<br>      ))}<br>    &lt;/Group&gt;<br>  );<br>};</pre><h4>Keyboard Interaction System</h4><p>We design keyboard interactions as a global service that coordinates with the selection system:</p><pre>const useAnnotationKeyboardShortcuts = () =&gt; {<br>  const { selectionState, deleteAnnotation, duplicateAnnotation } = useAnnotationStore();<br>  <br>  useEffect(() =&gt; {<br>    const handleKeyDown = (e: KeyboardEvent) =&gt; {<br>      // Design guard: Don&#39;t interfere with form inputs<br>      if (e.target instanceof HTMLInputElement) return;<br>      <br>      const keyboardActions = {<br>        &#39;Delete&#39;: () =&gt; deleteAnnotation(selectionState.primary),<br>        &#39;Escape&#39;: () =&gt; clearSelection(),<br>        &#39;d&#39;: (e) =&gt; e.ctrlKey &amp;&amp; duplicateAnnotation(selectionState.primary)<br>      };<br>      <br>      const action = keyboardActions[e.key];<br>      if (action) {<br>        action(e);<br>        e.preventDefault();<br>      }<br>    };<br>    <br>    document.addEventListener(&#39;keydown&#39;, handleKeyDown);<br>    return () =&gt; document.removeEventListener(&#39;keydown&#39;, handleKeyDown);<br>  }, [selectionState]);<br>};</pre><h3>VII. Scaling Beyond</h3><p>There are a few features that we are looking at currently for a better user experience. While they do not affect the core flow of the annotation system, these features allow for a much more seamless flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtp46nr2RM0pa__4Rr7VPA.png" /></figure><h4>Undo/Redo</h4><p>We design the undo/redo system using the Command pattern, which encapsulates each operation as a reversible command:</p><pre>interface AnnotationCommand {<br>  type: &#39;CREATE&#39; | &#39;UPDATE&#39; | &#39;DELETE&#39;;<br>  execute: () =&gt; void;<br>  undo: () =&gt; void;<br>  payload: {<br>    pageNumber: number;<br>    annotation: Annotation;<br>    previousState?: Annotation;<br>  };<br>}<br>const useCommandHistory = () =&gt; {<br>  const [commandStack, setCommandStack] = useState&lt;AnnotationCommand[]&gt;([]);<br>  const [currentIndex, setCurrentIndex] = useState(-1);<br>  <br>  const executeCommand = useCallback((command: AnnotationCommand) =&gt; {<br>    command.execute();<br>    <br>    setCommandStack(prev =&gt; {<br>      const newStack = prev.slice(0, currentIndex + 1);<br>      return [...newStack, command];<br>    });<br>    <br>    setCurrentIndex(prev =&gt; prev + 1);<br>  }, [currentIndex]);<br>  <br>  const undoCommand = useCallback(() =&gt; {<br>    if (currentIndex &gt;= 0) {<br>      commandStack[currentIndex].undo();<br>      setCurrentIndex(prev =&gt; prev - 1);<br>    }<br>  }, [commandStack, currentIndex]);<br>  <br>  return { executeCommand, undoCommand, canUndo: currentIndex &gt;= 0 };<br>};</pre><h4>Collaborative System Design</h4><p>For real-time collaboration, we design a conflict resolution system that handles concurrent modifications:</p><pre>interface CollaborativeAnnotation extends Annotation {<br>  userId: string;<br>  lastModified: number;<br>  version: number;<br>}<br>const useCollaborativeAnnotations = () =&gt; {<br>  const [annotationStore, setAnnotationStore] = useState&lt;Map&lt;string, CollaborativeAnnotation&gt;&gt;(new Map());<br>  const [conflictResolution, setConflictResolution] = useState&lt;Map&lt;string, &#39;local&#39; | &#39;remote&#39;&gt;&gt;(new Map());<br>  <br>  const handleRemoteUpdate = useCallback((remoteAnnotation: CollaborativeAnnotation) =&gt; {<br>    setAnnotationStore(prev =&gt; {<br>      const localAnnotation = prev.get(remoteAnnotation.id);<br>      <br>      // Design decision: Version-based conflict detection<br>      if (localAnnotation &amp;&amp; localAnnotation.version &gt; remoteAnnotation.version) {<br>        setConflictResolution(conflicts =&gt; <br>          conflicts.set(remoteAnnotation.id, &#39;local&#39;)<br>        );<br>        return prev; // Keep local version<br>      }<br>      <br>      return new Map(prev).set(remoteAnnotation.id, remoteAnnotation);<br>    });<br>  }, []);<br>  <br>  return { annotationStore, handleRemoteUpdate, conflictResolution };<br>};</pre><h3>Design Patterns and Best Practices</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXN27q9Zrsl6FR0ukOKhHw.png" /></figure><p>Through building annotation systems, several key design patterns emerge:</p><h4>Separation of Concerns</h4><ul><li><strong>Spatial Logic</strong>: Coordinate transformations and geometric calculations</li><li><strong>Interaction Logic</strong>: User input handling and state transitions</li><li><strong>Visual Logic</strong>: Rendering optimization and visual feedback</li><li><strong>Business Logic</strong>: Annotation lifecycle and validation rules</li></ul><h4>Performance Patterns</h4><ul><li><strong>Viewport Handling</strong>: Only render visible annotations</li><li><strong>Memoization</strong>: Cache expensive calculations</li><li><strong>Event Delegation</strong>: Centralized event handling</li><li><strong>Lazy Loading</strong>: Load annotation data on demand</li></ul><h4>Extensibility Patterns</h4><ul><li><strong>Plugin System</strong>: Allow custom annotation types</li><li><strong>Hook Composition</strong>: Reusable behavior composition</li><li><strong>Configuration Objects</strong>: Customizable system behavior</li><li><strong>Event System</strong>: Loosely coupled component communication</li></ul><h3>Closing Thoughts</h3><p>After months of building this annotation system, here’s what I have learned: Every single design decision I made directly impacted whether users felt like they were working with a precise, natural tool or fighting against a clunky interface. There is no middle ground with interactive systems like this.</p><p>The patterns I have shared here aren’t just for annotation systems. They’re the foundation for any interface where users need to manipulate spatial information, whether that’s a simple PDF markup tool or a complex collaborative design platform. The core insight that changed everything for me was realizing that annotations aren’t just UI components sitting on a page. They’re spatial entities with their own behavioral contracts and complex requirements that demand thoughtful system architecture.</p><p>So the next time you are using any kind of drawing or annotation tool, something like Canva, maybe you will think about all the design decisions happening in the background. And if you are building something similar, I hope these patterns will give you a solid foundation to work from.</p><p>Off to the next complexity, signing off, your friendly neighbourhood frontend dev, Vijay.</p><p><em>At </em><a href="https://coffeeinc.in/"><em>Coffee</em></a><em>, we are working on </em><a href="https://www.coffeeinc.in/products/adeos-fe/"><em>Adeos</em></a><em>, a data extraction tool that can be used to extract key information from engineering drawings. If you are interested to learn more, reach out to us. This annotation editor is part of the Adeos workflow.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7a6145a3955" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/building-an-annotation-system-for-data-extraction-system-thinking-for-interactive-interfaces-b7a6145a3955">Building an Annotation System for Data Extraction: System Thinking for Interactive Interfaces</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yet Another Tutorial: Getting Started with Docker]]></title>
            <link>https://blog.coffeeinc.in/yet-another-tutorial-getting-started-with-docker-4a3b68905647?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a3b68905647</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 11:27:48 GMT</pubDate>
            <atom:updated>2025-06-05T11:27:48.894Z</atom:updated>
            <content:encoded><![CDATA[<h4>Kick starting your journey with containerizing your apps</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exbyZsZhKe2szjUvyLlG5A.png" /></figure><p>You have built an amazing web application. It works perfectly on your machine, but when your teammate tries to run it, they get dependency errors. When you deploy to staging, the Node.js version is different. In production, a missing system library breaks everything.</p><p>Sound familiar?</p><p>This is exactly where Docker shines. It brings consistency to your workflow by packaging your app, along with all its dependencies, into a single, standardized unit called a <strong>container</strong>. Whether you are running it on your laptop, staging server, or cloud production environment, it works the same, every time.</p><h3>Docker ≈ Shipping Containers</h3><p>Docker containers are like modern shipping containers for code:</p><ul><li><strong>All-In-One Package:</strong> A shipping container holds goods; a Docker container holds an app with all its dependencies.</li><li><strong>Works Anywhere:</strong> A shipping container moves between ships, trucks, and trains without repacking; a Docker container moves between different environments without modification.</li><li><strong>Standardized &amp; Isolated:</strong> Every shipping container looks the same outside; every Docker container runs the same across systems.</li><li><strong>Easy to Scale:</strong> Need more capacity? Load more shipping containers. Need to handle more traffic? Run more Docker containers.</li><li><strong>Reduces Conflicts:</strong> Without standard containers, shipments will need custom handling for each and every item. Without Docker, you will need to customize every server environment to suit the apps needs to run.</li></ul><h3>Why Use Docker?</h3><p>Docker isn’t just another tool, it is a solution to the most frustrating parts of application development:</p><ul><li>No more “it works here but not there” headaches.</li><li>Faster, more reliable deployments.</li><li>Apps can scale effortlessly to handle more traffic.</li></ul><p>Now, that you know the benefits of Docker, let us walk through the process of containerizing your application.</p><h4>Step 1: Install Docker</h4><p>First, ensure Docker is installed on your machine.</p><ul><li>Download Docker Desktop from Docker’s <a href="https://www.docker.com/">official website</a>.</li><li>If you’re using a Mac, it’s recommended to install Docker using Homebrew with the command brew install --cask docker.</li><li>Alternatively, you can use Podman by following the <a href="https://podman.io/getting-started/installation">Podman installation guide</a>.</li></ul><h4>Step 2: Create a Dockerfile</h4><p>In your application’s root folder, create a file named <strong>Dockerfile</strong> and add the following content. For example, in my case, I am using a React application, so my Dockerfile content will look like this:</p><pre># Use the Node.js 20.13.1 base image<br>FROM node:20.13.1<br><br># Set the working directory inside the container<br>WORKDIR /app<br><br># Copy package files and install dependencies<br>COPY package*.json ./<br>RUN npm install<br><br># Copy the entire application code<br>COPY . .<br><br># Build the application<br>RUN npm run build<br><br># Expose the port your app runs on<br>EXPOSE 3000<br><br># Command to start the application<br>CMD [&quot;npm&quot;, &quot;start&quot;]</pre><p>This Dockerfile follows a streamlined process that minimizes the final image size, ensuring faster builds and deployments.</p><p>You can check for docker file templates at the <a href="https://dockerfile.github.io/">Dockerfile Project website</a></p><p><a href="https://dockerfile.github.io/">Dockerfile Project</a></p><h4>Step 3: Build the Docker Image</h4><p>Navigate to your project directory in the terminal and build the Docker image:</p><pre>docker build -t &lt;ImageName&gt; .</pre><p><strong>Example:</strong></p><pre>docker build -t myapp .</pre><p>This creates an image named myapp. The . at the end specifies the current directory as the build context.</p><h4>Step 4: Run a Docker Container</h4><p>Once the image is built, run a Docker container using the following command:</p><pre>docker run --name &lt;ContainerName&gt; -p &lt;LocalPort&gt;:&lt;ExposePort&gt; -d &lt;ImageName&gt;</pre><p><strong>Example:</strong></p><pre>docker run --name myapp -p 3000:3000 -d myapp</pre><p>This command maps port 3000 on your local machine to port 3000 inside the container. Access your app by visiting <a href="http://localhost:3000/"><strong>http://localhost:3000</strong></a>.</p><p>To stop a running Docker container, you can use the docker stop command followed by either the container ID or name.</p><p>Here’s the command to stop it:</p><pre>docker stop myapp</pre><p>Alternatively, you can use the container ID that was returned when you started it:</p><pre>docker stop 7530a48c0ecd*******************</pre><p>Either command will gracefully stop the container. Docker will send a SIGTERM signal to the main process in the container and wait for it to shut down (with a default timeout of 10 seconds before forcing it to stop with SIGKILL).</p><p>If you want to remove the container after stopping it (so you can create a new one with the same name later), you can use:</p><pre>docker rm myapp</pre><p>Or to stop and remove in a single command:</p><pre>docker rm -f myapp</pre><h3>Conclusion</h3><p>Docker transforms application development from “works on my machine” to “works everywhere, every time.” By containerizing your applications, you eliminate environment inconsistencies, simplify deployments, and create a foundation for scalable, maintainable software.</p><p>Start with a simple application, master the basics, then gradually adopt more advanced patterns as your needs grow. Your future self, and your team, will thank you for the consistency and reliability that Docker brings to your development workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a3b68905647" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/yet-another-tutorial-getting-started-with-docker-4a3b68905647">Yet Another Tutorial: Getting Started with Docker</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Your Next.js Application to Coolify in Minutes]]></title>
            <link>https://blog.coffeeinc.in/deploy-your-next-js-application-to-coolify-in-minutes-00893e8e7d01?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/00893e8e7d01</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[coolify]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 13:34:54 GMT</pubDate>
            <atom:updated>2025-04-30T13:34:54.718Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey folks! Today I want to share how I’ve been deploying my Next.js apps using Coolify. If you’re tired of complex deployment processes and just want to get your app online quickly, this guide is for you.</p><p>I have tried various deployment platforms, but Coolify has become my go-to solution. It is simple, developer-focused, and does not make you wrestle with complex DevOps tools just to get your project online.</p><p>Whether you are building side projects or launching production apps, Coolify helps you ship faster without getting lost in infrastructure details.</p><h3>What You’ll Need</h3><p>Before we jump in, make sure you have:</p><ul><li>A <strong>Next.js project</strong> ready to deploy</li><li>Basic knowledge of <strong>Docker</strong> (no deep DevOps stuff)</li><li>Access to a <strong>Coolify instance</strong> (self-hosted or hosted version)</li></ul><h3>Dockerize Your Next.js Project</h3><h4>First, Create a Dockerfile</h4><p>Start by adding this Dockerfile to your project root:</p><pre># Use the Node.js 20.13.1 base image<br>FROM node:20.13.1<br><br># Set the working directory inside the container<br>WORKDIR /src<br><br># Copy package files and install dependencies<br>COPY package*.json ./<br>RUN yarn install<br><br># Copy the entire application code<br>COPY . .<br><br># Build the application<br>RUN yarn build<br><br># Expose the port your app runs on<br>EXPOSE 3000<br><br># Command to start the application<br>CMD [&quot;yarn&quot;, &quot;start&quot;]</pre><p>I love this setup because it creates a multi-stage build that keeps my container size small and deployment fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zOYjPVnvzF39bdiV9W0YQ.png" /></figure><h4>Update Your Next.js Config</h4><p>Don’t forget to update your next.config.js file to enable the standalone output:</p><pre>/** @type {import(&#39;next&#39;).NextConfig} */<br>const nextConfig = {<br>  output: &#39;standalone&#39;,<br>  // Your other settings go here<br>}<br><br>module.exports = nextConfig</pre><h3>Deploying to Coolify: My Workflow</h3><p>Here’s how I deploy my apps to Coolify in just a few clicks:</p><h4>1. Log Into Your Coolify Dashboard</h4><p>Head over to your Coolify instance URL and log in. The dashboard is super clean and easy to navigate.</p><h4>2. Create a New Project</h4><ul><li>Click on “Projects” tab</li><li>Hit “Add” to create a new project</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f9slRHGmcpUOZy9luKiq4w.png" /></figure><ul><li>Give it a name that makes sense to me (usually the app name)</li><li>Add a quick description so I remember what it is 6 months from now</li><li>Click “Continue”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQqibyqRBtmQlBh-KUTrfw.png" /></figure><h4>3. Set Up the Deployment</h4><p>This is where Coolify makes life easy:</p><ul><li>From my new project page, I click “Add Resource”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bt7SLl-ARhsBLUuyOLFJgw.png" /></figure><ul><li>For the sake of simplicity, I am using a “Public Repository”, but you can also choose to pull your code from private repo (requires a Github App to be setup).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QIQLlzu_DWwLl0Ybl6nttw.png" /></figure><ul><li>Enter the repo URL and click “Check Repository”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCsbBifT6QCTEkkLLpW0Dw.png" /></figure><ul><li>Choose “Dockerfile” as the build pack (since we already made one)</li><li>Coolify usually detects everything correctly, but I double-check the settings.</li><li>Hit “Continue” when everything looks good.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mx2PvjAAPfJryqXT-s_xRQ.png" /></figure><h4>4. Deploy!</h4><ul><li>I review my settings one last time.</li><li>Click that satisfying “Deploy” button.</li><li>Check the Domains section, that is going to be where out application gonna be accessed once its deployed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ira2K-P8BzJWJK11CG4vlg.png" /></figure><ul><li>Watch in real-time as Coolify builds and deploys my app</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFpirftWmYNjaFeCwqJDLg.png" /></figure><p>While it’s deploying, I usually grab a coffee. By the time I get back, my app is live and I have a URL I can share.</p><h3>Things I Love About Managing My App on Coolify</h3><p>After deployment, Coolify gives me everything I need to keep my app running smoothly:</p><ul><li>I can easily check logs when something goes wrong</li><li>Monitor resource usage so I know if I need to optimize</li><li>Set up automatic deployments whenever I push to my repo</li><li>Add my custom domain with SSL in just a few clicks</li></ul><h3>Wrapping Up</h3><p>The entire process now takes just a few minutes from start to finish, which means I can focus on building cool features instead of fighting with server configs.</p><p>While Vercel (the company behind Next.js) offers excellent deployment options, I chose Coolify for its self-hosted control, cost-effectiveness for multiple projects, open-source transparency, and privacy benefits , all without sacrificing deployment simplicity.</p><p>If you’re looking for a simpler way to get your Next.js apps online while maintaining full infrastructure control, give Coolify a try. I think you’ll be just as impressed as I was with how straightforward the whole process is.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00893e8e7d01" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/deploy-your-next-js-application-to-coolify-in-minutes-00893e8e7d01">Deploy Your Next.js Application to Coolify in Minutes</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Next.js 15: Latest Features & Improvements in v15.2]]></title>
            <link>https://blog.coffeeinc.in/exploring-next-js-15-latest-features-improvements-in-v15-2-b2f96eb2b1cd?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2f96eb2b1cd</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 10:09:49 GMT</pubDate>
            <atom:updated>2025-03-24T10:09:49.247Z</atom:updated>
            <content:encoded><![CDATA[<p>Next.js 15.2 brings a host of exciting new features and improvements that I am excited for, helping optimize my experience during development, and the overall performance in building apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g2dGuog5HRVlm6NGaGbyqA.png" /><figcaption>Next.js 15.2 is out now!</figcaption></figure><p>From stable React 19 support to smarter debugging, streaming metadata for faster initial loads, and the powerful new after() function, this release pushes the framework forward. Whether building complex apps or fine-tuning performance, Next.js 15 offers tools and updates designed to make our development smoother and more efficient. Here’s a breakdown of what’s new and why it matters.</p><h3>1. React 19 Stable Support</h3><p>Next.js continues its <strong>React 19 stable</strong> support in version <strong>15.2</strong>, building on what was introduced in 15.1 . The App Router maintains its use of <strong>React Canary</strong>, which includes React 19 features along with experimental updates. While Next.js is pushing App Router as the future direction of the framework, the Pages Router remains fully supported across these version updates.</p><h3>2. Error Debugging</h3><p>Debugging has undergone a complete transformation in Next.js 15, addressing one of development’s most persistent pain points. The Vercel team has delivered substantial improvements to both terminal and browser error experiences, making troubleshooting more intuitive and efficient.</p><h4>Terminal Output: Clarity at Last</h4><p>The terminal experience in Next.js 15 eliminates the confusion of traditional error messages:</p><ul><li><strong>Developer-First Formatting</strong>: Errors now highlight your code directly, not framework internals</li><li><strong>Focused Stack Traces</strong>: Third-party noise is filtered out automatically</li><li><strong>Runtime Consistency</strong>: Identical error formatting across standard and Edge environments</li></ul><p><strong>Before:</strong></p><pre>⨯ Error: boom at eval (./app/page.tsx:12:15) <br>    at Page (./app/page.tsx:11:74) <br>    at AsyncLocalStorage.run (node:async_hooks:346:14) <br>    at stringify (&lt;anonymous&gt;) ... and more confusing lines</pre><p><strong>After:</strong></p><pre>⨯ Error: boom at eval (app/page.tsx:6:10) <br>    at Page (app/page.tsx:5:32)</pre><h4>Browser Errors: Intelligent and Interactive</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q1Um5x1lm9FH3ibg" /></figure><p>The browser error interface has been completely redesigned with practical features:</p><ul><li><strong>Component-Level Precision</strong>: React “owner stacks” technology pinpoints exact error sources</li><li><strong>Personalized Experience</strong>: Customize error overlay behavior directly from the interface</li><li><strong>Feedback Mechanism</strong>: Rate error messages to contribute to ongoing improvements</li><li><strong>Dynamic Development Indicator</strong>: Subtle status indicator shows rendering mode and build status in real-time</li></ul><p>These improvements transform debugging from an exercise in frustration to an almost seamless part of the development workflow. But let’s be honest — if you’re caught in the vibe coding zone only to crash into an endless loop of error messages, or if you’re burning through AI token quotas just to decipher cryptic stack traces, all you really need is errors that speak human. Next.js 15 finally delivers that clarity, letting you get back to what matters: building cool stuff instead of playing detective with your console.</p><h3>3. Streaming Metadata for Faster Initial UI</h3><p>Next.js 15.2 introduces a significant performance upgrade with streaming metadata, tackling a common bottleneck in the development process. Previously, generateMetadata had to complete before the initial UI would be sent to the browser, creating a frustrating wait for users even when visual content was ready to display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PMPV3tEQP3GIdWL1" /></figure><h4>Why This Matters</h4><p>The metadata bottleneck created a hidden tax on user experience:</p><ul><li>Pages with fast-loading UI components were still held hostage by metadata operations</li><li>Data fetching that only affected SEO elements would delay visible content for actual users</li><li>Developers faced an unnecessary tradeoff between SEO completeness and initial load performance</li></ul><h4>How It Works</h4><p>With streaming metadata, Next.js now intelligently:</p><ul><li>Sends the initial UI to browsers while generateMetadata is still processing</li><li>Maintains SEO compatibility by detecting bots and serving them complete metadata</li><li>Offers granular control through the new htmlLimitedBots configuration option</li></ul><p>Example Configuration:</p><pre>// next.config.js<br>module.exports = {<br>  experimental: {<br>    htmlLimitedBots: /Googlebot|bingbot|custom-crawler/i, // Customize bot detection<br>  },<br>}</pre><p>This smart approach gives you the best of both worlds — human visitors get lightning-fast initial renders while search engines receive the complete metadata they need for proper indexing. No more watching spinners while waiting for metadata operations that don’t impact what users actually see on screen.</p><h3>4. after() Function for Post-Response Execution</h3><p>The after function schedules tasks after a response (or prerender) is completed. It helps with logging, analytics, and other side effects without blocking the response.</p><h4>Where Can You Use It?</h4><ul><li>Server Components (including generateMetadata)</li><li>Server Actions</li><li>Route Handlers</li><li>Middleware</li></ul><h4>Key Features:</h4><ul><li>Does not block the response (unlike await).</li><li>Runs even if an error occurs (notFound(), redirect()).</li><li>Does not make a route dynamic (static pages remain static).</li><li>Supports nesting inside other after calls.</li></ul><p>Example 1: Using after in Layout for Logging Runs after the page is rendered and sent to the user.</p><pre>import { after } from &#39;next/server&#39;<br>import { log } from &#39;@/app/utils&#39;<br><br>export default function Layout({ children }: { children: React.ReactNode }) {<br>  after(() =&gt; {<br>    log() // Executes after rendering<br>  })<br>  return &lt;&gt;{children}&lt;/&gt;<br>}</pre><p>Example 2: Using after in an API Route for Logging User Activity Runs after a POST request completes.</p><pre>import { after } from &#39;next/server&#39;<br>import { cookies, headers } from &#39;next/headers&#39;<br>import { logUserAction } from &#39;@/app/utils&#39;<br><br>export async function POST(request: Request) {<br>  after(async () =&gt; {<br>    const userAgent = (await headers().get(&#39;user-agent&#39;)) || &#39;unknown&#39;<br>    const sessionCookie = (await cookies().get(&#39;session-id&#39;))?.value || &#39;anonymous&#39;<br>    <br>    logUserAction({ sessionCookie, userAgent }) // Logs user action<br>  })<br>  <br>  return new Response(JSON.stringify({ status: &#39;success&#39; }), {<br>    status: 200,<br>    headers: { &#39;Content-Type&#39;: &#39;application/json&#39; },<br>  })<br>}</pre><h4>Why Use after() Instead of Alternatives?</h4><ul><li>Better than waitUntil() — Runs after the response is completed, while waitUntil() runs during the request lifecycle.</li><li>Better than removing await — Prevents early termination in serverless environments.</li></ul><h3>5. forbidden() &amp; unauthorized() for Authorization Errors</h3><p>Next.js 15.1 introduces two <strong>experimental APIs</strong> for handling authorization errors:</p><ul><li><strong>forbidden()</strong> → Triggers a <strong>403 error</strong> (customizable UI via forbidden.tsx).</li><li><strong>unauthorized()</strong> → Triggers a <strong>401 error</strong> (customizable UI via unauthorized.tsx).</li></ul><h4>How to Enable It?</h4><p>Since this feature is experimental, enable it in <strong>next.config.ts</strong>:</p><pre>import type { NextConfig } from &#39;next&#39;;<br><br>const nextConfig: NextConfig = {<br>  experimental: {<br>    authInterrupts: true, // Enables forbidden() and unauthorized()<br>  },<br>};<br>export default nextConfig;</pre><h4>Example 1: Using forbidden() for Admin Pages</h4><p>Restricts access if the user is not an <strong>admin</strong>.</p><pre>import { verifySession } from &#39;@/app/lib/dal&#39;;<br>import { forbidden } from &#39;next/navigation&#39;;<br><br>export default async function AdminPage() {<br>  const session = await verifySession();<br>  if (session.role !== &#39;admin&#39;) {<br>    forbidden(); // Triggers 403 error<br>  }<br>  return &lt;h1&gt;Admin Page&lt;/h1&gt;;<br>}</pre><h4>Example 2: Custom Error Pages</h4><p><strong>Custom 403 Page (</strong><strong>forbidden.tsx)</strong></p><pre>import Link from &#39;next/link&#39;;<br><br>export default function Forbidden() {<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;Forbidden&lt;/h2&gt;<br>      &lt;p&gt;You are not authorized to access this resource.&lt;/p&gt;<br>      &lt;Link href=&quot;/&quot;&gt;Return Home&lt;/Link&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>Custom 401 Page (</strong><strong>unauthorized.tsx)</strong></p><pre>import Link from &#39;next/link&#39;;<br><br>export default function Unauthorized() {<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;Unauthorized&lt;/h2&gt;<br>      &lt;p&gt;Please log in to access this page.&lt;/p&gt;<br>      &lt;Link href=&quot;/login&quot;&gt;Go to Login&lt;/Link&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>6. Turbopack Performance Improvements</h3><p>Turbopack was marked stable with Next.js 15, and the team hasn’t slowed down since. Significant performance enhancements have arrived in this latest update, addressing core development workflow pain points that directly impact daily productivity.</p><h4>Dramatic Speed and Efficiency Gains</h4><p>The improvements are substantial and measurable:</p><ul><li><strong>Faster compile times:</strong> Early adopters have reported up to <strong>57.6% faster compile times</strong> when accessing routes compared to Next.js 15.1.</li><li><strong>Reduced memory usage:</strong> For the vercel.com application, we observed a <strong>30% decrease in memory usage</strong> during local development.</li></ul><p>With these optimizations, Turbopack now outperforms Webpack in virtually all scenarios — a milestone achievement for large-scale applications where build performance directly impacts development velocity. If you’re working on a project where this doesn’t hold true, the Next.js team is actively seeking feedback to investigate these edge cases.</p><h3>7. Other Features &amp; Improvements</h3><h4>New Features:</h4><ul><li><strong>ESLint 9</strong> in create-next-app (latest version for improved linting).</li><li><strong>Increased max cache tags</strong> to <strong>128</strong> (better caching flexibility).</li><li><strong>Experimental CSS inlining support</strong> (improves performance).</li><li><strong>Option to disable </strong><strong>CssChunkingPlugin</strong> (experimental).</li></ul><h4>Improvements &amp; Fixes:</h4><ul><li>Silenced <strong>Sass </strong><strong>legacy-js-api warning</strong>.</li><li>Fixed <strong>unhandled rejection</strong> with rewrites.</li><li>Ensured <strong>parent process exits if Webpack worker fails</strong>.</li><li>Fixed <strong>route interception in catch-all routes</strong>.</li><li>Fixed <strong>response cloning issue</strong> in request deduping.</li><li>Fixed <strong>Server Action redirects</strong> across multiple root layouts.</li><li>Added <strong>Turbopack support for MDX plugins as strings</strong>.</li></ul><p>These updates <strong>enhance performance, stability, and developer experience</strong> in Next.js 15.</p><h3>Closing Thoughts</h3><p>All in all, Next.js 15 feels like one of those updates where you can genuinely say — <em>“Yep, they’ve been listening.”</em> From cleaner error messages that actually make sense to streaming metadata that finally kills those annoying loading spinners, it’s clear the focus is on making our lives easier.</p><p>Honestly, updates like this remind me why I enjoy building with Next.js. Can’t wait to see what they cook up next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2f96eb2b1cd" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/exploring-next-js-15-latest-features-improvements-in-v15-2-b2f96eb2b1cd">Exploring Next.js 15: Latest Features &amp; Improvements in v15.2</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Scalable User Interfaces using JSON Schemas]]></title>
            <link>https://blog.coffeeinc.in/creating-a-scalable-ui-with-json-schema-based-builders-5648d288e68c?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/5648d288e68c</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[json-schema]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 07:01:14 GMT</pubDate>
            <atom:updated>2025-03-24T09:15:22.761Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating Scalable User Interfaces using JSON Schemas — An Alternative to React Components</h3><p>Building user interfaces can be complex, requiring careful planning of component structures, interactions, and behavior. As applications grow, manually managing UI components becomes increasingly tedious and error-prone as you have to go to codebase every time you need to make small changes like changing styles or updating text or even managing layouts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KYH0CyO7TKJlqvaoC_SAdQ.jpeg" /></figure><p>That is where JSON Schema comes in, acting as a blueprint that keeps everything organized, consistent, and scalable. Instead of manually coding every detail of forms, layouts, or dynamic elements, you can describe them in JSON. This makes UI development easier, allowing teams to focus on defining what the UI should look like rather than how to render it.</p><p>A renderer or a specialized “UI builder” then reads this schema and transforms it into a fully functional interface. Developers and designers can work independently. Designers can define the UI structure in JSON Schema, while developers focus on rendering logic and backend integration.</p><h3>Why Use JSON Schema for UI?</h3><ul><li><strong>Consistency</strong>: Clearly outlined properties and rules ensure uniform behavior across your app.</li><li><strong>Maintainability</strong>: Making changes in one place (the schema) reflects everywhere.</li><li><strong>Scalability</strong>: As your app grows, new components or rules can be easily integrated.</li><li><strong>Collaboration</strong>: Designers and developers can align more easily when there’s a shared, standardized schema.</li><li><strong>Interoperability: </strong>JSON is a widely accepted format that integrates well with different platforms, making it easier to reuse UI definitions across web, mobile, and even desktop applications.</li></ul><h3>Breaking Down UI into Modular Blocks</h3><p>To make UI scalable and manageable, we can break it down into <strong>modular blocks</strong> that can be defined in JSON Schema. These blocks represent different UI components, layouts, and interactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_W2UE31WW-89a4InyC7Zvg.png" /></figure><p>The layout determines how elements are arranged on the page, influencing the flow and user experience. In traditional HTML, you might rely on &lt;div&gt;, &lt;section&gt;, or &lt;header&gt;. With JSON Schema, you can abstract these as “modular blocks” and define them in a reusable format.</p><h4>1. Container Block</h4><p>The Container Block groups related components together, managing their arrangement (e.g., div, grid, flex, column).</p><pre>{<br>  &quot;Div&quot;: {<br>    &quot;props&quot;: {<br>      &quot;bgColor&quot;: &quot;white&quot;,<br>      &quot;style&quot;: {<br>        &quot;padding&quot;: &quot;24px&quot;,<br>        &quot;width&quot;: &quot;100%&quot;,<br>        &quot;maxWidth&quot;: &quot;400px&quot;,<br>        &quot;margin&quot;: &quot;auto&quot;,<br>        &quot;boxShadow&quot;: &quot;0px 4px 10px rgba(0, 0, 0, 0.1)&quot;,<br>        &quot;borderRadius&quot;: &quot;8px&quot;<br>      }<br>    },<br>    &quot;components&quot;: [<br>      {<br>        &quot;Field&quot;: {<br>          &quot;props&quot;: {<br>            &quot;id&quot;: &quot;user.name&quot;,<br>            &quot;label&quot;: &quot;Name&quot;,<br>            &quot;component&quot;: &quot;Input&quot;,<br>            &quot;placeholder&quot;: &quot;Enter your name&quot;<br>          }<br>        }<br>      },<br>      {<br>        &quot;Field&quot;: {<br>          &quot;props&quot;: {<br>            &quot;id&quot;: &quot;user.email&quot;,<br>            &quot;label&quot;: &quot;Email&quot;,<br>            &quot;component&quot;: &quot;Input&quot;,<br>            &quot;placeholder&quot;: &quot;Enter your email&quot;,<br>            &quot;type&quot;: &quot;email&quot;<br>          }<br>        }<br>      },<br>      {<br>        &quot;Field&quot;: {<br>          &quot;props&quot;: {<br>            &quot;id&quot;: &quot;user.password&quot;,<br>            &quot;label&quot;: &quot;Password&quot;,<br>            &quot;component&quot;: &quot;Input&quot;,<br>            &quot;placeholder&quot;: &quot;Enter your password&quot;,<br>            &quot;type&quot;: &quot;password&quot;<br>          }<br>        }<br>      },<br>      {<br>        &quot;Field&quot;: {<br>          &quot;props&quot;: {<br>            &quot;id&quot;: &quot;user.age&quot;,<br>            &quot;label&quot;: &quot;Age&quot;,<br>            &quot;component&quot;: &quot;Input&quot;,<br>            &quot;placeholder&quot;: &quot;Enter your age&quot;,<br>            &quot;type&quot;: &quot;number&quot;<br>          }<br>        }<br>      },<br>      {<br>        &quot;Button&quot;: {<br>          &quot;props&quot;: {<br>            &quot;label&quot;: &quot;Submit&quot;,<br>            &quot;bgColor&quot;: &quot;#28a745&quot;<br>          }<br>        }<br>      }<br>    ]<br>  }<br>}</pre><p>Here you can see the Div container block with the following props:</p><ul><li><strong>bgColor</strong>: Sets the background color.</li><li><strong>style</strong>: Custom CSS properties.</li><li><strong>components</strong>: Nested elements or child components that will be rendered inside this layout.</li></ul><h4>2. Input Components Block</h4><p>Input Components block defines specific UI elements like text fields, buttons, and dropdowns. They form the interactive parts of your interface, where users type, select, or provide data.</p><p>We can look at the Field component below with specific props needed for an input field.</p><pre>{<br>  &quot;Field&quot;: {<br>    &quot;props&quot;: {<br>      &quot;id&quot;: &quot;user.name&quot;,<br>      &quot;label&quot;: &quot;Name&quot;,<br>      &quot;component&quot;: &quot;Input&quot;,<br>      &quot;placeholder&quot;: &quot;Enter your name&quot;<br>    }<br>  }<br>}</pre><ul><li><strong>id</strong>: A unique identifier for data binding and state management.</li><li><strong>label</strong>: The text displayed above or beside the input field.</li><li><strong>component</strong>: Specifies the type of input (text, password, email, etc.).</li><li><strong>placeholder</strong>: A hint inside the input field for guidance.</li></ul><h4>3. Custom Components</h4><p>Beyond basic layouts and input fields, you’ll often need specialized components like modals, repeaters, accordions, or complex data tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1nfT8XmDGf1APoJDDpAsXA.png" /></figure><p>Here is the structure of the Repeater component with component children that can be added as many as required.</p><pre>{<br>  &quot;Repeater&quot;: {<br>    &quot;props&quot;: {<br>      &quot;id&quot;: &quot;guests&quot;,<br>      &quot;components&quot;: [<br>        {<br>          &quot;Field&quot;: {<br>            &quot;props&quot;: {<br>              &quot;id&quot;: &quot;guests.*.email&quot;,<br>              &quot;label&quot;: &quot;Name&quot;,<br>              &quot;component&quot;: &quot;Input&quot;,<br>              &quot;placeholder&quot;: &quot;Enter guest email&quot;<br>            }<br>          }<br>        }<br>      ]<br>    }<br>  }<br>}</pre><ul><li><strong>Repeater</strong>: Dynamically replicates a set of fields (e.g., a list of guest emails).</li><li>Inside, each <strong>Field</strong> follows the usual input props but includes an array-based id (guests.*.email) to handle multiple entries.</li></ul><h3>Validation Rules</h3><p>With field inputs and data, there is always a need for validation rules. They can ensure that a field is required, matches a certain format (e.g., email or phone number), or respects character limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzP4acsW_O0KWUJ5bTE_qg.png" /></figure><p>These rules can be added as a prop to the input Field.</p><pre>{<br>  &quot;Field&quot;: {<br>    &quot;props&quot;: {<br>      &quot;id&quot;: &quot;user.phone&quot;,<br>      &quot;label&quot;: &quot;Phone&quot;,<br>      &quot;component&quot;: &quot;Input&quot;,<br>      &quot;placeholder&quot;: &quot;xxx-xxx-xxxx&quot;,<br>      &quot;validation&quot;: &quot;[[&#39;required&#39;], [&#39;matches&#39;, /^\\d{3}-\\d{3}-\\d{4}$/]]&quot;<br>    }<br>  }<br>}</pre><p><strong>validation</strong>: An array of rules.</p><ul><li>required ensures the field can’t be empty.</li><li>matches checks the input format (in this case, a U.S. phone pattern).</li></ul><h3>Conditional Rendering</h3><p>Some UI components should only appear based on user input. JSON Schema supports <strong>conditional rendering</strong>, enabling dynamic UI changes, like showing a detailed address form if a user selects “Shipping Address.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*sB06VV_JSV7zmclVjuKAHQ.gif" /></figure><p>With JSON Schema, you can specify conditions that determine whether a component is rendered or hidden. For instance, if a certain checkbox is checked, show additional fields. Otherwise, keep them hidden.</p><h4>Common Use Cases</h4><ul><li><strong>Repeaters</strong>: Dynamically showing an additional set of fields after the user clicks “Add more.”</li><li><strong>Radio Buttons</strong>: Revealing a specialized form section based on a selection.</li><li><strong>Toggling</strong>: Switching between different layouts or themes.</li></ul><h3>Rendering the UI</h3><p>Once the JSON Schema is defined, a rendering engine (which can be custom-built or part of an existing library) reads through it and translates each component into an actual UI element. This process usually involves:</p><ol><li><strong>Parsing the Schema</strong>: Iterating over each component definition.</li><li><strong>Mapping to Components</strong>: Converting JSON properties to the corresponding React, Vue, or Angular components.</li><li><strong>Applying Styles &amp; Rules</strong>: Incorporating props like style, bgColor, validation, etc.</li><li><strong>Mounting the Result</strong>: Placing the generated UI onto the page or within another layout element.</li></ol><h3>Conclusion</h3><p>JSON Schema offers a powerful way to describe and generate your UI, from the simplest inputs to the most complex, dynamic layouts. By centralizing the description of your components, you make your application more consistent, maintainable, and adaptable to future needs.</p><p>Whether you are building single-page apps or large-scale platforms, you can create flexible, reusable, and adaptable interfaces without getting bogged down by repetitive coding. With clear structures, validation rules, and conditional rendering baked into the schema, your application stays organized and user-friendly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5648d288e68c" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/creating-a-scalable-ui-with-json-schema-based-builders-5648d288e68c">Creating Scalable User Interfaces using JSON Schemas</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing the Unknown: Strategic Lessons from Jujutsu Kaisen]]></title>
            <link>https://blog.coffeeinc.in/managing-the-unknown-strategic-lessons-from-jujutsu-kaisen-781cb3ca346e?source=rss-884350d9a6ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/781cb3ca346e</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[anime]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[management]]></category>
            <dc:creator><![CDATA[Vijay]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 13:53:15 GMT</pubDate>
            <atom:updated>2025-02-17T06:17:20.892Z</atom:updated>
            <content:encoded><![CDATA[<h4>Decision-Making, Risk, and Adaptability</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlH6ZrhorQadMe661ZnpZw.jpeg" /></figure><p><strong>Jujutsu Kaisen </strong>is one of my favorite anime. I think its hard to go by these days without having watched atleast one, and that journey began for me with this anime. The story follows high school student, Yuji Itadori, as he joins a secret organization of Jujutsu Sorcerers to fight demons and protect humanity from Cursed Spirits.</p><p>But hold on, while I can go on and on about the anime, this isnʼt about the seriesʼ storyline, but about the learnings we can take from that anime. There are so many parallels that I could see that reflected in the real world, but the ones I wanted to discuss about revolves around Yuji and his decisions.</p><h3>Snap Decisions, Long lasting Consequences</h3><p>One of the pivotal moments that happens in the opening of the anime. To protect a fellow student, Yuji consumes a powerful Cursed Object, the finger of Sukuna, the King of Curses. This act binds Sukuna’s soul to Yuji’s, making him a unique case among sorcerers.</p><p>Yuji makes a quick decision to solve the immediate problem, without anticipating how drastically it will change his life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfbLORh4T7U4UZjGjjXc1g.jpeg" /></figure><p>That is how it goes in real life too. Sometimes, we make choices based on what seems right in the moment, only to realize later just how many layers there were to the situation.</p><p>Whether it is kicking off a new project, mapping out a plan, or making a decision under pressure, things usually start with a rough idea. We set things in motion, commit resources, and move forward, thinking we have got a solid path ahead.</p><blockquote>Sometimes, we make snap decisions to solve a problem, only to realize later how much they change everything.</blockquote><p>But just when things seem to be running smoothly, new challenges emerge. As the work progresses, deeper questions arise, and suddenly, what once seemed like a solid plan starts to feel incomplete. The team may have built something functional, but now there is a need for more flexibility, more scalability. That is when adaptability becomes really important. Because no matter how well we plan, the unknown always finds a way in.</p><blockquote>No matter how well we plan, the unknown always finds a way in. The real skill is adjusting when they do.</blockquote><h3>Prioritization Over Impulsiveness</h3><p>Not every battle can be fought at once, and Yuji quickly learns this. Rushing in without a plan could cause more harm than good. Some decisions, if made impulsively, can drain resources or lead to technical debt, much like the Yuji initial choice to consume the cursed artifact without knowing its full implications.</p><blockquote>Not every problem needs solving right away. Focus on what moves the needle first.</blockquote><p>It’s not just about being adaptable — it’s about knowing <strong>which challenges to tackle first</strong>. Resources are finite, and prioritization ensures that energy is spent where it matters most.</p><h3>Leverage Play: Strategic Sacrifice</h3><p>One of my favorite scenes in the series is when Ryomen Sukuna takes control of Yuji Itadoriʼs body and removes Yujiʼs heart. Being the King of Curses, Sukuna can stay alive without a heart. However, if Yuji regains control, he will die and in the process, Sukuna will lose his vessel. Why Sukuna would do this, considering Yujiʼs body is his only way to freedom? Why take such a risk?</p><blockquote>Every decision comes with consequences, and in any complex project, we might be forced into a situation to negotiate.</blockquote><p>This situation can be described as a <strong>“strategic sacrifice”</strong> or <strong>“calculated risk.” </strong>Every decision comes with consequences, and in any complex project, we might be forced into a situation to negotiate. Some choices, like Sukuna’s, prioritize dominance, forcing Yuji into a position where he must negotiate or perish.</p><p>We might arrive at a situation where the chosen technologies, frameworks, or strategies fail to scale as the project evolves pushing us into a corner. The choice needs to be made to scrape the whole project and rebuild from scratch (losing all the effort and time invested) or settle with what we have and build from there. The key is not just reacting but anticipating and recognizing early signs of friction, scalability issues, and limitations before they become insurmountable.</p><p>Every major project faces a moment of reckoning. The difference between failure and success often lies in how well we prepare for and navigate that moment.</p><p><strong>Understand: </strong>Decision-making isn’t just about immediate gains. It is about anticipating consequences and preparing for the unexpected.</p><h3>Defining Boundaries: The Binding Vow</h3><p>So, how do Yuji and Sukuna move forward? They establish a <strong>binding agreement</strong>, where the demon gains temporary control under strict conditions but cannot harm those close to Yuji.</p><p>We often face situations where complete control is not possible, and compromise is necessary. Just like Yuji, who must balance Sukuna’s power, we must define <strong>clear boundaries</strong> to mitigate risks while still making the best use of available resources.</p><blockquote>Setting expectations upfront — whether with a demon or a stakeholder — prevents confusion and risk.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NKAhTh7lnvQeMaf-o3-Enw.png" /><figcaption>Yuji’s Binding Vow with Sukuna</figcaption></figure><p>If teams aren’t aligned, things get messy fast. Clear goals keep work efficient. We must align goals across teams, ensuring that decisions benefit both immediate needs and long-term vision. A lack of alignment can lead to inefficiencies, just as an unchecked demon could cause chaos.</p><h3>Closing Thoughts</h3><p><strong>Our biases, experiences, and limitations shape how we interpret challenges and make decisions.</strong> Much like Yuji and Sukuna navigating their uneasy partnership through structured compromise, we must balance <strong>stakeholder expectations, team capabilities, and unforeseen risks</strong> while staying realistic about constraints.</p><p>Success isn’t about avoiding risks, it is about making informed choices, adapting when necessary, and ensuring alignment in the face of uncertainty. Whether in anime or real life, the key to resilience is mastering the art of strategic decision-making.</p><p>And just like Yuji, the best way forward isn’t just about fighting harder, it is about fighting smarter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=781cb3ca346e" width="1" height="1" alt=""><hr><p><a href="https://blog.coffeeinc.in/managing-the-unknown-strategic-lessons-from-jujutsu-kaisen-781cb3ca346e">Managing the Unknown: Strategic Lessons from Jujutsu Kaisen</a> was originally published in <a href="https://blog.coffeeinc.in/">Coffee Byte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>