<?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 Bashorun Dolapo on Medium]]></title>
        <description><![CDATA[Stories by Bashorun Dolapo on Medium]]></description>
        <link>https://medium.com/@bashorundolapo?source=rss-f8807e7c7e64------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aQ-pdhbIj_jVUeWmnx7MRQ.jpeg</url>
            <title>Stories by Bashorun Dolapo on Medium</title>
            <link>https://medium.com/@bashorundolapo?source=rss-f8807e7c7e64------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 10:04:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bashorundolapo/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 Linux Notes I Wish I’d Had Earlier]]></title>
            <link>https://medium.com/@bashorundolapo/the-linux-notes-i-wish-id-had-earlier-e5ac0e8d60b4?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5ac0e8d60b4</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 13:04:04 GMT</pubDate>
            <atom:updated>2026-06-24T08:16:18.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QapNofwz6bYaDI0o" /></figure><p>Did you know that Linux powers most of the internet?</p><p>Web servers, ATMs and cloud infrastructure. Even Android phones and embedded systems like your smart fridge all run on Linux. Which means that Linux quietly runs most of the world.</p><p>So even if you’re not a systems engineer, understanding a little Linux can make you a better developer.</p><p>Last week, while looking for something new to learn, I picked up a Linux crash course on YouTube.</p><p>Here are six concepts that immediately made the operating system click for me.</p><h3>1. Terminal, Shell and Kernel</h3><p>Think of Linux as a restaurant — a well-organised restaurant. To get anything done, three different layers have to work together:</p><p><strong>The Terminal (The Waiter)</strong></p><p>This is just the visual interface. The part you see when you open macOS Terminal or Windows Terminal or GNOME.</p><p>It kinda looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*vAJnFJ_smPNMLs9Z.png" /></figure><p><strong>The Shell (The Chef)</strong></p><p>This is the program that takes your input and interprets it into something the system understands.</p><p>Common types you might have heard of include Bash and Zsh.</p><p><strong>The Kernel (The Kitchen)</strong></p><p>This is where the actual magic happens. The kernel directly manages your physical hardware (CPU, RAM, hard drives).</p><p>***</p><p>In short<strong>, </strong>when you type a command into the <strong>Terminal</strong>, the shell interprets your command and spins up the appropriate program.</p><p>That program then talks to the kernel whenever it needs access to hardware, files, memory, or other system resources.</p><p><em>Capiche?</em></p><h3>2. Absolute vs. Relative Paths</h3><p>One thing you’ll hear often in Linux is that “everything is a file.”</p><p>Devices, processes, sockets and regular files are often accessed through a file-like interface.</p><p>This means that finding your way around the Linux file system is one of the most important skills to learn.</p><p>To do that, you need to tell the shell exactly which file you want to visit.</p><p>And you can do this in two ways:</p><p><strong>Absolute Paths</strong></p><p>These are paths starting from the very root (/) of the system. In other words, you can use absolute paths no matter where you currently are, because they start from the top.</p><p>For example, if I wanted to access a report.txt file in my documents folder, I would use the path:</p><p>/home/user/documents/report.txt</p><p><strong>Relative Path</strong></p><p>These ones are like paths relative to the one you’re currently in (otherwise known as your ‘<em>current working directory’</em>).</p><p>For example, if I was already in the /home/user/ directory, the relative path to the /report.txt file in my documents folder would simply be documents/report.txt.</p><p>Just note that relative paths use shorthand like . (to refer to the current folder) and .. (to refer to one folder up).</p><h3>3. The Anatomy of a Command</h3><p>Almost every Linux command has a fixed structure.</p><p>command =&gt; [options] =&gt; [arguments]</p><p>Note that the square brackets around options and arguments mean that they are optional. Ergo, not all commands have options or arguments.</p><p>For example:</p><pre>ls -l /home/user/Documents<br># this command lists all the files in the /home/user/Documents folder</pre><ul><li>ls → is the command (show me all the files)</li><li>-l → is the option (show it to me, but in detail)</li><li>/home/user/Documents → is the argument (the specific location I want to access)</li></ul><h3>4. File Permissions</h3><p>One of the first things you’ll discover in Linux is that not everyone is allowed to do everything.</p><p>Every file and folder comes with a set of permissions that determine who can read it or modify it, or execute it.</p><p>Like the work fridge with labelled plates of food inside. Except that instead of labels like “Bisi” or “Lade”, you’ll often see something that looks like this:</p><pre>-rwxr-xr--</pre><p>At first glance, it looks like somebody threw their keyboard down a staircase.</p><p>But don’t fret. It’s actually quite simple.</p><p>The first character tells you what kind of thing you’re looking at.</p><p>“-” means a regular file.<br>“d” means a directory (folder).</p><p>The remaining characters are split into three groups:</p><pre>1. rwx<br>2. r-x <br>3. r — </pre><p>These represent permissions for:</p><ol><li>The owner</li></ol><p>2. The group</p><p>3. Everyone else</p><p>You should also note that each letter has a meaning:</p><p>r → Read<br>w → Write<br>x → Execute</p><p>So in the example above (-rwxr-xr — ):</p><ul><li>The owner can read, write and execute the file (rwx).</li><li>Members of the group can read and execute it (r-x).</li><li>Everyone else can only read it (r — ).</li></ul><p>This permission system is one of the reasons Linux is considered so secure.</p><p>Because every file clearly defines who is allowed to do what.</p><h3>5. Standard Streams and I/O Redirection</h3><p>Think of Linux programs as machines with three built-in pipes.</p><ul><li><strong>stdin (Standard Input / Stream 0)</strong></li></ul><p>This is where a program receives data.</p><p>For example:</p><pre>cat</pre><p>If you type:</p><pre>Hello</pre><p>and press Enter, cat receives that text through stdin.</p><ul><li><strong>stdout (Standard Output / Stream 1)</strong></li></ul><p>This is where a program sends normal output.</p><p>For example:</p><pre>echo “Hello”</pre><p>produces:</p><pre>Hello</pre><ul><li><strong>stderr (Standard Error / Stream 2)</strong></li></ul><p>This is where a program sends error messages.</p><p>For example:</p><pre>cat missing-file.txt</pre><p>might produce:</p><pre>cat: missing-file.txt: No such file or directory</pre><p>The useful thing about Linux is that stdout and stderr are two separate streams.</p><p>This means that you can redirect successful output and error messages to different places when building scripts.</p><h3>6. Shell Expansions</h3><p>Finally, before the shell executes your command, it performs what we call <strong>expansion.</strong></p><p>No, not the Jujutsu Kaisen kind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*tJDGlCbWqRJezfb5.gif" /></figure><p>Expansion in Linux refers to how the system evaluates shorthands, math, or variables and replaces them with real data.</p><p>For instance, if you enter echo *.txt into the terminal, the system expands *.txt into a list of every (denoted with *) text file in the folder.</p><p>To control or stop this expansion magic, you simply use <strong>quotes. </strong>As in:</p><p>echo *.txt</p><p>versus</p><p>echo &#39;*.txt&#39;</p><p>You can even do more to make shell expansions more powerful, especially when you introduce variables.</p><p>For example:</p><pre>name=&quot;Dolapo&quot;<br>echo $name</pre><p>Output:</p><pre>Dolapo</pre><p>Before running the command, the shell expands $name into its value. That makes expansion feel more substantial than just wildcard matching.</p><p>In short, Linux has a reputation for being intimidating. But after spending a few hours with it, I realised that most of what I considered “hard” came from unfamiliar terminology.</p><p>Once concepts like shells, paths, permissions and streams start making sense, Linux feels less scary.</p><p>I’m still learning, but these six concepts have given me a foundation that made everything else easier to understand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5ac0e8d60b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Overcomplicating Things: 7 Modern State Management Rules For Frontend Developers]]></title>
            <link>https://medium.com/@bashorundolapo/stop-overcomplicating-things-7-modern-state-management-rules-for-frontend-developers-2478ee563036?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/2478ee563036</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[react-state]]></category>
            <category><![CDATA[state-management]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Thu, 14 May 2026 14:29:58 GMT</pubDate>
            <atom:updated>2026-05-14T14:29:58.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mz4-CYH0drJRixCl.png" /></figure><p>Three years ago, if you wanted to create a new React project, you’d have to go through a whole routine of setups and installs.</p><p>You’d have to get Redux working, set up sagas and define thirty different action types. Two weeks later, you’re drowning in a sea of boilerplate. Even worse, passing data from parent to child feels like you’re performing open-heart surgery.</p><p>One mistake, and everything breaks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*bcJ2fHtiL-eyU1ON.gif" /></figure><p>Maybe it’s time to do things better from here. If you want to build faster, cleaner and more maintainable applications, here are 7 golden rules for modern state management.</p><h3>1. Let the URL Be Your Source of Truth</h3><p>Assume you’re building a social media or a book-reading app. If a user can bookmark something, share it, or refresh the page and expect to see the same thing, that data belongs in the URL.</p><p>Filters, search queries, and pagination shouldn’t live in useState.</p><p>Using the URL to store data, in this case, gives you “state for free.” This way, your “back” button works more naturally, and your internal component logic is a lot more maintainable.</p><h3>2. Distinguish Between Server Cache and Client State</h3><p>Most of what we call “state” is actually just a <strong>cache</strong> of data living on a server.</p><p>If building a web app is like driving a car, then using useEffect and useState to fetch data is like driving stick. Things WILL stall if you aren’t a pro at handling race conditions and cache invalidation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*iNHG4disV4fPrPg1.gif" /></figure><p>Move that burden to tools like <strong>React Query</strong> or <strong>SWR</strong>. Once server data is handled externally, you’ll realise your actual “client state” (like whether a sidebar is open) is wonderfully small.</p><h3>3. Use the “State Lift” Before the “Library Shift”</h3><p>Don’t reach for a library the moment two components need the same data.</p><p>As a rule of thumb, always lift state to the nearest common ancestor.</p><p>Think of state as a physical tool in a workshop. If John and Bisi are working at the same table and both need a hammer, you simply put one on the table between them.</p><p>You don’t build a massive, automated warehouse (a global store) just so they can share one tool.</p><h3>4. Derived State Is Not New State</h3><p>One of the most common ways to introduce bugs is by syncing two pieces of state that depend on each other.</p><p>Check this out:</p><pre>// ❌ BAD: Storing derived data<br>const [items, setItems] = useState&lt;Item[]&gt;([]);<br>const [totalPrice, setTotalPrice] = useState(0); <br><br>// ✅ GOOD: Calculate on the fly<br>const [items, setItems] = useState&lt;Item[]&gt;([]);<br>const totalPrice = items.reduce((acc, item) =&gt; acc + item.price, 0);</pre><p>The “bad” example forces you to manually update totalPrice every time items changes. The &quot;good&quot; example calculates it during render. If you can calculate it from existing props or state, <strong>do not</strong> put it in a useState.</p><h3>5. Embrace the Power of “Colocation”</h3><p>Keep state as close to where it’s used as possible. If a piece of state is only needed within a specific component, leave it there.</p><p>This way, when you delete a feature, you delete all of its logic without having to comb through the entire project folder.</p><h3>6. Lean on Composition to Avoid Prop Drilling</h3><p>Before you use “prop drilling” as an excuse to reach for Context API, you should try component composition.</p><p>Instead of passing data through five different layers of components, have you tried passing the child itself down?</p><p>Instead of this:</p><pre>&lt;Layout user=&quot;{user}&quot;/&gt; <br>//which passes user to Header, then to Avatar...</pre><p>Try this:</p><pre> &lt;Layout avatar={&lt;Avatar /&gt;} header={&lt;Header user={user} /&gt;} /&gt;</pre><h3>7. Choose Your Tooling Based on Complexity</h3><p>State management isn’t one-size-fits-all, and you should always use the right tool for the job:</p><p>Instead of using Redux toolkit for everything, try:</p><ul><li>useState/useReducer for simple apps with simple data requirements</li><li>React/Query/SWR for data you need to fetch from a server</li><li>For cross-cutting UI (like light/dark mode switching, for example), use React context</li><li>For complex data with high refresh frequency, use Zustand, Jotai or Redux Toolkit</li></ul><p>At the end of the day, one of the attributes of any decent developer isn’t how many libraries they know how to integrate. It’s in how well they handle complexity.</p><p>The next time you have to make a system design decision, remember to start small, stay local and only scale your state management when the friction starts to show signs of becoming a problem.</p><p>Stop killing flies with sledgehammers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2478ee563036" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Double-Charging for Jollof: A Dev’s Guide to PUT vs. POST]]></title>
            <link>https://medium.com/@bashorundolapo/stop-double-charging-for-jollof-a-devs-guide-to-put-vs-post-7420fbfc0c8f?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/7420fbfc0c8f</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 06:54:11 GMT</pubDate>
            <atom:updated>2026-04-21T06:54:11.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*4NLtHsks73h_hsKo.jpg" /></figure><p>We’ve all been there at some point. You’re in the middle of a technical interview, and things are going well.</p><p>At least until the lead dev leans back and drops the hammer: <em>“So, what’s the actual difference between PUT and POST?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/0*YFn-Gt53RiO1lLeE.gif" /></figure><p>You freeze. You mumble something about “creating vs. updating,” and they give you that polite nod you know too well. On the trip back home, you realize that you didn’t <em>actually</em> know the answer.</p><p>You just knew the vibes.</p><p>Even worse (or better?), you get the job and there’s a problem in your third month on your company’s checkout page. When users click “submit” twice, they get charged double.</p><p>This of course, is a big problem. And you even get a query because somehow, a few frustrated customers pressed “submit” two to ten times.</p><p>Why is this all happening? Because you used a POST where you should have used a PUT.</p><p>You need to learn the difference between these two.</p><h3>The “Locker vs. Order” Analogy</h3><p>Forget documentation for a second, and let’s go to a restaurant. We will then go to a gym after this.</p><h3>POST is an Order Form</h3><p>Imagine you’re at a bukka or a restaurant. Every time you hand a <strong>POST</strong> request (your order) to the guy behind the counter, he creates something new.</p><ul><li>If you hand him the same order form three times, he’s going to serve you three plates of rice.</li><li>In this scenario, you don’t know which plate (riceId) the food will come in until he hands you the receipt.</li><li>As such, the server is the boss, because it decides which plate you get, and which flavor of rice you eat.</li></ul><p>If you state your order three times, you get three plates and pay thrice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HbRtkwV3KKOEmu3T.jpg" /></figure><h3>PUT is a Storage Locker</h3><p>Now imagine you have a specific locker at the gym. One you like very much: Let’s call this <strong>Locker #42</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Odtg6e-I6Ke4jBJg.jpg" /></figure><p>Making a PUT request is like walking up to that exact door with your bag, every evening.</p><ul><li>If the locker is empty, you put the bag in.</li><li>If the locker is full, you take out whoever’s bag was there and replace it with yours (you’re a donkey if you do this in real life).</li><li>If you do this 10 times with the same bag, <strong>Locker #42 still looks exactly the same as it did on your first day at the gym.</strong></li></ul><p>Do you see the difference between this and the bukka scenario? In the gym, you know which locker to put your bag in, while in the bukka, you have no idea what kind of plate your food will come in.</p><h3>The Magic of Idempotency</h3><p>The bone of contention here is something called “Idempotency”. Think of this as a fancy way of saying “<strong>Safety via repetition”.</strong></p><p>If an operation is <strong>idempotent</strong>, it means you can hit that API endpoint as many times as you want with the same data, and the state of the server won’t change after the first successful hit.</p><p><strong>So why does this matter?</strong></p><p>The internet can be a very strange resource at times. At times a request goes through, but the “Success” message gets lost somewhere down the line.</p><p>For example, if your “Pay Now” button is a <strong>POST</strong> and the user clicks it again because the page didn’t refresh, they just bought two cars (bye bye, ₦80 million).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*_kPASxZcrd0lNTBC.gif" /></figure><p>But if it’s a <strong>PUT</strong> (to a specific transaction ID), the second click does nothing, because the locker already has your bag in it. Because of this, PUT requests are the ultimate safety net for distributed systems.</p><h3>A General Rule of Thumb</h3><p>Next time you’re staring at your code wondering which method to pick, try asking yourself:</p><p><strong>“Does the client already know the specific ‘Address’ or ‘ID’ of what it’s sending?”</strong></p><ul><li>If <strong>YES</strong> (and you want to replace whatever is there or create at that specific ID), use <strong>PUT</strong>. If you don’t (you want the server to handle it and tell you where it went) use <strong>POST</strong></li></ul><p>At the end of the day, it’s time to stop guessing and start “PUT-ting” things where they belong 🌚.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7420fbfc0c8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create A Simple Next.js Monorepo With PNPM]]></title>
            <link>https://medium.com/@bashorundolapo/how-to-create-a-simple-next-js-monorepo-with-pnpm-82af37289b50?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/82af37289b50</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[pnpm]]></category>
            <category><![CDATA[monorepo]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 21:05:57 GMT</pubDate>
            <atom:updated>2025-08-11T21:05:57.020Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XK2Ycb6R0x0FvErh3k15qQ.png" /></figure><p>What is a monorepo, and why would you even want to use one?</p><p>If you wanted to build a blog or a simple word-based game with, say, Next.js, you’d likely do things the conventional way.</p><p>A simple…</p><pre>mkdir my-project<br>cd my-project<br>npx create-next-app@latest</pre><p>…would get you started with a boilerplate project that you can start building on top of.</p><p>However, consider a scenario where you are a startup founder, trying to build the next billion-dollar company.</p><p>Your idea is so big that you need a frontend application for this, a backend, a repo to manage the AI/ML aspect of things, maybe a mobile app and so on…</p><p>You can already see how this will become a problem for you along the line. As your company scales, the sheer number of these individual repos will increase (not to mention their sizes).</p><p>In addition, some of these repos will likely have shared dependencies that can be hard to keep track of.</p><p>This is where monorepos come in.</p><h3>A Small Analogy To Get You Up To Speed</h3><p>Think of yourself as a real estate manager with several houses in town under your company. Each of these houses has its utility bills and its own unique set of rules.</p><p>You might be fine with five houses or maybe even a dozen. However, what if you had a hundred to manage… or a thousand?</p><p>With a monorepo, you can think of this scenario as having the same plumbing service, the same firefighters and the same community gym in the middle of town, that all the houses you manage can share.</p><p>Monorepos allow several projects to share the same resources, tooling and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*C2FML7pJFno891iFqSivqg.gif" /></figure><p>Instead of running git commits on several projects, monorepos can even allow you to make a single commit that updates code across multiple projects.</p><p>This makes sure that everything is in sync, which is a massive win for maintainability.</p><p>And in this tutorial, we will set up a monorepo containing two Next.js projects and a shared UI library, all managed by pnpm.</p><h3>Step 1: Laying the Foundation</h3><p>First, we need to create the root of our monorepo and set up pnpm workspaces. This is similar to buying up the initial land for all of our houses and drawing up the blueprints.</p><p>First of all, head over to whichever directory on your computer you would like to start with.</p><p>Open PowerShell on your Windows computer (or equivalent for Linux) and create a new directory for your monorepo like so:</p><pre>mkdir my-nextjs-monorepo <br>cd my-nextjs-monorepo</pre><p>You should see something that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oCPP8mHsR5BUVzh1JHcRtg.png" /></figure><p>Next, we initialise the project with a package.json file like so:</p><pre>pnpm init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ybX-QE9GDyewzIaFaaiXuQ.png" /></figure><p>Next, we create the pnpm-workspace.YAML file.</p><p>Think of this file as a directory that tells pnpm where to look for its &quot;workspaces&quot; (our smaller individual projects within the monorepo).</p><p>We&#39;ll set up two directories: one for our applications (apps) and one for our shared packages (packages), like so:</p><pre>New-Item -Path &quot;.&quot; -Name &quot;pnpm-workspace.yaml&quot; -ItemType &quot;File&quot;</pre><p>Then open this up in VS Code with:</p><pre>code .</pre><p>A VS Code window should pop up almost instantly, and you should see your nice pnpm-workspace.yaml file there.</p><p>Open it up, and add the following config:</p><pre>packages:<br>  - &#39;apps/*&#39;<br>  - &#39;packages/*&#39;</pre><p>This configuration tells pnpm to treat any subdirectory inside apps and packages as a separate project or workspace.</p><p>After this, we create the apps and packages directories. Open up your integrated terminal by clicking Ctrl + `</p><p>Then type in:</p><pre>mkdir apps <br>mkdir packages</pre><p>Your project structure should now look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61JpoinKyU0llYlP0Rl2EQ.png" /></figure><h3>Step 2: Building Our Applications</h3><p>Now it’s time to build the individual apartments in our complex. We’ll create two Next.js projects: web-app and admin-app.</p><p>Navigate into the apps directory via your terminal like so</p><pre>cd apps</pre><p>We’ll then create our first project, and as mentioned earlier, we’ll call it web-app.</p><pre>pnpm create next-app web-app</pre><p>That should spin up quickly as Next.js asks you a few questions about your project. Accept all the defaults (or choose options that suit your needs).</p><p>Then repeat the process for the second project, admin-app.</p><pre>pnpm create next-app admin-app<br></pre><p>You might notice that the admin-app spins up faster than the web-app. Remember the “shared gym” and “shared fire-service” analogy we made earlier?</p><p>Exactly!</p><p>Your project should now look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kFfBvMjX9lVesOVUNEGMQ.png" /></figure><p>⚠️<strong>Important:</strong> If you’ve used Next.js before, you should know that projects often default to running on port 3000.</p><p>In a monorepo, however, you can’t have two apps running on the same port.</p><p>To fix this, open the package.json file for each Next.js app (apps/web-app/package.json and apps/admin-app/package.json) and modify the dev script to use a different port for each.</p><p>Find the “scripts” field in each of these and set it up like so:</p><pre>// apps/web-app/package.json <br>&quot;scripts&quot;: {   <br>  &quot;dev&quot;: &quot;next dev -p 3001&quot;,   <br>  // ... other scripts <br>}<br><br><br>// apps/admin-app/package.json <br>&quot;scripts&quot;: {   <br>  &quot;dev&quot;: &quot;next dev -p 3002&quot;,   <br>  // ... other scripts <br>}</pre><h3>Step 3: Creating a Shared Library</h3><p>One of the main benefits of a monorepo is code sharing.</p><p>Let’s create a shared package that both of our Next.js apps can use. This will serve as our shared laundry room or gym. A resource all tenants can access.</p><p>We’ll create a simple UI library called ui-components.</p><p>Navigate into the packages directory.</p><pre>// navigate back into the root directory and into packages<br>cd ..<br>cd packages<br><br>// create the folder and navigate into it<br>mkdir ui-components <br>cd ui-components <br><br>//initialise pnpm<br>pnpm init</pre><p>Create a new directory for your shared package and initialise it.</p><p>Then install React as a dependency for this package.</p><pre>pnpm add react</pre><p>Open packages/ui-components/package.json and give it a nice name. This name is what other projects in your monorepo will use to import this package. It&#39;s a good practice to use a scoped name like @my-monorepo/ui-components.</p><p>You can even call it @potato/ui-components or @ice_cream/ui-components. In this scenario, however, we’re sticking to @my-monorepo/ui-components.</p><p>Your package.json in your @my-monorepo/ui-components should look like this now:</p><pre>// packages/ui-components/package.json <br>{   <br>  &quot;name&quot;: &quot;@my-monorepo/ui-components&quot;,   <br>  &quot;version&quot;: &quot;1.0.0&quot;,   <br>  &quot;main&quot;: &quot;index.js&quot;,   <br>  &quot;license&quot;: &quot;ISC&quot;,   <br>  &quot;dependencies&quot;: {     <br>    &quot;react&quot;: &quot;^18.2.0&quot;   <br>  } <br>}</pre><p>Next, create a simple component to test the sharing. For example, a Button component in packages/ui-components/index.js.</p><pre>// packages/ui-components/index.js <br><br>import React from &#39;react&#39;;<br><br> <br>export const Button = ({ children, ...props }) =&gt; (   <br> &lt;button style={{ padding: &#39;10px&#39;, borderRadius: &#39;5px&#39; }} {...props}&gt;     <br>     {children}   <br> &lt;/button&gt; <br>);</pre><h3>Step 4: Connecting the Pieces</h3><p>Now, let’s allow our Next.js apps to use the shared UI library. This is like giving each house a key to the public gym or pool.</p><p>Navigate back to the root of your monorepo via your terminal like this:</p><pre>cd ../..</pre><p>Make sure that the package.json file in your @my-monorepo/ui-components folder has “@my-monorepo/ui-components” as its name, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKWzrVdWcEvJK3izdsQ1Cw.png" /></figure><p>You can also check my file structure to make sure that you aren’t making any mistakes.</p><p>Next, add the ui-components package as a dependency to your web-app project.</p><p>Note that the --filter flag allows pnpm to run commands on specific workspaces, rather than the whole monorepo.</p><p>The --workspace flag tells pnpm that you’re adding a dependency from another workspace within the same monorepo, which is very important.</p><pre>pnpm add @my-monorepo/ui-components --filter web-app --workspace</pre><p>Repeat for the admin-app project.</p><pre>pnpm add @my-monorepo/ui-components --filter admin-app --workspace</pre><p>Now, you can use the shared component in your applications. For example, open apps/web-app/app/page.tsx and add a button.</p><p>Delete the boilerplate code in the file, and paste the following.</p><pre>// apps/web-app/app/page.tsx <br><br>import { Button } from &#39;@my-monorepo/ui-components&#39;;<br><br>export default function Home() {<br>  return (<br>    &lt;main&gt;<br>      &lt;h1&gt;Web App&lt;/h1&gt;<br>      &lt;Button onClick={() =&gt; alert(&#39;Hello from web app!&#39;)}&gt;<br>        Click Me (Web)<br>      &lt;/Button&gt;<br>    &lt;/main&gt;<br>  );<br>}</pre><p>Repeat this for your admin-app with a different message. I’ll let you do this yourself 😉.</p><h3>Step 5: Running the Monorepo</h3><p>The final step is to create some scripts in our root package.json to manage everything easily. This is our real estate manager’s master control panel.</p><p>Open your root package.json file.</p><p>Add a dev script that runs both applications in parallel using pnpm -r --parallel.</p><p>Note that the -r flag runs the command in every workspace, and --parallel runs them at the same time.</p><pre>// package.json (at the root) <br><br>{   <br><br>  &quot;name&quot;: &quot;my-nextjs-monorepo&quot;,   <br>  &quot;private&quot;: true,   <br>  &quot;version&quot;: &quot;1.0.0&quot;,   <br>  &quot;scripts&quot;: {     <br>    &quot;dev&quot;: &quot;pnpm -r --parallel run dev&quot;   <br>  },   <br>  &quot;packageManager&quot;: &quot;pnpm@9.5.0&quot; //this doesn&#39;t have to be your pmpm version<br><br>}</pre><p><em>Psst! You might have noticed that the </em><em>package.json file has the </em><em>private flag set to </em><em>true.</em></p><p><em>This prevents the root package from being accidentally published to a registry (like npm). It is a best practice for monorepos, so be sure to include that.</em></p><p>Now, from the root of your monorepo, you can run pnpm dev, and both Next.js applications will start… yes, at the same time!</p><p>You should be able to access them at http://localhost:3001 and <a href="http://localhost:3002/">http://localhost:3002</a> (just as we set them up).</p><p>Changes in your ui-components package will also be automatically detected and hot-reloaded in both applications.</p><h3>In Summary</h3><p>This has been a very exhaustive tutorial 😅</p><p>I enjoyed creating this, and hopefully, you followed along and were able to get a nugget or two.</p><p>Who knows, this article might have indirectly kick-started the groundwork for the next billion-dollar startup.</p><p>If this helped you, be sure to <a href="https://www.linkedin.com/in/bashorun-dolapo-8b5164225/">connect with me</a> on LinkedIn and on <a href="https://github.com/codebydolapo/">GitHub</a>. Also follow me <a href="https://medium.com/@bashorundolapo">here</a> on Medium for more helpful content.</p><p>Check out the dedicated repo for this tutorial <a href="https://github.com/codebydolapo/monorepo-example">here</a>, in case you get stuck at any point.</p><p>See you at the next one!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82af37289b50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Pet Adoption Platform Using Next.js, Graph QL and Clerk]]></title>
            <link>https://medium.com/@bashorundolapo/building-a-pet-adoption-platform-using-next-js-graph-ql-and-clerk-4501c3af89d9?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/4501c3af89d9</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 22:34:24 GMT</pubDate>
            <atom:updated>2025-07-08T23:08:23.986Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there, fellow developers and pet enthusiasts!</p><p>Welcome to another episode of my “Explainer Articles,” where I share something I’ve built recently, what I’ve learned and so on.</p><p>This time around, I have spent the last few weeks building this latest project… A mock pet-adoption platform where stray and stranded animals get to find their forever homes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrsWlR7AsxkbbsWizwhpZQ.png" /></figure><p>While the generally pleasant feel of the frontend platform might catch the average visitor’s eye at first, I wanted to focus more on explaining the real powerhouse behind this project this time around:</p><p>The backend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*BmJeig7hm4bmHHEXk8tQxA.gif" /></figure><p>When building any kind of Full-Stack application, developers often face a few architectural problems.</p><p>Do we go with the tried-and-true REST API, or do we use something else? Something modular, easy to set up and powerful.</p><p>This is why, for this pet platform, I chose to use <strong>GraphQL</strong>… And let me tell you why.</p><h3>The “Why” Behind GraphQL</h3><p>Before GraphQL, I’d often find myself writing multiple REST endpoints.</p><p>If I needed details for a pet or a car… or an order of some kind, to display on the frontend:</p><p>I’d have to create and hit /api/pets/:id every time.</p><p>If I need the agent info for that pet, I’d have to make another call to /api/agents/:id.</p><p>Then, if I wanted a list of similar pets, I’d still have to work with another endpoint… and on and on we go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*aJOCvx95bUJiJ5RZLMGX6A.gif" /></figure><p>This problem often leads to data overfetching or underfetching, not to mention API version proliferation as the app grows.</p><p>With GraphQL, though, I simply configure the backend, then go through the frontend and demand exactly what I want.</p><p>There are no more scenarios where I simply need a name or an ID, and get back not only this, but also photos, addresses and emails.</p><p>Imagine a single, intelligent endpoint where your frontend describes <em>exactly</em> what parts of the overall data it needs, and the server responds…</p><p>With nothing more and nothing less.</p><p>This is what GraphQL is, and you truly start to appreciate its beauty when you combine it with strong typing (from TypeScript) and a self-documenting schema.</p><h3>Next.js API Routes &amp; Apollo Server</h3><p>Now, for the meat and bones of this project:</p><p>Our backend (for reference sake, find the project’s GitHub repo <a href="https://github.com/codebydolapo/TinyWags">here</a>).</p><p>When it comes to backends with Next JS, there is no need to run off and create a separate microservice that lives on its own server.</p><p>This is one of the reasons why I love Next.js so much.</p><p>With Next.js API Routes, the frontend and backend can exist within the same project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFn9mRaxe5VIGTvC2uoa1g.png" /></figure><p>This means that everything from deployment to development is much simpler to pull off than if you used, say, vanilla React.</p><p>Or worse, plain HTML 💀</p><p>Back to my GraphQL implementation: You should know that the heart of GraphQL is the server.</p><p>In this case, we’re using a popular GraphQL framework called <strong>Apollo</strong>. Note that many other frameworks exist to choose from, including GraphQL Yoga and so on.</p><p>Here’s a look atapp/api/graph/route.ts, which is our GraphQL/Apollo entry point:</p><pre>// app/api/graph/route.ts<br>import { ApolloServer } from &#39;@apollo/server&#39;;<br>import { startServerAndCreateNextHandler } from &#39;@as-integrations/next&#39;;<br>import schema from &#39;@/graphql/schema&#39;;<br>import resolver from &#39;@/graphql/resolvers&#39;;<br><br><br><br>// Initialize Apollo Server with our schema and resolvers<br>const apolloServer = new ApolloServer({<br>  typeDefs: schema, // Our GraphQL schema definition<br>  resolvers: resolver, // Our logic to fetch data<br>});<br>// Create a Next.js API handler from the Apollo Server instance<br>const handler = startServerAndCreateNextHandler(apolloServer, {<br>  context: async (_req, _res) =&gt; {<br>    // This is where you&#39;d typically add context like database connections<br>    // or authentication information (e.g., Clerk user data)<br>    return {};<br>  },<br>});<br>// Export the handlers for GET and POST requests<br>export { handler as GET, handler as POST };</pre><p>This tiny file works as the gateway, of sorts. It tells Next.js:</p><p>“Hey, any requests to /api/graph should be handled by this Apollo Server instance.&quot;</p><p>In a larger app, this is where we&#39;d inject things like database connections or user authentication details so other parts of our app can access them.</p><h3>The GraphQL Schema</h3><p>Every great application starts with a clear understanding of how the data to be fetched is structured.</p><p>In GraphQL, a developer writes this understanding within the <strong>schema</strong>.</p><p>Think of a GraphQL Schema as the blueprint for all the data that can be queried or manipulated by the user or the developer doing the actual building.</p><p>If that confused you, read it again. Slowly. 🙂.</p><pre>// graphql/schema.ts<br>import { buildSchema } from &#39;graphql&#39;;<br><br><br><br>const schema = buildSchema(`#graphql<br>  type Pet {<br>    id: ID!<br>    name: String!<br>    breed: String!<br>    age: String!<br>    description: String!<br>    location: String!<br>    temperament: String!<br>    health: String!<br>    adoptionFee: Int!<br>    imageUrl: String!<br>    funFact: String!<br>    agentId: ID!<br>    agent: Agent! # This is where the magic of relationships happens!<br>    randomPets: [Pet!]! # Suggestions for more pets<br>  }<br>  type Agent{<br>    id: ID!,<br>    name: String!,<br>    phone: String!,<br>    email: String!,<br>    location: String!,<br>    petsResponsibleFor: [ID]!<br>  }<br>  type Query {<br>    pets: [Pet!]! # Get all pets<br>    pet(id: ID!): Pet # Get a single pet by ID<br>    agents: [Agent!]! # Get all agents<br>    agent(id: ID!): Agent # Get a single agent by ID<br>    petsByCategory(category: String!): [Pet!]! # Filter pets by category<br>  }<br>  # We&#39;re keeping Mutations ready for future features like adding new pets!<br>  # type Mutation { ... }<br>`);<br>export default schema;</pre><p>Here, above, is where the types for the application is defined. Alongside core types, Pet and Agent.</p><p>Notice the ! after a type (e.g., ID!, String!).</p><p>Bangs (!) after anything in a GraphQL schema mean that this “thing” in question (and I’m simplifying here) is <strong>non-nullable.</strong></p><p>Ergo, it “must” have a value.</p><p>Take [Pet!]! as an example.</p><p>This expression refers to a list of non-nullable Pet objects.</p><p>It took me a while to get the hang of it, too, but consider this:</p><p><strong>[Pet]</strong> means that you’re telling the server, <em>“One or more pets ‘might’ be part of the returned data. And this return might be empty too. Who cares?”</em></p><p><strong>[Pet!]</strong> translates to <em>“there is at least one ‘defined’ instance of a pet within the returned data”</em></p><p><strong>[Pet!]!</strong> means <em>“there is at least one ‘defined’ instance of a pet, AND the server cannot return an undefined or empty field”</em></p><p>Did you get that? Hopefully you did.</p><p>Last but not least, the Query type at the end of the code block is where we define all the ways clients can ask for data.</p><p>We already have queries for fetching all pets, for fetching a single pet by its ID and for fetching pets filtered by category… which is good enough for now.</p><p>However, this is where more complex algorithms, or even AI, could be added for extra features like computing a list of similar animals and so on.</p><p>For now, I am randomly selecting three animals for display from each category using a simple “random selector” function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQ3e-n00ixO5BNrVsZSK6w.png" /></figure><p>If you slap a little bit of machine learning on that “computed list,” you have a little something on your hands.</p><p>The whole point of it all is that the schema dictates exactly what can be asked for, and the backend has to respond according to the guidelines.</p><p>Which means that GraphQL schemas are inherently self-documenting.</p><h3>Bringing Data to Life with Resolvers</h3><p>The schema might be the blueprint. However, <strong>Resolvers</strong> are the construction crew that actually fetches the data according to the rules of the schema.</p><p>The Resolver file for our app is located in graphql/resolvers.ts and is responsible for returning the data for each field in our schema.</p><pre>// graphql/resolvers.ts<br>import petData from &#39;../data/petData&#39;; // Our mock pet data<br>import adoptionAgents from &#39;../data/adoptionAgents&#39;; // Our mock agent data<br><br><br>// Consolidated list of all pets<br>const allPets = [<br>    ...petData.dogs,<br>    ...petData.cats,<br>    ...petData.birds,<br>    ...petData.rabbits,<br>];<br>const resolvers = {<br>    Query: {<br>        // Resolver for the &#39;pets&#39; query<br>        pets: () =&gt; allPets,<br>        // Resolver for &#39;pet(id: ID!)&#39; query<br>        pet: (_: any, { id }: { id: string }) =&gt; allPets.find(pet =&gt; pet.id === id),<br>        // Resolver for &#39;agents&#39; query<br>        agents: () =&gt; adoptionAgents,<br>        // Resolver for &#39;agent(id: ID!)&#39; query<br>        agent: (_: any, { id }: { id: string }) =&gt; adoptionAgents.find(agent =&gt; agent.id === id),<br>        // Resolver for &#39;petsByCategory(category: String!)&#39; query<br>        petsByCategory: (_: any, { category }: { category: keyof typeof petData }) =&gt; {<br>            const petsForCategory = petData[category];<br>            if (!petsForCategory) {<br>                console.warn(`No data for category: ${category}`);<br>                return [];<br>            }<br>            return petsForCategory;<br>        },<br>    },<br>    // Field Resolvers: The real GraphQL magic!<br>    Pet: {<br>        // This resolver runs whenever the &#39;agent&#39; field is requested on a &#39;Pet&#39; object<br>        agent: (parent: typeof allPets[0]) =&gt; {<br>            // &#39;parent&#39; is the Pet object currently being resolved<br>            return adoptionAgents.find(agent =&gt; agent.id === parent.agentId);<br>        },<br>        // This resolver generates random pets for the &quot;Meet More Pets&quot; section<br>        randomPets: (parent: typeof allPets[0]) =&gt; {<br>            // Filter out the current pet to avoid showing it in &quot;random pets&quot;<br>            const availablePets = allPets.filter(p =&gt; p.id !== parent.id);<br>            // Simple Fisher-Yates shuffle for randomness<br>            for (let i = availablePets.length - 1; i &gt; 0; i--) {<br>                const j = Math.floor(Math.random() * (i + 1));<br>                [availablePets[i], availablePets[j]] = [availablePets[j], availablePets[i]];<br>            }<br>            // Return the first 3 random pets<br>            return availablePets.slice(0, 3);<br>        },<br>    },<br>};<br>export default resolvers;</pre><p>This is where the real work happens:</p><p>Each function in the Query object corresponds to a top-level query defined in our schema. They simply return the data you ask for.</p><p>However, GraphQL truly shines within the <strong>field resolvers</strong> (like Pet.agent and Pet.randomPets).</p><p>This concept messed with me, so allow me to explain.</p><p>Consider a query like:</p><pre>const GET_PET_BY_ID_QUERY = `#graphql<br>  query GetPetById($id: ID!) {<br>    pet(id: $id) {<br>      id<br>      name<br>      breed<br>      age<br>      description<br>      agent{<br>        id<br>        name<br>        phone<br>        email<br>        location<br>        petsResponsibleFor<br>      }<br>      randomPets{<br>        id<br>        name<br>        breed<br>        age<br>        imageUrl<br>      }<br>    }<br>  }<br>`;</pre><p>This kind of query looks like a normal kind of query. But if you look closer, you’ll notice that it also has a few “children” within it.</p><p>The query asks the backend for a particular pet, depending on its ID.</p><p>When this pet is fetched, the query also demands details of the agent responsible for the animal, alongside three other random animals (like we discussed earlier).</p><p>The resolver for this would look like:</p><pre>// graphql/resolvers.ts<br>import petData from &#39;../data/petData&#39;; // Our mock pet data<br>import adoptionAgents from &#39;../data/adoptionAgents&#39;; // Our mock agent data<br><br>// Consolidated list of all pets<br>const allPets = [<br>    ...petData.dogs,<br>    ...petData.cats,<br>    ...petData.birds,<br>    ...petData.rabbits,<br>];<br>const resolvers = {<br>    Query: {<br>        // Resolver for &#39;pet(id: ID!)&#39; query<br>        pet: (_: any, { id }: { id: string }) =&gt; allPets.find(pet =&gt; pet.id === id),<br>    },<br>    Pet: {<br>        // This resolver runs whenever the &#39;agent&#39; field is requested on a &#39;Pet&#39; object<br>        agent: (parent: typeof allPets[0]) =&gt; {<br>            // &#39;parent&#39; is the Pet object currently being resolved<br>            return adoptionAgents.find(agent =&gt; agent.id === parent.agentId);<br>        },<br>        // This resolver generates random pets for the &quot;Meet More Pets&quot; section<br>        randomPets: (parent: typeof allPets[0]) =&gt; {<br>            // Filter out the current pet to avoid showing it in &quot;random pets&quot;<br>            const availablePets = allPets.filter(p =&gt; p.id !== parent.id);<br>            // Simple Fisher-Yates shuffle for randomness<br>            for (let i = availablePets.length - 1; i &gt; 0; i--) {<br>                const j = Math.floor(Math.random() * (i + 1));<br>                [availablePets[i], availablePets[j]] = [availablePets[j], availablePets[i]];<br>            }<br>            // Return the first 3 random pets<br>            return availablePets.slice(0, 3);<br>        },<br>    },<br>};<br>export default resolvers;</pre><p>The parent argument in this resolver holds the Pet object that&#39;s currently being processed.</p><p>This means that we can pick out the agentId within the pet information, use it to search through the available agents, fetch their details and then present both results together.</p><p>In essence, the frontend doesn&#39;t even need to know <em>how</em> the agent data is linked. It just asks for pet { name agent { name email } } and the backend handles the join.</p><h3>The Current State and The Future</h3><p>At the time, TinyWags runs on <strong>in-memory mock data</strong>, which was perfect for rapid development.</p><p>This approach allowed me to build out both the frontend and GraphQL API without the headache of setting up a full database.</p><p>However, for a real-world application, this mock data would quickly be replaced by a more persistent database.</p><p>Good examples would be a <strong>PostgreSQL</strong> database using an ORM like Prisma, a <strong>MongoDB</strong> instance with Mongoose or even a <strong>Firestore database</strong>.</p><p>Who knows?</p><h3>GraphQL Queries And The Frontend</h3><p>While this article focuses on the backend, I should also mention how the frontend consumes this API.</p><p>Within the provided repo, you&#39;ll notice that thegraphql/queries.ts file holds all the client-side GraphQL query definitions.</p><pre>// graphql/queries.ts (Example)<br>const GET_PET_BY_ID_QUERY = `#graphql<br>  query GetPetById($id: ID!) {<br>    pet(id: $id) {<br>      id<br>      name<br>      breed<br>      age<br>      description<br>      location<br>      temperament<br>      health<br>      adoptionFee<br>      imageUrl<br>      funFact<br>      agent { # We ask for the agent details directly!<br>        id<br>        name<br>        phone<br>        email<br>        location<br>      }<br>      randomPets { # And related pets too!<br>        id<br>        name<br>        breed<br>        age<br>        imageUrl<br>      }<br>    }<br>  }<br>`;<br><br>export default { GET_PET_BY_ID_QUERY, /* ...other queries */ };</pre><p>The React components simply import these queries using @apollo/client, and sends them to the /api/graph endpoint.</p><p><em>Easy peasy.</em></p><h3>Lessons Learned and The Road Ahead</h3><p>Building this project’s backend with GraphQL has been an incredibly rewarding experience. I have learned concepts like:</p><ul><li><strong>Developer Ergonomics. </strong><em>Really</em><strong><em>, </em></strong><em>the type safety and self-documenting nature of GraphQL makes development a lot less error-prone.</em></li><li><strong>Frontend Flexibility. </strong><em>Frontends can scale very quickly without needing constant backend API changes.</em></li><li><strong>Performance. </strong><em>Fetching only what’s needed reduces network payload sizes.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*730a3Kt6H0BkTMLc6Ir33w.png" /></figure><p>Of course, no journey is complete without its next steps. For our app, the immediate priorities for the backend include:</p><ul><li><strong>Database Integration:</strong> <em>Moving from mock data to a persistent database.</em></li><li><strong>Authorization:</strong> <em>Implementing more robust access control within resolvers to protect sensitive operations like authentication, smart contract calls, etc</em>.</li><li><strong>Mutations:</strong> <em>Adding GraphQL mutations for submitting adoption applications, updating pet statuses or even allowing agents to manage their listings directly through the API.</em></li></ul><p>Overall, I learned a lot from building this relatively simple app.</p><p>Thanks for joining me on this backend adventure!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4501c3af89d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Concept to Click: My Journey Building Verity, a Next.js E-commerce Discovery Platform]]></title>
            <link>https://medium.com/@bashorundolapo/from-concept-to-click-my-journey-building-verity-a-next-js-e-commerce-discovery-platform-9314239248a2?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/9314239248a2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 13:51:56 GMT</pubDate>
            <atom:updated>2025-06-09T13:51:56.306Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PdDk_rEmI35JtAxgG9fc9g.png" /></figure><p>As a developer, there’s nothing quite like the satisfaction of bringing an idea to life.</p><p>That feeling was especially strong when I started building <strong>Verity</strong>, an MVP (or a Minimum Viable Product) for an e-commerce product discovery platform.</p><p>My goal was simple. I wanted to create a fast, responsive, and intuitive application that pulled information directly from Amazon:</p><p>I wanted a platform where users could browse best-selling products, search for specific items, and look into product details, all powered by real-time data.</p><p>This wasn’t just about writing code; it was about making architectural decisions, tackling common web development challenges, and learning to use Next.js, my favorite web framework even better.</p><p>And let me tell you, it was a ride worth documenting!</p><h3>Why Verity?</h3><p>Finding the <em>right</em> product can be overwhelming sometimes, with so many marketplaces available today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hbfkDHMEx5-_ZpqA1XEug.png" /></figure><p>I saw (and still see) Verity as a clean, efficient interface that cuts through the noise. Something that allows users to quickly find what they’re looking for, or simply glance through popular items.</p><p>The main idea was to build an aesthetically pleasing front-end that could consume external API data and make product discovery a breeze.</p><h3>Choosing the Right Tools: Next.js and Beyond</h3><p>For a project like this, (especially with its emphasis on performance, SEO, and developer experience), <strong>Next.js</strong> was the clear winner.</p><p>I particularly love its App Router, which is one of the most powerful tools I have ever used for its ability to structure routes, handle data, and optimize rendering.</p><p>Alongside Next.js, I opted for other technologies like:</p><ul><li><strong>TypeScript:</strong> For type safety, fewer bugs, and better code maintainability.</li><li><strong>Tailwind CSS:</strong> Which made styling very efficient and enjoyable.</li><li><strong>Lucide React:</strong> For beautiful, lightweight icons.</li><li><strong>RapidAPI:</strong> To access real-time Amazon product data (which was the lifeblood of Verity).</li></ul><h3>The Most Difficult Part: Data Fetching and Performance</h3><p>One of the biggest parts of Verity is in its ability to fetch an incredible amounts of product data.</p><p>My initial thoughts revolved around standard useEffect calls.</p><p>However, I knew that wouldn&#39;t cut it for an optimal user experience. This led me to two major decisions:</p><ol><li><strong>Centralized API Calls:</strong> I created a lib/fetchProducts.ts file to encapsulate all API interaction.</li></ol><p>This meant that I had to create reusable functions (fetchBestsellers, fetchSearchResults, fetchProductDetails) with consistent headers, error handling, and RapidAPI key management. This kept my components clean and focused on rendering.</p><p><strong>2. Client-Side Caching with </strong><strong>sessionStorage:</strong> I am particularly proud of this one, despite how many hours I spent crying over my keyboard.<br>For starters, I had a set quota for how many API calls I could make per month (which would have been highly problematic for the testing phase).</p><p>Moreover, why would users have to hit the API every single time they attempt to navigate through the pages?</p><p>To work my way around this, I implemented custom hooks (useBestsellers, useSearchResults, useProductDetails) along withsessionStorage.</p><p>Before making an API call, each hook checks if the data for that specific request (e.g., a bestseller category, a search query, or an ASIN) already exists in sessionStorage.</p><p>If it does, boom! The pages load directly from cache, instead of Verity having to make a new API request and deal with all the latency issues that come with.</p><h3>The Polish: Aesthetics and User Experience</h3><p>No matter how functional, a product discovery platform needs to look good.</p><p>Tailwind CSS made styling a breeze, allowing me to iterate quickly on the UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrnaBb3J3BuN6Mx2zm5s1g.png" /></figure><p>Everything from the ProductCard component to the cart page, as well as the product details page forced me to think outside the box, more times than I can count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IqTj7IirKKU9NO-6NGDjZQ.png" /></figure><p>Don’t even get me started with how I managed this, while dealing with the usual type errors from Typescript here and there.</p><p>I implemented a discount/free shipping meter as well, which is the yellow bar up on the top of the snapshot above.</p><p>Another interesting part of this application is the currency parsing from USD to NGN, which I implemented here and there on the live version.</p><p>Some daunting (but exciting) aspects I intend to implement at some point is real-time integration, using PayStack or FlutterWave.</p><p>I’ll just add that to the list of upgrades I have to make to other projects like Prelo, Animax and Homely.</p><p>Overall, building Verity’s MVP has been an incredibly rewarding experience.</p><p>Nobody has it all figured out, and the journey so far has solidified my understanding of Next.js best practices.</p><p>It has also reinforced the importance of performance optimization, and sharpened my ability to translate an idea into a tangible, user-friendly application.</p><p>I’m excited to continue building on this foundation and adding more features in the future!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9314239248a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to Prelo: My Journey Building a Collaborative AI-Powered Text Editor]]></title>
            <link>https://medium.com/@bashorundolapo/from-zero-to-prelo-my-journey-building-a-collaborative-ai-powered-text-editor-20215d9ec386?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/20215d9ec386</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Sat, 24 May 2025 06:17:44 GMT</pubDate>
            <atom:updated>2025-05-24T06:17:44.534Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*KlVYvgnPwZLcYVpGCh5SGg.gif" /></figure><p>The soft glow of my monitor screen has become my biggest companion over the past few weeks.</p><p>What began as a mere idea, building a real-time collaborative document editor has slowly turned into something tangible:</p><p><em>Prelo</em>.</p><p>Complete with AI-powered text summary and translation, alongside live chats to any document of your choosing.</p><p>Reflecting on the journey from that first empty codebase to my now-deployed app and I can say that it’s been a mix of headaches, breakthroughs, roadblocks and a whole lot of learning.</p><h3>Choosing the Stack: Next.js and the Spark of an Idea</h3><p>Like many projects, it all started with documentation.</p><p>Naturally, I chose to use <strong>Next.js</strong> because of its full-stack flexibility and familiarity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWPqPon79WYjmxxx_RDLkA.png" /></figure><p>Here’s what the Editor page looks like, by the way.</p><p>Setting it up was as straightforward as a quick npx create-next-app@latest, after the initial three days of pulling my hair out because of a yarn caching error that kept breaking my app.</p><p>However, I not only wanted to make this app work, I also needed it to be collaborative in real time.</p><p>This was the challenge that led me straight to <strong>Liveblocks</strong>.</p><h3>Real-Time Collaboration: The Liveblocks Learning Curve</h3><p>Liveblocks felt like the perfect fit, and I love how comprehensive its documentation was.</p><p>The tool uses <strong>CRDTs (Conflict-Free Replicated Data Types)</strong> to handle real-time editing.</p><p>Think of this as a fancy way to manage multiple users who want to edit the same document without having to deal with messy merge conflicts.</p><p>Again, the documentation of this tool was stellar and helped me get the room functionality running quickly.</p><p>The first time I saw multiple colored cursors gliding across the screen in perfect sync, it felt like magic.</p><p>The kind of moment that makes all the head-scratching worthwhile.</p><p>But of course, the magic wasn’t without a price.</p><p>Integrating Liveblocks’ <strong>Suspense-ready React hooks</strong> was more complex than I expected, as I kept running into the now-familiar &quot;You cannot use the Suspense version of Liveblocks hooks server side&quot; error.</p><p>After hours of poring through GitHub issues, the docs Stack Overflow and stressing Google’s Gemini out, the fix pointed itself out.</p><p>The &lt;ClientSideSuspense&gt; wrapper was my first real lesson in how complicated <strong>client-side rendering in Next.js</strong> can be.</p><h3>Building the Editor: BlockNote + Yjs</h3><p>For the editor itself, I needed something more powerful than a basic &lt;textarea&gt;.</p><p>This is where <strong>BlockNote </strong>came in.</p><p>Think of BlockNote as a block-based rich text editor with great extensibility.</p><p>It clicked perfectly with my vision and after hours of debugging and tutorial hell, I finally got it to work.</p><p>Integrating it with Liveblocks via <strong>Yjs</strong> came with its own challenges.</p><p>I got to understand how Yjs handled shared state and how BlockNote interfaced with it (again, thank god for Gemini).</p><p>However, once it all clicked, watching multiple users simultaneously edit a document in real time was incredibly satisfying.</p><h3>Authentication and Access Control with Clerk</h3><p>Real-time collaboration is only useful if users can securely access their documents.</p><p>To handle this, I turned to <strong>Clerk </strong>(which has an amazing Next.js SDK by the way).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Wr4h6rFYvAygwVmue1705Q.gif" /></figure><p>Clerk made handling sign-in, sign-up, and session management surprisingly smooth.</p><p>The @clerk/nextjs/server utilities helped protect server-side routes and ensured authenticated access at all times.</p><h3>Firebase for Persistence</h3><p>To persist user data and documents, I brought in <strong>Firebase </strong>with its NoSQL structure and ease of use.</p><p>I set up collections for documents and rooms, using the Firebase Admin SDK to handle operations like document deletion and role assignments, among other things.</p><p>In addition, the <strong>react-firebase-hooks</strong> library made syncing data with React components much easier, especially for managing document lists and real-time updates.</p><h3>Polishing the UI with Radix, Shadcn, and Tailwind</h3><p>Great functionality needs a clean UI.</p><p>For this, <strong>Radix UI </strong>came in handy for accessible, unstyled components, as well <strong>Shadcn UI</strong> for their styled variants.</p><p>Tailwind came in and powered it all, alongside add-ons like <strong>lucide-react</strong> (for consistent icons) and <strong>sonner</strong> (for sleek toast notifications).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GCPv-ArDX0MnjUkhcd0mg.png" /></figure><p>Just look at the pricing page!</p><p>My guy, <a href="https://www.behance.net/gallery/226298501/CAVEMAN-BASKETBALL">Gbemiro Bankole</a> played a major role in bringing most of the UI to life.</p><p>He pointed out everything from color scheme suggestions to visual heirarchy, and I should say that Prelo would’ve looked a lot less aesthetically pleasing without his input.</p><h3>Going Beyond the Basics: Translation, Chat, Roles</h3><p>As Prelo took shape, I started to layer in more complex features, and some of my favorites are my Open AI integrations.</p><p>Prelo features a document <strong>translation feature</strong>, powered by Open AI’s GPT.</p><p>Here, I generate a summary of Alice in Wonderland, and display the output in Spanish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*8oYKLHeIh5WGeAWZvJH1JQ.gif" /></figure><p>A lightweight <strong>in-document chat</strong> feature added another real-time dimension, and implementing <strong>user roles</strong> (like “editor”) demanded precise access control logic across both the frontend and backend.</p><h3>The Inevitable Debugging Phase</h3><p>No project is complete without a fair share of bugs.</p><p>I spent days, sometimes wondering if I was losing it. I had to deal with everything from errors that made no sense whatsoever, to unexpected behavior.</p><p>However, the upside of debugging is that if (more like when) you eventually get things right, the dopamine rush is unreal.</p><p>Tools like good old <strong>ESLint</strong>, <strong>Next.js dev tools</strong>, <strong>React DevTools</strong> and the <strong>Liveblocks client debugger</strong> were lifesavers in this regard.</p><p>Sometimes, a simple console.log() here and there can be the best tool in the box.</p><p>As a side note, the best approach to fixing React/Next.js-based bugs is commenting components out one by one.</p><p>Eventually, you’ll zero in on the error and stomp it out.</p><h3>Prelo as a Milestone</h3><p>Prelo isn’t just a collaborative editor — it’s a living, breathing product born from modern web technologies.</p><p>The project was stitched together through persistence, documentation, endless tutorials and more than a few late nights.</p><p>This is not to say that it is perfect.</p><p>There are still features to improve, bugs to fix, and optimizations to make. However, reaching this point has been/is something I’m genuinely proud of.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20215d9ec386" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What the Heck Is Middleware in A Node/Express.js Backend, And Why Should You Care?]]></title>
            <link>https://medium.com/@bashorundolapo/what-the-heck-is-middleware-in-a-node-express-js-backend-and-why-should-you-care-a1ba27c164e5?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ba27c164e5</guid>
            <category><![CDATA[middleware]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Thu, 15 May 2025 11:17:04 GMT</pubDate>
            <atom:updated>2025-05-15T11:17:04.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a64eySMXpP95tRpxogsAkw.jpeg" /></figure><p>I probably don’t know you, but I can still tell a few things about you.</p><ol><li>You don’t live under a rock.</li><li>This would mean that you have a mobile phone/laptop or some other device, and use it to interact with the internet.</li></ol><p>If you don’t live under a rock and have used the internet at least once in the past, you should know that every webpage you have ever visited is split into two very important parts:</p><ol><li>The frontend, which is the fancy visuals you can see on your screen.</li><li>The backend, which holds things together behind the scenes, makes everything work as it should.</li></ol><p>Backends store information, handle authentication and make sure that data is presented well enough for the frontend to interpret and display.</p><p>Most backends are built using one popular framework or the other: Flask, Laravel, Django, etc.</p><p>However, I happen to like Node/Express.js best.</p><p>And for this section, I would like to go over an interesting concept called Middleware, especially with Node/Express.js backends.</p><h3>So, What Exactly Is Middleware?</h3><p>Middleware is exactly what it sounds like: Software that sits in the middle of two points.</p><p>Think of middleware as a series of gatekeepers or checkpoints. Every time a request hits your server, it passes through as many middleware layers as you set up, before another, then another, before reaching your final route handler.</p><p>Middleware can tweak requests, change responses or even stop certain requests in their tracks before they hit the main backend.</p><p>At its core, just think of middleware as a function that sits between the raw request and your defined routes.</p><h3>Why Do We Need Middleware?</h3><p>Let’s use a house-building analogy.</p><p>Assume you wanted to build a house. To do this, you wouldn’t just slap a roof directly on a foundation.</p><p>You’d install plumbing, run electrical wiring and apply plaster to the walls.</p><p>Middleware performs the same function on any server. They break down complex request-handling into smaller, focused steps.</p><p>One middleware can act as the plumbing, another as the wiring and another as the security guard.</p><p>When set up properly, they handle tasks from logging to authentication, to authorization, error handling and even body parsing and security.</p><h3>A Simple Middleware Example</h3><p>Take a look at the code snippet down below. If you have used Node.js at some point in the past, this should look very familiar.</p><pre>const myMiddleware = (req, res, next) =&gt; {<br><br>  console.log(&quot;Request received!&quot;);<br><br>  req.customProperty = &quot;Hello from middleware!&quot;;<br><br>  next(); // Pass control to the next middleware or route<br><br>};</pre><p>Here’s what’s going on under the hood. Middleware typically takes in three parameters:</p><ul><li>req: The incoming request object.</li><li>res: The response object you&#39;ll send back to the client.</li><li>next(): This function simply moves the request to the next step in the chain, as long as it satisfies all the conditions defined in the code.</li></ul><p>The middleware defined above isn’t doing much. It simply:</p><ol><li>Logs a message (Request Received) to the console every time a request hits your server.</li><li>The <em>req.customProperty = “Hello from middleware!”</em> part adds a <strong>new custom property</strong> to the req object.</li></ol><p>This means future middleware functions or route handlers will now be able to access req.customProperty, which holds the string &quot;Hello from middleware!&quot;.</p><p>Finally, middleware can be implemented via “plug and play” into the main Express app, like so:</p><pre>const express = require(&#39;express&#39;);<br>const app = express();<br><br>app.use(myMiddleware); // This will run for every request<br><br>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  console.log(req.customProperty); // Output: Hello from middleware!<br>  res.send(&#39;Hello, world!&#39;);<br>});<br><br>app.listen(3000, () =&gt; {<br>  console.log(&#39;Server listening on port 3000&#39;);<br>});</pre><p>Does this make sense?</p><p>Express.js itself even ships with some built-in middleware of its own that you may have used, without realising it:</p><ul><li>express.json(), for example, is middleware, and it parses incoming JSON payloads.</li><li>express.urlencoded({ extended: true }) is another example, and it parses form submissions.</li><li>express.static(&#39;public&#39;)Serves static files like CSS, images, or JS.</li></ul><p>and so on…</p><h3>Wrapping Up</h3><p>With all of the above being said, Middleware is one of the most powerful features of Express.js.</p><p>They not only make good article topics that help you sound smart as heck, they also help you:</p><ul><li>Break your app logic into reusable chunks.</li><li>Cleanly manage things like auth, logging, and error handling.</li><li>Customize the flow of every request and response.</li></ul><p>However, keep in mind that the concept of middleware (or similar request/response pipelines) exists in many other web frameworks as well, even if the implementation differs.</p><p>Overall, once you understand how middleware works, you unlock a whole new level of flexibility in your web applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ba27c164e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expo, Anime And Merchandise With Animax]]></title>
            <link>https://medium.com/@bashorundolapo/expo-anime-and-merchandise-with-animax-0da07b976622?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/0da07b976622</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[anime]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Sun, 20 Apr 2025 18:19:03 GMT</pubDate>
            <atom:updated>2025-04-20T18:19:03.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TD0vgsMaeHVAsdE4V-Rfw.png" /></figure><p>Hey guys! It’s me again.</p><p>So here’s Animax, a project I spent the last month working on.</p><p>I built this using React Native, TypeScript, Redux, Appwrite and of course, Expo (because I value my sanity).</p><p>Simply put, Animax is a mobile app for watching your favorite shows and bookmarking them on a watchlist.</p><p>You can even check through the “shop” section and purchase whichever anime-themed merchandise catches your fancy.</p><p>Building Animax has been a wild ride so far, and here’s everything that went into it.</p><h3>Signing Into Animax</h3><p>For starters, signing into Animax is possible through Google Authentication, provided by AppWrite.</p><p>The sign-in screen features a lovely (but tedious to implement) slider animation as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*9Qkyrw9GqYWAIYoSGOdEhA.gif" /></figure><p>As a side note, I spent days pulling out my hair in frustration when the slider wouldn’t work as expected.</p><p>Here’s a sample component, to show you what I mean (not even I fully understand the nonsense I pulled here, hehe).</p><p>It works, and that’s what matters.</p><pre>import React, { useState, useRef, useEffect } from &#39;react&#39;;<br>import { View, ScrollView, Image, Dimensions, StyleSheet, ImageSourcePropType } from &#39;react-native&#39;;<br><br>const { width } = Dimensions.get(&#39;window&#39;);<br><br>interface data {<br>    image: ImageSourcePropType | undefined,<br>    description?: string,<br>    title?: string<br>}<br><br>interface ImageCarouselProps {<br>    images?: data[];<br>    autoPlay?: boolean;<br>    autoPlayInterval?: number;<br>}<br><br>const SignInCarousel: React.FC&lt;ImageCarouselProps&gt; = ({<br>    images,<br>    autoPlay = true,<br>    autoPlayInterval = 3000,<br>}) =&gt; {<br>    const [currentIndex, setCurrentIndex] = useState(0);<br>    const scrollViewRef = useRef&lt;ScrollView&gt;(null);<br>    const intervalRef = useRef&lt;NodeJS.Timeout | null&gt;(null);<br><br>    useEffect(() =&gt; {<br>        if (autoPlay) {<br>            intervalRef.current = setInterval(() =&gt; {<br>                const nextIndex = (currentIndex + 1) % images!.length;<br>                scrollToIndex(nextIndex);<br>            }, autoPlayInterval);<br>        }<br><br>        return () =&gt; {<br>            if (intervalRef.current) {<br>                clearInterval(intervalRef.current);<br>                intervalRef.current = null;<br>            }<br>        };<br>    }, [currentIndex, autoPlay, images?.length, autoPlayInterval]);<br><br>    const scrollToIndex = (index: number) =&gt; {<br>        scrollViewRef.current?.scrollTo({ x: index * width, animated: true });<br>        setCurrentIndex(index);<br>    };<br><br>    const handleScroll = (event: { nativeEvent: { contentOffset: { x: number } } }) =&gt; {<br>        const contentOffsetX = event.nativeEvent.contentOffset.x;<br>        const index = Math.round(contentOffsetX / width);<br>        setCurrentIndex(index);<br>    };<br><br><br>    return (<br>        &lt;View style={{ width: width, overflow: &#39;hidden&#39; }} className=&#39;h-full&#39;&gt;<br>            &lt;ScrollView<br>                ref={scrollViewRef}<br>                horizontal<br>                pagingEnabled<br>                showsHorizontalScrollIndicator={false}<br>                onScroll={handleScroll}<br>                scrollEventThrottle={200}<br>            &gt;<br>                {images?.map(({ image }, index) =&gt; (<br>                    &lt;Image key={index} source={image} className=&quot;h-full&quot; style={{ width: width, resizeMode: &#39;cover&#39; }} /&gt;<br>                ))}<br>            &lt;/ScrollView&gt;<br><br><br><br>           <br>            &lt;View className=&quot;flex-row absolute bottom-5 self-center &quot;&gt;<br>                {images?.map((_, index) =&gt; (<br>                    &lt;View<br>                        key={index}<br>                        className={`mx-1 w-2 h-2 rounded-full ${currentIndex === index ? &#39;bg-white&#39; : &#39;bg-gray-400&#39;}`}<br>                    /&gt;<br>                ))}<br>            &lt;/View&gt;<br>        &lt;/View&gt;<br>    );<br>};<br><br>export default SignInCarousel;</pre><p>Anyway, once successfully authenticated, the sign-in page leads users to the homepage, which looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*yYIJ8Z_m_m1DFcm0jnp3yg.png" /></figure><p>I know, I know… Anime can seem a lot like nothing more than horror-themed cartoons to the unfamiliar (to be honest, <em>Attack on Titan</em> was, and I was scared out of my mind on the first watch).</p><p>Anyway, back to the project.</p><p>Notice how the homepage has a “featured anime” section?</p><p>This comes in a slider as well, which users can click on to navigate to a separate page for watching the corresponding trailer.</p><p>Here’s a demonstration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*TWJn6x043Ol8lBUlVnKk7Q.gif" /></figure><h3>The Watchlist</h3><p>Curious about any particular anime? You can actually add them to your watchlist and expand details from there.</p><p>Here’s a demonstration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Ro5EaZat1icTkB4Pu0BEFg.gif" /></figure><p>Notice the description of said Anime, its genre(s), the number of episodes and an option to remove it from your watchlist, if you so choose.</p><p>You can also watch the trailer from this page, similar to the functionality on the homepage.</p><h3>Shopping At Animax</h3><p>Everyone appreciates a good Katana, anime-themed phone case, or even a t-shirt.</p><p>Alongside watching your favorite Anime, you can also navigate to the shop section as illustrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*xRVLsoV5FHfzboRqUa-dag.png" /></figure><p>Click on any item that catches your fancy to expand its details, and maybe add to your cart as illustrated again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Okvi-CT-OPcui9X4k0JqMQ.gif" /></figure><h3>Paying For Things</h3><p>Assume you find several things you’d like from the shop. Or maybe it’s one thing, and you want several units.</p><p>How do you pay on Animax?</p><p>Here’s a demonstration of the payment workflow. Let’s buy a nice “Bankai!” t-shirt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*w94aUpq5j9____OdUySsEg.gif" /></figure><p>Notice the pretty little animation that pops up after clicking the pay button?</p><p>This animation was implemented using Lottie animations, and a little bit of tweaking from React Native’s Animate feature.</p><p>And if there’s nothing in your cart yet, this animation is displayed to inform you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*5ntYCEefha_xncecLTa6-w.gif" /></figure><h3>The Bottom Line</h3><p>Anyway, that’s where a month’s worth of my free time went (I barely get any), and I’m pretty proud of what Animax has become.</p><p>The whole thing runs on a pretty basic API system that I had to build from scratch, with the images being placeholders sourced from the internet.</p><p>I tried to use something pre-made from Rapid API, but that resource has seriously deficient APIs (at least where anime is concerned).</p><p>Possible improvements I might ad in the future would involve more robust streaming capabilities, as well as better playback controls.</p><p>There might also be some AI additions (on the off chance that i acquire said skills or find someone who does) for much better recommendations, based on viewing history.</p><p>The Anime-download feature also needs some work for offline viewing.</p><p>Finally, I would LOVE a forum where anime enthusiasts can gather and talk about their favorite shows.</p><p>In fact, this forum feature is something I just might get to work doing, as soon as I get some well-deserved rest.</p><p>As always, see you next time home-boys and home-girls!</p><p>Keep building, and stay awesome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0da07b976622" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Movo, A Social Media App With React Native/Expo And Supabase]]></title>
            <link>https://medium.com/@bashorundolapo/building-movo-a-social-media-app-with-react-native-expo-and-supabase-ca18bad57ec7?source=rss-f8807e7c7e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca18bad57ec7</guid>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Bashorun Dolapo]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 09:56:14 GMT</pubDate>
            <atom:updated>2025-03-10T09:56:14.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mh_BdL3-KPTyTtX2DpIwhQ.png" /></figure><p>I should start by saying that building the backend of this app was an absolute horror story.</p><p>This is despite my using a no-code tool like Supabase and not having to write any SQL or schemas.</p><p>The front-end, however, was a breeze and was relatively easy to implement (remind me to use premade APIs for everything aside from authentication in the future).</p><p>Let’s examine everything that went into building Movo, the project I spent the last month testing my own sanity on.</p><h3>The Welcome Page</h3><p>This page is/was relatively simple to implement, and I think designing welcome pages is my specialty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*g-OPJPCtTQHjC4XJy8fZ3w.png" /></figure><p>I’m especially proud of this one because while the picture above shows a static welcome page, the “image” at the top is actually animated.</p><p>I implemented this with Lottie animations, and here’s what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Eo_do2JDLxwLiorQNwqasQ.gif" /></figure><p>You click on the “Sign-In Here” button, which takes you to the sign-in page. You can also a access the sign-up page from there, as illustrated above.</p><p>This is what both pages look like, side by side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Vh5bwY5gEhC8UpjBQCRmQ.png" /></figure><h3>The Home/Explore/Profile Section</h3><p>The first thing you might notice about these three tabs is their similarities with Twitter and Instagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mh_BdL3-KPTyTtX2DpIwhQ.png" /></figure><p>Being designer and builder at the same time is no easy task, and I simply copied design elements from these multi-billion dollar companies (which have well-paid designers, BTW).</p><p>The “Explore” and “Profile” pages were mostly from Instagram, while the home page was from Twitter.</p><p>Notice how the profile tab icon is also the user’s profile picture (Instagram “ate” on that one).</p><p>I used a tab navigation style from Expo router (which I have noticed that many modern apps now use these days).</p><h3>Adding New Posts</h3><p>Notice how at the top of the homepage, there’s a small pencil icon?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*NtnJRHH1LoyQNc1JICEMXg.jpeg" /></figure><p>That icon leads to another page, which allows a logged-in user to upload a new post. Here’s what the page looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*ucxlU9PB2USvweeiXSl1dw.png" /></figure><p>I Implemented the text input section using a library called “<a href="https://www.npmjs.com/package/react-native-pell-rich-editor">React Native Rich Text Editor</a>”.</p><p>This library features a text input with full markup. Header tags, hyperlinks and whatnot.</p><p>You can even change the color of your text, make it bolder, italicize things and create lists to mention a few.</p><p>After typing your message you can click on any one of the icons underneath, to select an image or video for upload as illustrated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*q1b-1P6SImPeO-Mh_4Lp5g.gif" /></figure><p>Once done/satisfied, click “Post” and off your message goes.</p><h3>Authentication</h3><p>The authentication on Movo was relatively simple to implement, with supabase doing most of the heavy lifting.</p><p>You simply start by creating a supabase client like so:</p><pre>import { AppState } from &#39;react-native&#39;<br>import &#39;react-native-url-polyfill/auto&#39;<br>import AsyncStorage from &#39;@react-native-async-storage/async-storage&#39;<br>import { createClient } from &#39;@supabase/supabase-js&#39;<br>import supabaseUrl from &#39;@/constants/supabaseUrl&#39;<br><br><br><br>export const supabase = createClient(supabaseUrl, anonKey, {<br>  auth: {<br>    storage: AsyncStorage,<br>    autoRefreshToken: true,<br>    persistSession: true,<br>    detectSessionInUrl: false,<br>  },<br>})<br><br><br>AppState.addEventListener(&#39;change&#39;, (state) =&gt; {<br>  if (state === &#39;active&#39;) {<br>    supabase.auth.startAutoRefresh()<br>  } else {<br>    supabase.auth.stopAutoRefresh()<br>  }<br>})</pre><p>In the code snippet above, a “supabase” constant is initialized with the createClient function.</p><p>This function takes in your supabaseUrl, anonKey and an object containing your auth credentials as arguments.</p><p>You then proceed to import this “supabase” constant anywhere within the app, and use it to perform whatever function you might need it to.</p><p>For example, logging a user in only takes these few lines of code:</p><pre> const signInWithEmail = async () =&gt; {<br>        if (!validateInputs()) return;<br><br>        setLoading(true);<br><br>        const { error } = await supabase.auth.signInWithPassword({<br>            email: email.trim(),<br>            password: password.trim(),<br>        });<br><br>        setLoading(false);<br><br>        if (error) {<br>            Alert.alert(&#39;Error&#39;, error.message);<br>        } else {<br>            Alert.alert(&#39;Success&#39;, &#39;You are now logged in.&#39;);<br>        }<br>    };</pre><h3>Profile And Editing Your Information</h3><p>On creating an account from the Sign-up page, a user’s profile starts out being blank.</p><p>A name and email only—no bio, posts or profile picture.</p><p>This is where editing your profile comes in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*8UCqF9lFLHjbW6rfoSwfUA.png" /></figure><p>Notice the small pencil icon right underneath the profile picture? Clicking that leads to the “Edit Profile” section, which looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*5iHtb-kcDUmkK5rtB1fu0g.png" /></figure><p>This page contains my information, pre-filled with data that Supabase already has on me, as regards Movo.</p><p>Notice how the email section is unfilled yet?</p><p>The small camera icon underneath the profile picture performs the same function as the pencil icon on the profile section.</p><p>Click that, and it allows you to update your profile picture directly from your gallery.</p><p>I should mention that the Image picking feature comes from a nifty little expo library called “Expo Image Picker”</p><h3>Viewing Individual Posts</h3><p>Remember how I said I stole a few design elements from Twitter? Well, it goes even deeper than that.</p><p>Because clicking any individual post opens up a modal that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*A0Cj2YPcCVPum_2IcUZjpg.png" /></figure><p>Here’s what the full flow of opening a post feels like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*jHOE3q2tZAOfEhBrt6QKpA.gif" /></figure><h3>The Bottom Line</h3><p>Overall, as much as I struggled with the backend of Movo, I think that things would’ve been much worse if I had written the code for the entire thing (instead of using supabase).</p><p>I learned a lot more about user authentication on React Native though, especially with how different it is compared to web-based applications.</p><p>I especially liked the Expo-Video and Expo Rich Text Editor libraries and will consider implementing them in future applications.</p><p>I have a lot more to work on with Movo in terms of upgrades, improvements and whatnot.</p><p>However, I am pretty proud of what I’ve built so far, and am excited about what more goodies the future has in store for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca18bad57ec7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>