<?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 Okraks on Medium]]></title>
        <description><![CDATA[Stories by Okraks on Medium]]></description>
        <link>https://medium.com/@okraks?source=rss-c9035f347d98------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1eURsbS7mr8LfUSqcaNy-g.jpeg</url>
            <title>Stories by Okraks on Medium</title>
            <link>https://medium.com/@okraks?source=rss-c9035f347d98------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:09:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@okraks/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building Robust Signup Systems with Deduplication Logic]]></title>
            <link>https://okraks.medium.com/building-robust-signup-systems-with-deduplication-logic-6622989a159c?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/6622989a159c</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[consistency]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Tue, 18 Nov 2025 18:44:29 GMT</pubDate>
            <atom:updated>2025-11-18T18:44:29.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3h86A1krqLZTVSQU" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=medium&amp;utm_medium=referral">Christopher Gower</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Keeping your signup system clean sounds simple… until real users start interacting with it. People sign up twice, use different emails, forget they already registered, or submit information on behalf of someone else who’s already in your system. Before you know it, you’re dealing with duplicate records, confused users, and messy data that’s hard to trust.</p><p>This article breaks down how to build a signup flow that quietly handles all of this behind the scenes. No drama for the user, no clutter in your database. Just practical strategies, real-world examples, and the logic you need to keep your registration data clean from day one. We’ll start with the most simple solution and gradually make it complex and robust. Lets dive in.</p><h3>1. Email / Phone Number Uniqueness</h3><p>This is as simple as can be and what <em>most tutorial videos</em> teach. The email (or phone number) must be unique per user. For our hypothetical system, two users <strong><em>might</em></strong> submit the same phone number (eg. a parent using their phone number for their underage child) but emails must be unique. Simply put, <strong>no two users can have the same email — </strong>easy peasy.</p><p>During sign up, the new user enters their name, email and phone number and the backend service simply checks the database — “Is there any other user using this email?” If yes, reject the new registration. If no, create the account for the user. That’s all ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkufnUg48Mc9NcJwMnP3tw.png" /><figcaption>Email / Phone Number Uniqueness</figcaption></figure><h3>2. Fuzzy Matching &amp; Using Weights</h3><p>Relying only on email for uniqueness has a hidden flaw: <strong>many people use more than one email address</strong>. So even if your database shows 100 user accounts, the real number might be closer to 74 because some individuals registered multiple times with different emails.</p><p>In some applications this is harmless. In others, it creates confusion, breaks reporting, or even affects compliance. When accuracy matters, you need stronger guarantees of uniqueness than email alone can provide.</p><blockquote><strong>A practical case where stricter uniqueness checks matter is when users can register / submit information for other people in the system.</strong></blockquote><p>Imagine a household: Richard and Cynthia are married, and they both use your application independently. One day, Richard logs in and submits an application for their daughter, Martha. A few days later, Cynthia logs in and submits the same information for Martha again.</p><p>Without a strong deduplication check — based on identifiers like full name, phone number and date of birth— the system would treat these as two separate submissions. With proper safeguards, the second submission should be flagged as a potential duplicate so the team can review instead of accidentally creating two records for the same person.</p><p>Our updated system design introduces a <strong><em>deduplication algorithm</em></strong> (I’ll break down how it works shortly). When a new registration comes in, the algorithm compares it against existing records and computes a similarity score for each potential match. It then returns the highest score to the service layer, which applies a predefined threshold to decide whether the incoming record should be created immediately or flagged for manual review.</p><p>However, “basic checks” like email and ID number uniqueness are still enforced and is the first layer. If either email or ID number uniqueness fails, the service rejects the registration outright. If not, as the second layer, the deduplication algorithm is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezUSd6x522YBhpdxm3bWVA.png" /><figcaption>Fuzzy Matching &amp; Using Weights System Design</figcaption></figure><p>Lets explore the <strong>Deduplication Algorithm</strong> used in the system design above.</p><p>The algorithm is to account for several potential duplication cases that might arise. The output is a <strong>single similarity score</strong> so that the service layer can decide to flag for review or create the account. Some cases that it considers includes:</p><ol><li>Two people with <strong>same date of birth</strong>, <strong>different phone numbers</strong> and <strong>different first and last names</strong>.</li><li>Three people with <strong>different date of births</strong>, <strong>same first name</strong> but <strong>different last names</strong>.</li><li>Two people with a slightly different first name (eg. Mich<strong>ea</strong>l and Mich<strong>ae</strong>l) — notice the “ea” and “ae” ? , same last name and same date of birth</li></ol><p>….and so on and so forth. There are so many permutations.</p><p>Our algorithm works with these data points in determining a potential duplication:</p><ul><li>First name, middle name and surname</li><li>Date of Birth</li><li>Phone Number</li></ul><p>Steps of the algorithm:</p><ol><li><strong>Fetch all potential matches from the database</strong></li></ol><p>For the incoming registration, check for any records that have a similar phone number or date of birth and names.</p><pre>// Pseudocode: fetch possible duplicates<br>const potentialMatches = db.user.findMany({<br>  where: {<br>    OR: [<br>      { phoneNumber: input.phoneNumber },<br>      { dateOfBirth: input.dateOfBirth },<br>      {<br>        AND: [<br>          { firstName: contains(input.firstName) },<br>          { lastName: contains(input.lastName) },<br>          { middleName: contains(input.middleName) }<br>        ]<br>      }<br>    ]<br>  }<br>});</pre><p>2. <strong>Check length of potential matches array</strong></p><p>If the potential matches array is empty, return a similarity score of 0.</p><pre>  if (potentialMatches.length === 0) {<br>    return { isDuplicate: false, score: 0 };<br>  }</pre><p>3. <strong>Calculate similarity score for all potential matches</strong></p><p>Each data point is assigned a weight that I calibrated through trial and error to reflect its relative importance. The name carries the highest weight, followed by date of birth, and then phone number, corresponding to how relevant each is in identifying duplicates.</p><pre>| Data Point        | Raw Weight | Normalized (0–100%) |<br>|-------------------|------------|----------------------|<br>| Name similarity   | 0.5        | 50%                  |<br>| Date of birth     | 0.3        | 30%                  |<br>| Phone number      | 0.2        | 20%                  |</pre><p>We’re utilising the <a href="https://www.npmjs.com/package/fuzzball">fuzzball package</a> to compare names. You can read more about fuzzy matching <a href="https://redis.io/blog/what-is-fuzzy-matching/">here.</a> Our acceptable threshold is 70% or 0.7.</p><pre>let maxScore = 0;<br><br>for (const user of potentialMatches) {<br>  let score = 0;<br><br>  // Name similarity (0–1), weighted at 50%<br>  const rawNameSimilarity = (<br>    fuzz(firstName, user.firstName) +<br>    fuzz(middleName, user.middleName) +<br>    fuzz(lastName, user.lastName)<br>  ) / 300;<br><br>  const nameScore = rawNameSimilarity * 0.5;  // 50%<br><br>  // Date of birth exact match → 30%<br>  const dobScore = isSameDate(user.dateOfBirth, dateOfBirth) ? 0.3 : 0;<br><br>  // Phone match → 20%<br>  const phoneScore = user.phoneNumber === phoneNumber ? 0.2 : 0;<br><br>  // Total score (max 1.0)<br>  score = nameScore + dobScore + phoneScore;<br><br>  // Threshold for manual review<br>  if (score &gt;= 0.7) {<br>    potentialMatchesForReview.push(user.id);<br>  }<br><br>  maxScore = Math.max(maxScore, score);<br><br>  return {<br>    isDuplicate: maxScore &gt; 0.7,<br>    score: maxScore,<br>    potentialMatchesForReview  <br>  }<br>}</pre><p>4. <strong>The service layer actions the incoming registration based on the similarity score returned</strong></p><p>In this implementation, when the score is greater or equal to 0.7, it’s flagged for manual review by a human (along with all the potential matches identified).</p><p>If the similarity score is less than 0.7, the user account is created</p><h3>3. ML-Enhanced Deduplication</h3><p>With the rise of AI and ML, some machine learning models can be employed in deduplication.</p><p>A simple <strong>random forest machine learning model </strong>works well since deduplication is structured and tabular.</p><p>The model learns patterns like:<br> • If names are similar + Date of birth matches → same person.<br> • If phone numbers match, even if emails differ → same person.<br> • If only one field matches → probably different people.</p><p>In another article, we’ll explore more about ML-Enhanced Deduplication.</p><p>Cheers! Let’s build robust systems! The algorithm presented here might have some flaws or edge cases I didn’t consider, feel free to point them out in the comments!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*34xEodIKs2f9yyGICYX9Mw.gif" /></figure><h3><strong>Resources</strong></h3><ul><li><a href="https://www.npmjs.com/package/fuzzball">https://www.npmjs.com/package/fuzzball</a></li><li><a href="https://medium.com/data-science/understanding-deduplication-methods-ways-to-preserve-the-integrity-of-your-data-545651313c12">https://medium.com/data-science/understanding-deduplication-methods-ways-to-preserve-the-integrity-of-your-data-545651313c12</a></li><li><a href="https://medium.com/@m.nath/fuzzy-matching-algorithms-81914b1bc498">https://medium.com/@m.nath/fuzzy-matching-algorithms-81914b1bc498</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6622989a159c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vibe Coding: How I Built My Friend’s Portfolio]]></title>
            <link>https://okraks.medium.com/vibe-coding-how-i-built-my-friends-portfolio-70e5dc774044?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/70e5dc774044</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Sat, 25 Oct 2025 13:36:44 GMT</pubDate>
            <atom:updated>2025-10-25T13:57:07.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Yh-kdtATKYJXV7E5WvScg.png" /></figure><p>It’s been an exhausting week and I used roughly 4 hours to go from idea to execution of my friends’ portfolio (<a href="https://www.kofidako.com/">kofidako.com</a>) — He’s a designer, a photographer and a minimalist.</p><p>Just like the past few months the AI hype trains continues and it doesn’t seem to die out. There’s always some new implementation or technology that reinforces (and sometimes shatters) some of these thoughts:</p><ul><li>It’s so over for software engineers! 👨🏾‍💻</li><li>AI is going to replace developers 😐</li><li>Anyone can code now 😕</li></ul><p>Interestingly, <a href="https://edemkumodzi.com/">Edem Kumodzi</a> published an article this week that made me rethink all our assumptions and predictions of the future concerning AI. I love his perspective using history simply because that’s when patterns truly emerge and drowns fear and noise.</p><blockquote><strong>AI And Software Engineering: </strong><a href="https://edemkumodzi.com/posts/ai-and-software-engineering-this-time-its-different-it-never-is/">https://edemkumodzi.com/posts/ai-and-software-engineering-this-time-its-different-it-never-is/</a></blockquote><p>The article talks about how different technologies have come up over the past seven decades and each time we heard <em>“This is going to replace programmers”</em> but it didn’t. It has an opposite effect: More programming jobs were created because “busy work” was eliminated and the boundaries of what we could do was only extended further — We were empowered to solve even more complex problems.</p><p>What does all this have to do with the portfolio I just built for Kofi? This isn’t my first rodeo. I had a stressful week and I wanted to wind down so I did what every software engineer does: <strong>Close your work laptop and open your personal laptop to write more code</strong>; however this time I decided to let AI do all the heavy lifting while I guide it.</p><p>I’m going to show you how I did that.</p><p><em>Spoiler alert</em> — <strong>It’s not one prompt that says </strong>“Build a sleek portfolio website for an architect and a photographer having four pages: Stories, Architecture, Archive and About” or whatever variation you‘re thinking of. I’ve had one-too-many non-technical friends asking me to help debug what <a href="https://lovable.dev/">Lovable</a> built for them ;)</p><p>You can explore the portfolio here: <a href="https://www.kofidako.com/">kofidako.com</a></p><figure><img alt="kofidako.com" src="https://cdn-images-1.medium.com/max/1024/1*_BL_7FBiiQw4VUmJThCG3A.png" /><figcaption><a href="https://www.kofidako.com/">kofidako.com</a></figcaption></figure><h3>Vibe Coding Process</h3><p>Over at <a href="https://www.slightlytechie.com/">Slightly Techie</a>, we’ve had a lot of conversations around coding with AI and fitting coding agents into our workflow to be a supercharged developer. My current process is a direct derivative of those conversations. (S/O to Abdul!). I’ve also started exploring the <a href="https://github.com/bmad-code-org/BMAD-METHOD">BMAD method</a>.</p><p>This is the process I used to refine the concept and create technical specifications for the project. I then broke them down into prompts that can be given to any coding agent. I used <a href="https://claude.ai/">Claude Code</a> for this entire process.</p><p>The goal is to account for edge cases from the very beginning — clearly defining them and outlining how you’ll handle each one. This approach sharpens your research, helps you better define the core problem, and reduces guesswork later in the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsLQbZKoPQaKeYnoa7PLkA.png" /><figcaption>(Vibe) Coding Process</figcaption></figure><p>NB: Each step here is a custom claude command that I invoke with /&lt;command-name&gt;, however you can simply start your interaction with a coding agent with it as your first message.</p><p>Each step feeds into the next. At the end, you’d have a list of prompts in <strong>prompt_plan.md</strong> that you can invoke using /work. That finds the last completed task and moves on to execute the next. It’s important to note that for each prompt, I had to actively review and check what’s going on with my code editor open. I also had to fix bugs myself because that’s faster sometimes than describing what’s happening to the coding agent to fix it.</p><p>The stack for this project was NextJS and Sanity.io. I also used TailwindCSS and HeroUI for styling — I chose this because I’m used to these technologies and it would’ve been easier to correct any mistake done by the agent.</p><p>Lets go through the vibe-coding lifecycle and the prompt used at each step:</p><h3>Ideation</h3><blockquote>Let’s clarify and expand on the idea before we start designing. Ask high-level questions to understand goals, users, context, constraints, and success metrics. Ask the questions one by one, using the answer from the previous questions to guide your next question so we properly ideate and tackle goals, users, context, contrains and success metrics. Help me shape the problem statement and define clear deliverables before moving into design. Once we have alignment, summarize the problem as `problem_statement.md`. This is the idea: $ARGUMENTS</blockquote><p>The coding agent begins to ask questions and I steer it in the direction I want. Based on the conversation I remove or add to the original idea.</p><h3>Design</h3><blockquote>Ask me one question at a time so we can develop a thorough, step-by-step spec for this idea. The problem has been clearly defined in `problem_statement.md` and you should analyse it. Ask additional questions and improve on this (update `problem_statement.md` if necessary). Each question should build on my previous answers, and our end goal is to have a detailed specification I can hand off to a developer. Let’s do this iteratively and dig into every relevant detail. Remember, only one question at a time. I do not want more than 15 questions. Use reasonable defaults if you need more context and present them for approval or edits. Once we are done, save the spec as `spec.md`</blockquote><h3><strong>Architecture</strong></h3><blockquote>Based on the spec defined in `spec.md`, propose an architecture that balances scalability, maintainability, and cost.</blockquote><blockquote>Include:</blockquote><blockquote>- System components and their responsibilities</blockquote><blockquote>- Technology stack</blockquote><blockquote>- Data flow and APIs</blockquote><blockquote>- Programming languages</blockquote><blockquote>- Libraries / Tools to levarage to reduce developer time</blockquote><blockquote>- Key design patterns or trade-offs</blockquote><blockquote>- Security considerations</blockquote><blockquote>Summarize as `architecture.md` for implementation reference.</blockquote><blockquote>In addition to what is above, these are choices and preferences that take precedence (if any is specified, otherwise ignore if blank):</blockquote><blockquote>$ARGUMENTS</blockquote><h3>Generate Prompts</h3><blockquote>Using spec.md and architecture.md (and analysis.md if available), your goal is to generate prompts I can feed to an LLM to progressive help me build. Note the following:</blockquote><blockquote>## Step 1: Draft the Blueprint</blockquote><blockquote>- Create a detailed, step-by-step blueprint for the entire project.</blockquote><blockquote>- Ensure it covers architecture, implementation strategy, and integration points.</blockquote><blockquote>## Step 2: Break Into Chunks</blockquote><blockquote>- Divide the blueprint into iterative chunks of work.</blockquote><blockquote>- Each chunk should build on the previous one, forming a logical progression.</blockquote><blockquote>## Step 3: Refine Into Steps</blockquote><blockquote>- For each chunk, break it down again into smaller, actionable steps.</blockquote><blockquote>- Review carefully:</blockquote><blockquote>- Steps should be small enough to implement safely.</blockquote><blockquote>- Steps should be large enough to meaningfully advance the project.</blockquote><blockquote>- Iterate until the steps are the right size.</blockquote><blockquote>## Step 4: Generate Prompts for an LLM</blockquote><blockquote>- Use the refined steps to create a sequence of prompts for a code-generation LLM.</blockquote><blockquote>- Follow these principles:</blockquote><blockquote>1. Prioritize best practices and incremental progress.</blockquote><blockquote>2. Avoid large jumps in complexity.</blockquote><blockquote>3. Each prompt must build on the previous one.</blockquote><blockquote>4. Ensure no hanging or orphaned code — everything integrates.</blockquote><blockquote>## Step 5: Structure the Prompts</blockquote><blockquote>- Use Markdown formatting.</blockquote><blockquote>- Separate each prompt into its own section.</blockquote><blockquote>- Mark prompts as code blocks with text tags for clarity.</blockquote><blockquote>- Provide any necessary context and rationale alongside the prompts.</blockquote><blockquote>- Each prompt should have a checkmark or cross showing whether it’s been completed or not</blockquote><blockquote>Output as file `prompt_plan.md`</blockquote><h3>Work</h3><blockquote>Review complete and incomplete tasks or prompts in prompt_plan.md and start from the first incomplete prompt / task in the sequence. Note the following</blockquote><blockquote>- Focus on clean code</blockquote><blockquote>- Comment where necessary when using tricks / code shorthand</blockquote><blockquote>- Do not over-modularize</blockquote><blockquote>- Do not overwhelm me with too much explanations</blockquote><blockquote>- Always ask if everything makes sense to me and request reviews before going on to the next prompt</blockquote><blockquote>- After working on each prompt, mark it as complete</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bvclaR-GWzX9JciUzF8xhQ.png" /><figcaption>View for a single project (truncated)</figcaption></figure><p>So… this feels more like “guide coding” than “vibe coding”.</p><p>This is a very small project. However you quickly see the potential when it comes to medium to large projects. You essentially have a research engineer, a developer, a product owner and a market-fit expert to help you undertake the project. You can implement faster but you can’t replace the human element needed in building software for people — You’ve seen the memes. You don’t just “<em>Build an AWS competitor</em>”, there’s so much more to building software than coding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vYY18GrLTTsfeZ1F" /><figcaption>Photo by <a href="https://unsplash.com/@santesson89?utm_source=medium&amp;utm_medium=referral">Andrea De Santis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Thanks for reading! I’m always trying to improve my processes and explore new ways of doing things! If you’ve got an idea or a suggestion, feel free to comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70e5dc774044" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Modern Developer’s Toolkit in 2025 — Build smart, not hard.]]></title>
            <link>https://okraks.medium.com/the-modern-developers-toolkit-in-2025-build-smart-not-hard-3298609da00b?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/3298609da00b</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[2025]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 14:39:48 GMT</pubDate>
            <atom:updated>2025-09-06T14:39:48.628Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Modern Developer’s Toolkit in 2025 — Build smart, not hard.</h3><p>It’s the year 2067 and you remember the good ol’ days in 2025 where you could build a web application without using jQuery — all you needed was Javascript (ES6+) and frameworks like <a href="https://react.dev/">React</a>, <a href="https://vuejs.org/">Vue</a> or <a href="https://angular.dev/">Angular</a>. Heck, you could just <a href="https://en.wikipedia.org/wiki/Vibe_coding">vibe code</a> with an AI editor like <a href="https://cursor.com/">Cursor</a>!</p><p>In 2067, all you need are your BrainDuds; you imagine the user interface and reason through the expected user experience and the duds write out the code — what a time to be alive!</p><p>You get the drift, right? Software and technology has always been about making things simpler through abstraction. Back in the day, people literally programmed with 0s and 1s. Now we write in high-level languages — but under the hood, it all still gets turned back into those same 0s and 1s to run on the machine.</p><blockquote>We simply became <strong>more efficient</strong> and <strong>reduced the time</strong> needed doing manual, repetitive and complex coding tasks.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m-0XexGL68Y2pkG8" /><figcaption>Photo by <a href="https://unsplash.com/@lorenzoherrera?utm_source=medium&amp;utm_medium=referral">Lorenzo Herrera</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article explores a number of tools, services, solutions and packages that I’ve come across in my dev journey so far — some I’ve personally used and others I’m yet to explore.</p><blockquote>Keep in mind, there’s always a trade-off between control and convenience. While modern tools make you faster, <strong>nothing replaces understanding the fundamentals</strong>. Knowing the principles at the core will always give you an edge — because <strong>great</strong> <strong>engineers are problem solvers</strong>, not just fast typists using the latest shiny tool.</blockquote><p>Now let’s dive in. These are the broad categories we’ll be exploring. I’ve indicated those I personally use and would recommend with a “ 🏂 ”</p><ol><li>Authentication &amp; Authorisation</li><li>Analytics, Logging and Tracking</li><li>Payments</li><li>CSS, UI Frameworks &amp; Icon Packages</li><li>Documentation</li><li>Data Visualisation — Charts &amp; Graphs</li><li>SMS &amp; Email Notifications</li></ol><h3>1. Authentication &amp; Authorization (Access Control)</h3><h4><strong>Clerk</strong> / <a href="https://clerk.com/">clerk.com</a> — 🏂</h4><p>The easiest way to add authentication and user management to your application. Purpose-built for React, Next.js and Remix.</p><h4><strong>Better Auth / </strong><a href="https://www.better-auth.com/"><em>better-auth.com</em></a></h4><p>Supports multiple OAuth providers. Allow users to sign in with their accounts, including GitHub, Google, Discord, Twitter, and more.</p><h4><strong>Lucia</strong> / <a href="https://lucia-auth.com/">lucia-auth.com</a></h4><p>Lucia is an open source project to provide resources on implementing authentication using JavaScript and TypeScript.</p><h3><strong>2. </strong>Analytics, Logging and Tracking</h3><h4><strong>Clarity</strong> / <a href="https://clarity.microsoft.com/">clarity.microsoft.com</a> — 🏂</h4><p><strong>Clarity</strong> is a free user behavior analytics tool that helps you understand how users are interacting with your website through session replays and heatmaps.</p><h4>Aptabase / <a href="https://aptabase.com/">aptabase.com</a> — 🏂</h4><p>Aptabase is an easy to use and open source alternative to Google Firebase Analytics for Mobile and Desktop applications.</p><h4><strong>Umami / </strong><a href="https://umami.is/"><strong>umami.is</strong></a></h4><p>Umami is an open-source, privacy-focused web analytics tool that serves as an alternative to Google Analytics.</p><h4><strong>PostHog</strong> / <a href="https://posthog.com/">posthog.com</a></h4><p>PostHog is an all-in-one platform for product analytics, feature flags, session replays, experiments, and surveys that’s built for developers.</p><h3>3. Payments</h3><p><strong>Stripe </strong>/ <a href="https://stripe.com/">stripe.com</a> — 🏂<br>Stripe is a financial infrastructure platform for businesses. It allows you to process payments and manage subscriptions in many currencies for many countries.</p><h4><strong>Lemonsqueezy</strong> / <a href="https://www.lemonsqueezy.com/">lemonsqueezy.com</a></h4><p>Lemon Squeezy is the all-in-one platform for running your SaaS business. Payments, subscriptions, global tax compliance, fraud prevention, multi-currency are some of the features they offer.</p><h4><strong>Paystack</strong> / <a href="https://paystack.com/">paystack.com</a> — 🏂</h4><p>Paystack is used by businesses to accept payments online and offline from customers in Africa, supporting various channels like cards, mobile money and bank accounts.</p><blockquote>Stripe is a fintech giant valued at $91.5 billion. Interestingly enough, Stripe has acquired both Lemonsqueezy and Paystack *wink</blockquote><h3>4. CSS, UI Frameworks &amp; Icon Packages</h3><h4><strong>TailwindCSS</strong> / <a href="https://tailwindcss.com/">tailwindcss.com</a> — 🏂</h4><p>Of course I use Tailwind 😂! Tailwind is utility-first CSS framework packed with classes that can be composed to build any design.</p><h4><strong>Shadcn</strong> / <a href="https://ui.shadcn.com/">ui.shadcn.com</a></h4><p>Shadcn-ui is a modern React component library that provides developers with a set of highly customisable and accessible UI components.</p><h4><strong>HeroUI</strong> / <a href="https://www.heroui.com/">heroui.com</a> — 🏂</h4><p>An agnostic UI Framework that provides beautify ready components like Buttons and Modals that are easy to customise. It’s built on top of TailwindCSS.</p><h4><strong>React Icons</strong> / <a href="https://react-icons.github.io/react-icons/">react-icons.github.io/react-icons</a> — 🏂</h4><p>Include popular icons in your React projects easily with react-icons, which utilises ES6 imports that allows you to include only the icons that your project needs.</p><h3>5. Documentation</h3><h4><strong>Mintlify</strong> / <a href="https://mintlify.com/">mintlify.com</a></h4><p>Mintlify is a well-known documentation platform designed to help developers create, manage, and optimise API and product documentation efficiently.</p><h4><strong>Redocly</strong> / <a href="https://redocly.com/">redocly.com</a></h4><p>Redocly is a developer toolchain for designing, managing, and publishing API documentation. It helps you take an OpenAPI/Swagger spec and generate clean, interactive, and customisable API docs.</p><h4><strong>Scalar </strong>/ <a href="https://scalar.com/">scalar.com</a></h4><p>An open source and offline first API Platform that integrates with dozens of API Frameworks (Elysia, Hono, FastAPI, etc) and comes with an integrated API playground.</p><h3>6. SMS &amp; Email Notifications</h3><h4><strong>Twilio </strong>/ <a href="https://www.twilio.com/en-us">twilio.com</a></h4><p>It’s a communications APIs with AI and data for SMS, voice and email.<br>Twilio gives you the tools to connect digital experiences on any channel, full access to your customer data, and AI to work efficiently.</p><h4><strong>Brevo</strong> / <a href="https://www.brevo.com/">brevo.co</a>m — 🏂</h4><p>Brevo is an email Marketing Platform that goes beyond emails with SMS, Email, chat, and more.</p><h4><strong>Deywuro</strong> / <a href="https://www.deywuro.com/">deywuro.com</a> — 🏂</h4><p>For Ghanaians, Deywuro is a cost-effective solution for sending SMS. Their pricing starts around GHS 0.009 per SMS</p><h3>7. Data Visualisations — Charts &amp; Graphs</h3><h4><strong>Tremor</strong> / <a href="https://tremor.so/">tremor.so</a> — 🏂</h4><p>Tremor makes it so easy to build beautiful dashboards for the ReactJS / Next.js ecosystem. With the least effort, you can quickly put dashboards together and focus on the data, not perky chart customizsation.</p><h4><strong>Chartjs</strong> / <a href="https://www.chartjs.org/">chartjs.org</a></h4><p>Chart.js is a free JavaScript library for making HTML-based charts. It is one of the simplest visualization libraries for JavaScript.</p><h4><strong>Recharts</strong> / <a href="https://recharts.org/en-US">recharts.org</a></h4><p>Quickly build your charts with decoupled, reusable React components. Reliable. Built on top of SVG elements with a lightweight dependency on D3 submodules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*A3qY4aPzjjdzgb4sGIcwHQ.gif" /><figcaption>Whew! That was a intense!</figcaption></figure><p>You can read more of my articles on my website — <a href="https://www.okraks.fyi/writing">okraks.fyi/writing</a></p><p>What tools or tricks do you use to cut through the complexity in your projects? Drop them in the comments — I’d love to learn from you and update this article with your suggestions (with a shoutout, of course!) 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3298609da00b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yet Another Article to Dockerizing An App — But with a twist]]></title>
            <link>https://okraks.medium.com/yet-another-article-to-dockerizing-an-app-but-with-a-twist-2c8532ca48e0?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c8532ca48e0</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[image]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 10:12:54 GMT</pubDate>
            <atom:updated>2025-08-31T10:26:39.194Z</atom:updated>
            <content:encoded><![CDATA[<h3>Yet Another Article to Dockerizing An App — But with a twist</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9CZCFJcwCHvI8NCd" /></figure><p>Do-cker... doc-ker…. dock-er. You’ve probably heard this term so much and you’re wondering what the fuss is. What is it? Do I need it? Does it make a difference? I’ve been building apps without Docker just fine… I hear you. Just hold my mug.…</p><p>Officially, “<strong>docker</strong> <strong>is a tool that helps you develop, ship and run applications within lightweight containers.” </strong>Okay.. but what does this mean?</p><p>Say you’re building the next billion dollar app with your friend. You’re using a windows laptop while he’s using a mac. You make some changes to the code and push your updates to Github. He then pulls your updates and tries to run the application — damn, it doesn’t work. Ei? You jump on a Zoom call and show him that it works fine on your laptop; he then shares his screen and shows you a weird error… <em>well, that’s awkward</em>. It works fine on your machine, but it doesn’t on his. Why?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*eIegLko4I6HI8i0wgoLyFw.gif" /><figcaption>It doesn’t work on his machine?</figcaption></figure><p>For some kinds of apps, this wouldn’t have been an issue. Your todo app built using HTML, CSS and JavaScript maybe fine ;). However, other apps, for example, a NodeJS service that requires specific OS-level drivers / packages to work would easily run into compatibility issues — Windows and MacOS are fundamentally different. Also remember that the server your application would be deployed on might come with a different OS, setup and environment.</p><p>That’s where docker comes into play. What if in building, testing and deploying, you can have the same “<strong>configuration</strong>” used everywhere? You share that “<strong>configuration</strong>” with your friend, deploy it on your production server and it runs — just like magic, except that it’s not magic *wink.</p><h3>Lets dive into Docker: Concepts</h3><p>To get started with Docker, download Docker Desktop here: <a href="https://www.docker.com/get-started/">https://www.docker.com/get-started</a>. It installs a GUI you can use as well as the command line tools.</p><p>At the core of docker, there are three concepts to understand: Dockerfile, Images and Containers.</p><ol><li><strong>Dockerfile</strong></li></ol><p>It is text file with instructions on <strong>how to build</strong> a Docker image. Think of the Dockerfile as a recipe or a blueprint. It contains all the instructions — step by step — to set up your application. You specify everything your app needs and how to run / start it in the Dockerfile.</p><p><strong>2. Image</strong></p><p>Using the recipe (Dockerfile), you bake a cake (Image). Docker images are immutable, which means if you make any change to the Dockerfile and rebuild, you create a new image and do not modify the existing one (if any exist). Versions of an image are managed using <strong>tags</strong>.</p><p>Images can be shared with other developers anywhere — just think of it as giving a file to someone. Many developers use DockerHub to share images. As an example, here’s the official MongoDB Image on Docker: <a href="https://hub.docker.com/_/mongo">https://hub.docker.com/_/mongo</a></p><p><strong>3. Container</strong></p><p>A container is <strong>running instance</strong> of a Docker image. This is like eating or serving the cake to your guests. The image is static, but the container is a live process running inside of an isolated environment.</p><p>Now that we’re clear with the basic concepts and rationale behind using docker, lets dockerize (create a Dockerfile, build an image and use that to spin up a container).</p><p>Here’s the repo of what we’re building: <a href="https://github.com/okraks/dockerizing-app-example">https://github.com/okraks/dockerizing-app-example</a></p><h4><strong>Create a Dockerfile</strong></h4><p>Create a Dockerfile in the root of your application. The Dockerfile contains instructions (remember the recipe?) on how to package and run your app.</p><p><strong>1.Set the base image</strong>: This command sets the base image (think of it as a minimal OS that can run processes, libraries, networking and a filesystem). In this command, I use the official NodeJS image from Docker hub (it has nodejs and npm already installed)</p><pre>FROM node:18.11.0</pre><p>2. Set working directory: It’s usually good practice to set the <strong>working directory</strong> inside the container. All subsequent commands (COPY, RUN, etc.) will be executed inside /app. If /app doesn’t exist, it will be created automatically.</p><pre>WORKDIR /app</pre><p>3. <strong>Copy package.json and yarn.lock into the /app directory</strong>: This is a common optimization. You copy dependency files first, then run yarn install, so Docker can <strong>cache</strong> that layer if your dependencies haven’t changed everytime you rebuild the image.</p><pre>COPY ./package.json ./yarn.lock /app/</pre><p>4. <strong>Install Dependencies</strong>: RUN executes a command at build time (in contrast to CMD which runs at container start). This installs all dependencies listed in package.json using yarn.</p><pre>RUN yarn install --frozen-lockfile</pre><p>5. <strong>Copy code in src folder into docker</strong>: Copies your app’s source code from your local ./src folder into the container’s /app/src directory.<br>The syntax means <em>COPY “from” &lt;local directory&gt; “into” &lt;docker directory&gt;</em></p><pre>COPY ./src /app/src</pre><p>6. Start the application. Similar to running yarn dev to invoke the dev script in package.json. CMD defines the default command that runs when the container starts. For production builds, you’d use “yarn start”</p><pre><br>CMD [&quot;yarn&quot;, &quot;dev&quot;]</pre><h4><strong>Build the Image</strong></h4><p>Now that we have our instructions (Dockerfile), we can build our image using the command bellow. The flag <strong>-t</strong> assigns a name (and optionally a tag using syntax <strong>name:tag</strong>) to the image you’re building. The full stop is to point to the current folder we’re in.</p><pre>docker build -t our_awesome_app .</pre><p>So now we have an image called “<strong>our_awesome_app</strong>” and we can start a container using it, or even share it.</p><p>Here’s the example image shared on DockerHub: <a href="https://hub.docker.com/r/okraks/dockerizing-app-example">https://hub.docker.com/r/okraks/dockerizing-app-example</a></p><h4><strong>Start a Container using the Image</strong></h4><p>This command tells docker take the image “our_awesome_app” and start a new container using it. If the image doesn’t exist locally, it would try to pull it from DockerHub or any other registry.<br>“-p” is the <strong>port mapping flag</strong>. It connects a port inside the container to a port on your machine (the host). In our app, we started our server on PORT 8080 so we expose that same PORT from our container to our host machine. The syntax is <strong><em>-p &lt;host_port&gt;:&lt;container_port&gt;</em></strong></p><pre>docker run -p 8080:8080 our_awesome_app</pre><p>That’s it! Your application is running now and is available on your laptop on port 8080. In another article, we’d explore a setup of several applications (for example, a frontend, a database server and a backend service) using a popular library: <strong>docker-compose</strong>.</p><p>Enough talk. Time to build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*EqGxIoHQ5dpf9Bl_Hdf-MQ.gif" /></figure><blockquote><strong>Resources</strong></blockquote><p><strong>Learn Docker in 7 Easy Steps — Full Beginner’s Tutorial</strong><a href="https://docs.docker.com/get-started/docker-overview/"><br></a><a href="https://www.youtube.com/watch?v=gAkwW2tuIqE">https://www.youtube.com/watch?v=gAkwW2tuIqE</a></p><p><strong>The Only Docker Tutorial You Need To Get Started</strong> <a href="https://youtu.be/DQdB7wFEygo">https://youtu.be/DQdB7wFEygo</a></p><p><strong>Docker Docs</strong><a href="https://docs.docker.com/get-started/docker-overview/"><br>https://docs.docker.com/get-started/docker-overview/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c8532ca48e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Engineers Touch Grass: Lessons in building for Users]]></title>
            <link>https://okraks.medium.com/when-engineers-touch-grass-lessons-in-building-for-users-8bc09b5b975d?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bc09b5b975d</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[lessons]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 15:41:54 GMT</pubDate>
            <atom:updated>2025-08-24T15:41:54.500Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>We’ve all built features that looked great on paper but made zero sense once people tried them. That’s what happens when we forget to “touch grass” — when we don’t pause to see how our work fits into a user’s real-world context. Always remember, it’s easy to optimize for code; It’s harder to optimize for people. Here are 4 short lessons for engineers:</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QVpu73rii0L8kXZJ" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=medium&amp;utm_medium=referral">Annie Spratt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>1. Systems influence human behaviour (and vice versa)</strong></h3><p>How users interact with mobile apps, websites and desktop applications has been shaped by countless apps they’ve used before. These can be subtle or very obvious. For example, when a user hovers over a text and sees the cursor turning into a hand icon (☝🏾), the color changes and the text getting underlined, what’s the next action to expect? You guessed right! <strong>They click</strong> the text. It’s a subtle way browser conventions and websites for decades has shaped the users behavior. People don’t read, they scan and assume — your application shouldn’t be cognitively heavy for users lest they get frustruated. There are several tactics to go about producing a better experience for your users. You can explore concepts around <strong>progressive overload</strong>, <strong>nudges and friction</strong>, and <strong>intelligent defaults</strong>.</p><p>For applications in the same niche (eg. social media apps) there’s a “Most Advanced yet Acceptable principle” which states — “<strong>if you go too far from a user’s past experience, they reject it</strong>”. Ever wondered why the ♥️ is now the default icon for liking a post / comment / video? Now you do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dh3R0Q-nX0aEpdMs" /><figcaption>Photo by <a href="https://unsplash.com/@supply?utm_source=medium&amp;utm_medium=referral">Supply</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>2. Users interact with your software based on past experiences with other software</strong></h3><p>Following up on the previous topic, it would do you some good to understand existing / older applications before trying to replace them. Lets step into product design for a bit. Have you ever used a faucet you’re not familiar with? You’re puzzled for a few seconds wondering “<em>Is there a motion sensor?</em>”, “<em>Do I push or press the knob?</em>”, “<em>Do I turn it left?.. no right</em>”, “<em>What do I do?</em>” . You were basically trying to figure out how it works based on past experiences with other faucets.</p><p>In software engineering, you can’t tell what experiences your user has had. It’s likely the user might have interacted with software that had poor UX and they’d begin to use yours with that same mental model. There’s a subtle consistency heuristic in the mind of the user — <strong><em>it worked like that before, it should work like that now.</em></strong></p><p>Therefore, great design and software should anticipate misunderstanding and clarify them beforehand, it should embrace user assumptions and guide their behaviour without demanding attention. At the core, your job is to align the software with their brain — that includes whatever biases they have.</p><p>For example, if from an old system users clicked dashboard cards (with no clear click indicator) to route to a page with more details, you have to embrace it but with a cleaner approach; include a “View more →” button to your dashboard cards so that the users behave the same way without friction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D9MZXcbGsdjM06TB" /><figcaption>Photo by <a href="https://unsplash.com/@johnnycardoso_wk?utm_source=medium&amp;utm_medium=referral">Johnny Cardoso</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>3. Know your softwares’ non-negotiables</strong></h3><p>Not all software features are the same. Understand how your organization’s teams work deeply to prioritize the features they need to. <br>For example, an audit trail or a change history is crucial for teams that work on a same piece of data. It has to be clear who worked on what, when they did and what they did.</p><p>Roles and Permissions management is another non-negotiable feature in many enterprise software.</p><p>Some non-negotiable features that span across lots of domains include notifications (realtime or delayed), reporting, exporting data, searching and sorting data, analytics dashboards and authentication (authorization as well).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9P_H1_tW4fUsdHO-" /><figcaption>Photo by <a href="https://unsplash.com/@biancablah?utm_source=medium&amp;utm_medium=referral">Bianca Ackermann</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>4. Configurability versus Logic</strong></h3><p>When building software systems for teams, you can’t have 100% team configurability. How do you decouple core logic from team-level configurability without everything becoming a mess? Where do you draw the line?</p><blockquote><strong>Expose flexibility where it matters. Enforce logic where it matters more.</strong></blockquote><p>The goal is not the let teams configure everything, but to design systems that:</p><ul><li>Expose a limited safe area for configuration</li><li>Keep business-critical logic centralized and governed.</li><li>Allow teams to customize shape of processes but you enforce movement and integrity of the processes.</li></ul><p><strong>⚡ Example: Expense Approval Workflow System</strong></p><p>Imagine you’re building a <strong>company-wide expense approval system</strong> for a SaaS product.</p><p><strong>Core logic (non-negotiable across all teams):</strong></p><ul><li>Every expense must have an owner (user).</li><li>Expenses above a certain threshold must go through at least one approval.</li><li>Approval must be tracked with timestamp + approver identity.</li></ul><p>These rules ensure <strong>compliance, auditability, and system consistency</strong>.</p><p><strong>Team-level configurability (per department):</strong></p><ul><li>Marketing wants expenses auto-approved if under $100.</li><li>Engineering wants a <em>two-step approval</em> for expenses above $1000.</li><li>HR wants receipts required for <em>any</em> expense, no matter the amount.</li></ul><p>That’s it folks! There’s loads more on my website: okraks.fyi/writing</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bc09b5b975d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accept payments seamlessly with Stripe: A Developers’ Integration Guide]]></title>
            <link>https://okraks.medium.com/accept-payments-seamlessly-with-stripe-a-developers-integration-guide-9102c4aaa4be?source=rss-c9035f347d98------2</link>
            <guid isPermaLink="false">https://medium.com/p/9102c4aaa4be</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[stripe]]></category>
            <dc:creator><![CDATA[Okraks]]></dc:creator>
            <pubDate>Sat, 22 Feb 2025 11:14:11 GMT</pubDate>
            <atom:updated>2025-02-22T11:59:01.516Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Seamless Payments with Stripe: A Developer’s Guide to Easy Integration</strong></h3><p>Stripe has firmly established itself as a leader in payment processing, simplifying the payment acceptance process for developers. In this guide, we’ll walk through setting up a Node.js Express service integrated with Stripe using Checkout Sessions. We’ll focus solely on Checkout Sessions for a hands-on introduction. For other integration options, view the docs here: <a href="https://docs.stripe.com/payments/payment-methods/integration-options">Stripe Payment Options</a></p><h3>High Level Design &amp; Flow</h3><p>Before diving into the code, here’s a high-level overview of the integration process.</p><blockquote>Gotchas &amp; Things to Note</blockquote><ul><li><strong>Handle Currency and Amount Formatting: </strong>Stripe expects amounts in <strong>minor units</strong> (e.g., $10.00 should be passed as 1000 cents).</li><li><strong>Use Webhooks for Reliable Payment Confirmation</strong>: Don’t rely on the client-side redirect for payment status.</li><li><strong>Ensure Metadata is Passed Correctly</strong>: To track payments efficiently</li><li><strong>Enable Webhook Signature Verification</strong>: Always verify Stripe webhook signatures to prevent unauthorized or spoofed events.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JvooLNaIt3BNcvAzZTBz-Q.png" /><figcaption>Integration Process</figcaption></figure><h3><strong>Let’s Code </strong>🚀</h3><p><strong>Setting up our Express App</strong></p><ol><li>Initialise a package.json file</li></ol><pre>yarn init -y</pre><p>2. Install dependencies</p><pre>yarn add express stripe dotenv</pre><p>3. Install dev dependencies.</p><pre>yarn add -D nodemon typescript @types/express @types/node</pre><p>4. Initialise Typescript</p><p>This would create a new tsconfig.json file that tells typescript how to transpile our app</p><pre>npx tsc --init</pre><p>5. Update your scripts in package.json</p><pre> &quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;yarn install &amp;&amp; tsc&quot;,<br>    &quot;dev&quot;: &quot;nodemon src/server.ts&quot;,<br>    &quot;start&quot;: &quot;node dist/server.js&quot;<br>  }</pre><p>Your package.json should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*7QztoZHbB_reV6iV-kg7vQ.png" /><figcaption>package.json</figcaption></figure><p>5. Create your src folder and create a <strong>server.ts</strong> file in it</p><pre>import express, { Request, Response } from &quot;express&quot;;<br>import dotenv from &quot;dotenv&quot;;<br>import Stripe from &quot;stripe&quot;;<br><br>// Environment config<br>dotenv.config();<br><br>// Stripe initialization<br>let _stripe: Stripe | null = null;<br>export const getStripe = (): Stripe =&gt; {<br>  if (!_stripe) {<br>    _stripe = new Stripe(process.env.STRIPE_TEST_KEY as string);<br>  }<br>  return _stripe;<br>};<br><br>// create an express app<br>const app = express();<br><br>// Express Middleware setup<br>app.use(express.json());<br><br>const port = process.env.PORT || 3001;<br><br>// Default Route<br>app.get(&quot;/&quot;, (_, res) =&gt; {<br>  res.status(200).json({<br>    success: true,<br>    message: &quot;Our express app is live!&quot;,<br>  });<br>});<br><br>// Start Server<br>app.listen(port, () =&gt; {<br>  console.log(`🚀 Server up and running on port: ${port}`);<br>});</pre><p>6. Create an .env file in the root of your project</p><pre>PORT=8080<br>STRIPE_TEST_KEY=your_stripe_test_key<br>STRIPE_WEBHOOK_SECRET=stripe_webhook_secret</pre><p>Follow this guide to obtain your Stripe Test Key: <a href="https://docs.stripe.com/keys">https://docs.stripe.com/keys</a></p><p>7. Our app is ready... well almost. Run yarn dev to start the server. You should get this feedback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*MhWOn0hAsaBN62rOeA9kKQ.png" /></figure><p><strong>Lets Handle Payment Requests</strong></p><p>Now that our server is running. We’re going to do two things.</p><ol><li><strong>Accepting incoming payment requests from the client.</strong></li><li><strong>Listen for Stripe webhook events and process them</strong></li></ol><h3>1. Accepting Incoming Payment Requests</h3><p>When a payment request arrives, calculate the total amount to be paid. For example, in an e-commerce app, send the product_id and quantity, then retrieve the product price and compute the final amount. (Calculate the total amount in the backend, not the frontend, to ensure security and prevent tampering<strong>.</strong>)</p><p>When creating a <strong>Checkout Session</strong> with Stripe:</p><p>• <strong>Specify the currency</strong> in lowercase (e.g. “usd”).</p><p>• <strong>Convert the price to cents</strong> (e.g. $10.00 → 1000).</p><p>• <strong>Include relevant metadata</strong> (e.g. order_id, productName, productId).</p><p>• <strong>Set success and cancel URLs</strong> for proper redirection after payment.</p><p>Learn more about Checkout Sessions here: <a href="https://docs.stripe.com/api/checkout/sessions">Stripe Checkout Sessions</a></p><pre>// POST  /checkout to process incoming payment requests from client<br>app.post(&quot;/checkout&quot;, async (req: Request, res: Response) =&gt; {<br>  /*  <br>    Retreive cart from request, calculate final amount to be paid.<br>    In this example we&#39;re purchasing only one product with quantity 1<br>  */<br><br>  const product: { id: number; name: string; priceInCents: number } = {<br>    id: 1,<br>    name: &quot;Sunglasses&quot;,<br>    priceInCents: 4500,<br>  };<br><br>  // Create an order, store it on your database with paymentStatus &quot;unpaid&quot;<br>  // This article is focused on stripe so I&#39;m not doing that fully.<br>  const orderId = Math.floor(Math.random() * 1000);<br><br>  try {<br>    const session = await getStripe().checkout.sessions.create({<br>      currency: &quot;usd&quot;,<br>      metadata: {<br>        productName: product?.name,<br>        productId: product?.id,<br>        orderId: orderId,<br>      },<br>      line_items: [<br>        {<br>          price_data: {<br>            currency: &quot;usd&quot;,<br>            product_data: {<br>              name: product?.name,<br>              metadata: product,<br>            },<br>            unit_amount: product.priceInCents,<br>          },<br>          quantity: 1,<br>        },<br>      ],<br>      mode: &quot;payment&quot;, // other modes are &#39;subscription&#39; and &#39;setup&#39;<br>      success_url: `http://localhost:3000/checkout?status=failed`,<br>      cancel_url: `http://localhost:3000/checkout?status=failed`,<br>    });<br><br>    res.status(200).json({ checkoutUrl: session.url });<br>  } catch (e) {<br>    console.log(&quot;e&quot;, e);<br>    res.status(500).json({ error: &quot;Something went wrong&quot; });<br>  }<br>});</pre><h3>2. Listen for events strom Stripe via Webhook</h3><blockquote>Add this code block before the <strong>app.use(express.json())</strong> line. This is because, for Stripe to validate the signature of your webhook, it has to be raw without any json parsing</blockquote><pre>// Stripe webhook to listen for events<br>app.post(<br>  &quot;/stripe-webhook&quot;,<br>  express.raw({ type: &quot;application/json&quot; }),<br>  async (req: Request, res: Response) =&gt; {<br>    const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET;<br><br>    try {<br>      if (endpointSecret) {<br>        // Get the signature sent by Stripe<br>        const signature = req.headers[&quot;stripe-signature&quot;];<br><br>        if (!signature) {<br>          throw new Error(&quot;Missing Stripe signature&quot;);<br>        }<br><br>        const event = getStripe().webhooks.constructEvent(<br>          req.body,<br>          signature,<br>          endpointSecret<br>        );<br><br>        switch (event.type) {<br>          case &quot;checkout.session.completed&quot;: {<br>            const checkoutSession = event.data.object;<br><br>            const {<br>              currency,<br>              subscription,<br>              amount_total,<br>              status,<br>              payment_status,<br>              metadata,<br>              created,<br>            } = checkoutSession;<br><br>            // Get order ID from metadata since it was passed<br>            const orderId = metadata?.orderId;<br><br>            /*<br>             Mark order as complete based on the payment_status<br>             You have access ti other information from the checkout session<br>             including the amount_total, date created, currency and so much more<br>             checkoout the Checkout session object in stripe docs: https://docs.stripe.com/api/checkout/sessions/object<br>            */<br><br>            // handle your database updates and any other logic<br>            if (payment_status == &quot;paid&quot;) {<br>              //<br>            }<br><br>            break;<br>          }<br><br>          default:<br>            console.log(`⚡️ Unhandled Stripe Webhook -&gt;  ${event.type}`);<br>        }<br><br>        res.json({ received: true });<br>      } else {<br>        res.status(500).json({ message: &quot;Something went wrong&quot; });<br>      }<br>    } catch (error: any) {<br>      console.error(`Webhook error: ${error?.message}`);<br>      res.status(400).send(`Webhook error: ${error?.message}`);<br>    }<br>  }<br>);</pre><p><strong>Forwarding Stripe Events to your local machine</strong></p><p>Add your local event listener in the Stripe dashboard. Ensure that your webhook endpoint has been configured with the “checkout.session.completed” event included.</p><p>View the docs here: <a href="https://docs.stripe.com/webhooks/quickstart">https://docs.stripe.com/webhooks/quickstart</a></p><p>Install the Stripe CLI, login and run this command. This would listen to webhook events and forward them to the endpoint we specified.</p><pre>stripe listen --forward-to localhost:8080/stripe-webhook</pre><p>Now we’re ready to test our setup.</p><p><strong>Interactive Testing With Stripe Test Keys</strong></p><p>When testing interactively, use a card number, such as <a href="https://docs.stripe.com/testing?testing-method=card-numbers#visa">4242 4242 4242 4242</a> to simulate a successful payment.</p><ul><li>Use a valid future date, such as 12/34.</li><li>Use any three-digit CVC (four digits for American Express cards).</li><li>Use any value you like for other form fields.</li></ul><p>Read More Here: <a href="https://docs.stripe.com/testing?testing-method=card-numbers#testing-interactively">Testing Cards for Stripe</a></p><p><strong>Full Code for this tutorial is available on Github</strong></p><p>You can view the full code on Github: <a href="https://github.com/okraks/stripe-integration-guide">https://github.com/okraks/stripe-integration-guide</a></p><p><strong>Related Articles &amp; Resources</strong></p><ul><li>WebDev Simplified: How to Accept Payments with Stripe: <a href="https://youtu.be/1r-F3FIONl8">https://youtu.be/1r-F3FIONl8</a></li><li><a href="https://docs.stripe.com/checkout/quickstart?client=next&amp;lang=node">https://docs.stripe.com/checkout/quickstart?client=next&amp;lang=node</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9102c4aaa4be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>