<?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 Geoffrey Rekier on Medium]]></title>
        <description><![CDATA[Stories by Geoffrey Rekier on Medium]]></description>
        <link>https://medium.com/@geoffreyrekier?source=rss-58b894aa53f0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pJ5PhwKvZDBjHAimBHzgOg.jpeg</url>
            <title>Stories by Geoffrey Rekier on Medium</title>
            <link>https://medium.com/@geoffreyrekier?source=rss-58b894aa53f0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:11:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@geoffreyrekier/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[No More Magic: The Explicit Kotlin Stack]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/no-more-magic-the-explicit-kotlin-stack-d88ca63acb25?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/2600/1*MCJQpO9ByzQwsiTHjhTS7A.png" width="3000"></a></p><p class="medium-feed-snippet">What an afternoon lost to four lines of code taught me about Ktor, Koin and Exposed</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/no-more-magic-the-explicit-kotlin-stack-d88ca63acb25?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/no-more-magic-the-explicit-kotlin-stack-d88ca63acb25?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d88ca63acb25</guid>
            <category><![CDATA[koin]]></category>
            <category><![CDATA[exposed]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[ktor]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 11:53:53 GMT</pubDate>
            <atom:updated>2026-09-14T11:53:53.236Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Diving into Kotlin Multiplatform: A Truly Shared Future]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/diving-into-kotlin-multiplatform-a-truly-shared-future-30e24a6fd458?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/600/1*2QMe0rnuje57Vh2ZXOsWwg.jpeg" width="600"></a></p><p class="medium-feed-snippet">Kotlin Multiplatform (KMP) is rapidly changing the way we think about cross-platform development. Imagine writing your core logic once and&#x2026;</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/diving-into-kotlin-multiplatform-a-truly-shared-future-30e24a6fd458?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/diving-into-kotlin-multiplatform-a-truly-shared-future-30e24a6fd458?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/30e24a6fd458</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[kmp]]></category>
            <category><![CDATA[kotlin-multiplatform]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Fri, 31 Jan 2025 15:14:09 GMT</pubDate>
            <atom:updated>2025-01-31T15:14:09.219Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Is JetBrains taking over the development world?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/is-jetbrains-taking-over-the-development-world-5058e8393c28?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/2240/1*dkLYdQYeDuUVbUCtV-K1rQ.png" width="2240"></a></p><p class="medium-feed-snippet">Presentation of some of the releases that are coming from JetBrains and show that you could work quite efficiently towards any platform</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/is-jetbrains-taking-over-the-development-world-5058e8393c28?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/is-jetbrains-taking-over-the-development-world-5058e8393c28?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5058e8393c28</guid>
            <category><![CDATA[kotlin-multiplatform]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[discussion]]></category>
            <category><![CDATA[jetbrains]]></category>
            <category><![CDATA[ktor]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 17:14:35 GMT</pubDate>
            <atom:updated>2024-11-19T17:14:35.049Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Exploring the Power of Next.js 15: New Features and Advantages]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/exploring-the-power-of-next-js-15-new-features-and-advantages-ef97b21bd4a3?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/2240/1*mDrfdOq-i6HXh67Cn-Ak3w.png" width="2240"></a></p><p class="medium-feed-snippet">The release of Next.js 15 marks a significant milestone for developers using the popular React-based framework to create highly performant&#x2026;</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/exploring-the-power-of-next-js-15-new-features-and-advantages-ef97b21bd4a3?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/exploring-the-power-of-next-js-15-new-features-and-advantages-ef97b21bd4a3?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef97b21bd4a3</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[nextjs-15]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Tue, 05 Nov 2024 12:55:15 GMT</pubDate>
            <atom:updated>2024-11-05T12:55:15.179Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Accelerate Your Development: A Guide to NextJS and Supabase]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/accelerate-your-development-a-guide-to-nextjs-and-supabase-96643fa7d30f?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/1792/1*2FNnLkiVy9mpdY6WN3KjSw.png" width="1792"></a></p><p class="medium-feed-snippet">Next.js and Supabase stand out as transformative tools for developers keen on rapidly building scalable, performance-driven web&#x2026;</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/accelerate-your-development-a-guide-to-nextjs-and-supabase-96643fa7d30f?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/accelerate-your-development-a-guide-to-nextjs-and-supabase-96643fa7d30f?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/96643fa7d30f</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[setup-supabase]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 07:41:57 GMT</pubDate>
            <atom:updated>2024-04-08T07:41:57.752Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Develop a scalable chat app in a week-end]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/develop-a-scalable-chat-app-in-a-week-end-5dcc6df2c5a7?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/2240/1*AP1uHnDOd7L1SkLc3ytDOQ.jpeg" width="2240"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/develop-a-scalable-chat-app-in-a-week-end-5dcc6df2c5a7?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/develop-a-scalable-chat-app-in-a-week-end-5dcc6df2c5a7?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dcc6df2c5a7</guid>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[auth]]></category>
            <category><![CDATA[chat]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Sat, 06 Apr 2024 15:08:32 GMT</pubDate>
            <atom:updated>2024-04-06T15:08:32.985Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[New web page with Sitejet Builder]]></title>
            <link>https://geoffreyrekier.medium.com/new-web-page-with-sitejet-builder-6e5a04b9fe11?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e5a04b9fe11</guid>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[htaccess]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[cpanel]]></category>
            <category><![CDATA[sitejet-builder]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Thu, 28 Mar 2024 09:27:17 GMT</pubDate>
            <atom:updated>2024-03-28T09:27:17.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_BtMTa-6NqqjiZcszSN-g.jpeg" /></figure><p>Here is a short list of my recommendations when starting with Sitejet Builder on cPanel as well as the issues I have faced and how to fix them.</p><p>Note that cPanel and Sitejet team are working hard to improve the experience so some items below might be fixed when you read this post.</p><h3>First steps</h3><p>Starting up with Sitejet builder in cPanel is quite easy and straightforward. Assuming that you have access to the feature, you will have a new menu item where you can see your available domains and you can create a new web page with Sitejet from them.</p><p>If you have an existing site on the domain, you might not be able to use Sitejet or the old one would be overwritten on deployment. I do know that there are lot of changes ongoing around deployments so it probably will change very soon. Expect a backup before deployment any days now.</p><p>Now, after starting your new web site with Sitejet, you will need to select a template. Everything can be changed afterwards but the closer to what you want the template is, the easier it will be to get everything in place later.</p><h3>Initial setup</h3><p>Sitejet provides a lot of magic out of the box but, to make it work, you should update the website settings and data (that you can find under “More” on the top right corner). A lot of the magic is based on data that are there.</p><p>Also, when adding a new logo, you will get a popup that asks if you want to change some color in your scheme. If you want to, you need to click on the color box in the popup to actually make the changes!</p><p>I would also recommend getting the SEO done and decide early if you want multilingual. Multilingual will add the language chosen in the URL right after the hostname.</p><h3>Why do this now?</h3><p>I have seen that some of the magic doesn’t work if you change those after your first deployment. Some places where the address is not updated if you already have deployed it once for example.</p><h3>Issues</h3><p>All the issues I will now mentioned are solely for the Builder version on cPanel. There might be some similar issues with Plesk but they do not exist on Sitejet Studio.</p><h3>robots.txt</h3><p>In Sitejet, there is no way to add a robots.txt correctly but, on the Studio side, there is the possibility to create a redirect from a file you add in your files. This option is not available in the builder version.</p><p>You might think that you can add a robots.txt to your root directory yourself and would be correct but it will be deleted each time you redeploy your site from the Sitejet editor. The only files that is not deleted is .<em>htaccess</em></p><p>I found that the easiest solution, for now, is to create a redirect to another (sub)domain I owned. Assuming that you want to deploy to example.com, you could create aa subdomain <a href="https://static.example.com/">static.example.com</a> and have your robots.txt there. Then add the following rule to <em>.htaccess</em></p><p>RewriteRule ^robots\.txt$ https://static.example.com/robots.txt [L]</p><p>This is not optimal but the closest I could find for now.</p><h3>Redirect to trailing slash URLs</h3><p>By default, Apache and Litespeed (which are the 2 available web servers on cPanel) will redirect to a URL with trailing slash when mapping to a directory on the file system. Sitejet creates the site with all links without the trailing slash. This includes all the links in your pages but also the sitemap.xml it creates. This is bad for SEO.</p><p>I was directed to the possibility to add the <em>DirectorySlash off</em> directivewith apache but Litespeed will ignore it so it wasn’t a viable solution. What I did (again) was to work with my <em>.htaccess</em> and added the following redirects:</p><p>RewriteCond %{REQUEST_FILENAME} -d<br>RewriteCond %{REQUEST_URI} !/$<br>RewriteCond %{REQUEST_FILENAME}/index.html -f<br>RewriteRule (.*) $1/index.html [L]</p><p>This works both on Apache and Litespeed and you now have a match between sitemap, links on your site and actual URLs.</p><h3>Wrong URLs in meta tags</h3><p>Some meta tags are keeping the sitejet.io preview domain after deployment. These are:</p><ul><li>canonical</li><li>og:url</li><li>hreflang (for blog post RSS feed) — which actually doesn’t work with your domain URL</li></ul><p>I have updated those manually in the beginning but it was not aa sustainable way to do it when we get many pages. So now I run 2 commands:</p><p>find . -name index.html | xargs perl -pi -e &#39;s/&lt;link rel=&quot;alternate&quot; hreflang.*&quot;\/&gt;//g&#39; to delete the RSS</p><p>then find . -name index.html | xargs perl -pi -e &#39;s/your-preview-id.preview.sitehub.io/example.com/g&#39; to update the other 2. From this command you will need to update your preview id and your domain.</p><h3>Final word</h3><p>Those are the cases I have come across and there probably are others, you can contact me if you find new ones.</p><p>Also a big thanks to cPanel and Sitejet support that both helped me figure out some of the workarounds and sent the “bugs” to the development teams for fixing in (hopefully) the near future.</p><p>And thanks to you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e5a04b9fe11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working on legacy IT systems — AgilXP]]></title>
            <link>https://geoffreyrekier.medium.com/working-on-legacy-it-systems-agilxp-1d9ed18a940b?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d9ed18a940b</guid>
            <category><![CDATA[it]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[legacy]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 00:00:19 GMT</pubDate>
            <atom:updated>2024-03-23T12:57:34.678Z</atom:updated>
            <content:encoded><![CDATA[<h3>Working on legacy IT systems — AgilXP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YADZtNM2UghJensu" /></figure><h3>Introduction</h3><p>Oftentimes, companies budget their software development as a project. Meaning that they fund a team to create a software to do one or multiple tasks. At the end of the development phase, the team is scaled down. Not a problem in itself but the issue comes often from maintenance. Those projects often don’t get the funds and allocated time needed to be properly patched over time.</p><p>I have been consulting with multiple companies where this have been the case and where managers expect me (as an expert) to update, upgrade and/or patch their software as if it was as simple as installing a new version of Excel or running windows update on their laptops. A couple of commands and it should be good to go…</p><p>Well… My dear managers, if that was so simple, why do you need people like me? And the answer is, usually, for covering themselves. Note that I don’t mean it in a pejorative way. I go to specialists/mechanics to fix my car even when I believe it is quite simple. The challenge is when, even if looks simple at the beginning, something goes wrong. And with older softwares, you would never know.</p><p>So here are some of my experiences I wanted to share.</p><h3>Google doesn’t know much about it</h3><p>In my years working on legacy systems, I think the hardest issue I had to work around was when a library was so old (and dead for so long) that there was basically no hits when trying to search the web. Here. I’m talking about an archived Apache product that lived for 1 year almost 20 years ago. The documentation is scarce and there are no StackOverflow questions about it in the index. The only things you might find are old mail-group threads.</p><p>The most important thing to remember here: <strong>Don’t panic</strong></p><p>Even if you can’t find much, chances are it is because there isn’t much to find. Those old libraries are usually quite simple and very focused on one job. Also, you do have some codebase internally you can check and, if you are lucky, some information about the person(s) that worked on it earlier.</p><p>It will take time to get started but, usually, you should get a good grip on it quite fast.</p><h3>The non-existant funding or the “it is easy and should go fast”</h3><p>When consulting, you usually get managers from your customer so you always want to be amenable to help your client. However, you should not go to far even when you meet cases where the manager says it is easy and/or we don’t have budget for it so it needs to get done within an unreasonable timeframe.</p><p>Remember that, in many cases, the direct manager you are talking to, just get a budget and have no say in it. Also, keep in mind that, even when frustration takes over, most people do want what is best.</p><p>The solution I found works best (for both cases) is to actually list everything that needs to be done with a list of risks if it is not. That being said, it might also sound easier than it is. Some cases are but others not and are full of surprises.</p><p>As an example, our team at a customer developed around 180 libraries and applications over the years. Most of them are noe in use any more but we still run around 30 applications and maintain around 10 libraries most of them in Java. Some times back, there were a security issue known as log4shell that could potentially give full access to the customer servers to a hacker. A fix was released and we “just” needed to upgrade a library. In itself, it was an easy fix except that we had 20 apps and 3 libraries where we needed to do a quick upgrade.</p><p>The customers did not allow overtime but the security team required a fix by a end of day or would shut down the applications not upgraded. Managers said it was a quite simple update so it should go fast and 2 persons working a day on it should be able to fix it all. And it would seem reasonable to most, except that, even with CI/CD, the release processes are taking time. Take one of the library, you need to</p><ol><li>create an issue ticket</li><li>branch the repo</li><li>change the code</li><li>test the change than push the code</li><li>build and approved through the CI/CD</li><li>create a PR and get someone to review it</li><li>merge the PR, re-build again</li><li>release a new version</li><li>create a new issue ticket for each app using the library</li><li>go through 2 to 6 for each app</li><li>close all issues</li></ol><p>Also, since the all Java development teams had to work on the same issue at the same time, the build agent requests were often queue for some time.</p><p>This meant that we realized quite quickly that we couldn’t make it by end of working day so we made the list to our manager: “Here is what we need to do. We did it for those already and it took so long. So we either get shut down by the security team or work overtime.” As some systems were critical and others not, we quickly reached an agreement on which one we needed to fix by end of day and which we could work on the next.</p><p>My point being that people will always try to work towards what is best and it could have easily gone very wrong if any one person was not able and willing to set aside frustration and work toward a solution. It would have been easy to think that, since the policy on no-overtime is in place, we just do our best and drop it at end of working day. So my tip is that, if you see any problems or challenges coming your way, discuss it as soon as possible with everyone involved.</p><h3>The upgrade that keeps on giving</h3><p>The next one is an example of something even you as the developer in charge of the upgrade, you think it will be easy, simple and quick but you hit a wall that changes the whole thing.</p><p>To give an example, I’ve worked on a project where they need to upgrade from Java 7 to Java 8 as 7 was EOL and it was a company policy that nothing EOL can run in production. We all thought this would be a simple upgrade as Java is usually good with backward compatibility.</p><p>Simple enough we thought but, since we had some experience in the team, we didn’t say so before we actually checked. And that was a good idea, the application was running an old (Spring) library that checked if it was running the required java version and the check was not “check if the version is greater” but, check if it is “part of the allowed list”.</p><p>This meant that we needed to do a major upgrade Spring framework as well. A quick check quickly made us aware that we also needed to upgrade the major version of Hibernate. That also caused a requirement to update an open source test library that was dead for too many years so we created a new fork of it and upgraded it to the more recent Hibernate version. Also many Spring components needed an upgrade. The whole thing ending up in a month long upgrade.</p><p>My tip here is, <strong>ALWAYS</strong> check before saying that it is a simple quick one. You’ll never know what can happen.</p><h3>The system replacement coming soon</h3><p>Many times, I’ve come across decision made at high level that one legacy system is too old and isn’t worth upgrading and we need something brand new. It will be ready in X weeks (or month) so we just do a strict minimum maintenance on the old one. Quick and dirty fix only!</p><p>And, 5 years later, you are looking at fixing the earlier quick fixes that are making no sense whatsoever nowadays…</p><p>Here are multiple suggestions:</p><ol><li>There is nothing wrong with a quick fix but isolate them to what I would call leaf code and comment it to say so. Most of the issues I’ve seen of bug whack-a-mole is where you implement a quick fix in a code that is re-used multiple places and the fix breaks something else.</li><li>Quick fix is not exclusive of refactoring. Usually it is hard to do some refactoring when going extremely fast for a quick fix but, in more complex bug, it might still be worth it. The difficulty here is that it is really hard to see on the first try. However, if you need to go back fixing the same bug multiple times, it probably is worth it.</li><li>Letting an application die, doesn’t mean you can’t do any well timed and placed major improvements. Sometimes, you get a CTO (or other high level management) making a decision and, looking a their budget sheets, it makes sense to spend as little as possible on the one you want to let die and replace. However, in some cases, those are very long projects and, as a lowly consultant, you know that you will spend more time and get more frustrated trying to fix old code coming than actually do a total overhaul and fix bugs way faster after. Here, I’d say that sometimes, it is worth going against the current but be careful! A miscalculated bet here would probably result in you being shown the door.</li></ol><h3>Conclusion</h3><p>Working on legacy softwares is not always easy and can quickly get very scary. Don’t panic, keep your head steady on your shoulder and things will work themselves out most of the time.</p><p>Remember that, as a rule, most people in the company are there to make the company work better (even if you sometimes think they don’t). Talk to people, be reasonable, precise and have a sensible argumentation when you have a strong opinion of what or how to do something.</p><p>Always remember that time and money is limited so there are always hard choices to make even if those are ones you don’t like. You might want to remind your manager that short term saving will result in more long term costs but you also need to remember that current cash flow still might allow anything else. Make your case but accept that you don’t always see the big picture.</p><p><em>Originally published at </em><a href="http://agilxp.no/blogg/working-on-legacy-software"><em>https://agilxp.no</em></a><em> on March 23, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d9ed18a940b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RUNNING PUPPETEER ON VERCEL]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://geoffreyrekier.medium.com/running-puppeteer-on-vercel-91f2f2a8deb6?source=rss-58b894aa53f0------2"><img src="https://cdn-images-1.medium.com/max/2240/1*TK8jH9uplLFtxL5lZmqYAw.jpeg" width="2240"></a></p><p class="medium-feed-snippet">Or a possible solution on how to run Chromium in a serverless environment.</p><p class="medium-feed-link"><a href="https://geoffreyrekier.medium.com/running-puppeteer-on-vercel-91f2f2a8deb6?source=rss-58b894aa53f0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://geoffreyrekier.medium.com/running-puppeteer-on-vercel-91f2f2a8deb6?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/91f2f2a8deb6</guid>
            <category><![CDATA[chromium]]></category>
            <category><![CDATA[vercel]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[puppeteer]]></category>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Wed, 06 Dec 2023 14:30:09 GMT</pubDate>
            <atom:updated>2023-12-06T14:30:09.818Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to create a dark mode toggle in React — AgilXP]]></title>
            <link>https://geoffreyrekier.medium.com/how-to-create-a-dark-mode-toggle-in-react-agilxp-1e8c6f99322f?source=rss-58b894aa53f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e8c6f99322f</guid>
            <dc:creator><![CDATA[Geoffrey Rekier]]></dc:creator>
            <pubDate>Mon, 27 Nov 2023 00:00:16 GMT</pubDate>
            <atom:updated>2023-11-27T10:15:26.787Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to create a dark mode toggle in React — AgilXP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I8_g_iE_BAF4jkjG" /></figure><p>I have seen countless number of times the question about how to toggle dark mode in React or NextJS when using Tailwind so, instead of answering the question every time, I though that it would be better to have a reference here to point to. So here we go!</p><h3>What are React, NextJS and tailwind?</h3><p>To get a bit of context for those who don’t know one of those:</p><ul><li><strong>React</strong> is a javascript frontend library that allow developers to create reusable components. This mean that you can define a unit that you can reuse in the rest of your code. For example, you can create a button with some specific action and design that you call MyFancyButton and can use this name as any other HTML tag in other part of your application.</li><li><strong>NextJS</strong> is a framework based on top of React for building full stack web application. Meaning that, you basically use React for the interface and NextJS provides extra functionality and tooling for, amongst other things, bundling, compiling, routing, server side rendering, optimizations, and more…</li><li><strong>Tailwind</strong> is a CSS framework that contains hundreds of predefined classes that you can mix and match to create beautiful UI and will analyse your code to ship only the CSS you use.</li></ul><h3>How does dark mode work with tailwind?</h3><p>Tailwind will allow developer to add classes with the prefix dark: which will allow different style in dark mode. For instance</p><pre>&lt;div class=&quot;bg-white dark:bg-black&quot;&gt;<br>  &lt;span class=&quot;dark:text-white&quot;&gt;Hello World!&lt;/span&gt;<br>&lt;/div&gt;</pre><p>will create a div that will change background color and the span will change text color when switching between light and dark mode.</p><p>By default, Tailwind will use the prefers-color-scheme CSS media query to verify what the settings should be.</p><h3>Nice! But I want to set the mode manually. How?</h3><p>As the article title would suggest, we want to be able to propose to the user to change the code. This mean being able to switch between dark mode without changing the computer settings. Luckily, Tailwind provides an alternative way to check for dark mode (than CSS media query). You can tell Tailwind to use a class name instead by changing the configuration in tailwind.config.js and add</p><pre>/** @type {import(&#39;tailwindcss&#39;).Config} */ <br>module.exports = { <br>  // ... <br>  darkMode: &#39;class&#39;, <br>  // ... <br>}</pre><p>Now Tailwind will assume that every DOM children of a tag with a class name dark is in dark mode. So all you have to program, is a way to remove or add this class.</p><h3>Just add a class name?</h3><p>Yes. That is all there is to it to toggle between light and dark mode. If you just want your users to choose between light and dark, you can add a radio button group or a drop down to switch between the 2 and save a settings to local storage or a cookie and read from it when loading a page. A simple example could look like:</p><pre>// On page load or when changing themes<br>if (localStorage.theme === &#39;dark&#39;) {<br>  document.documentElement.classList.add(&#39;dark&#39;)<br>} else {<br>  document.documentElement.classList.remove(&#39;dark&#39;)<br>}<br><br>// Whenever the user explicitly chooses light mode<br>localStorage.theme = &#39;light&#39;<br><br>// Whenever the user explicitly chooses dark mode<br>localStorage.theme = &#39;dark&#39;But you might also want to take the system settings into account. And, if so, you probably might want to change the class when time goes by and the system switches to dark mode at night.</pre><h3>I want it all, can you give me a code example?</h3><p>Sure. Here is what I think we need:</p><p>Both functions must take into account changes in both the system setting and local storage. Here is how I think it could look like:</p><pre>// Update based on changes from the user <br>const updateMode = () =&gt; { <br>  // check if the setting already exists in localstorage or not <br>  if (!(&#39;theme&#39; in localStorage)) { <br>    // if not, check if we can get it from the media query <br>    const mql = window.matchMedia(&#39;(prefers-color-scheme: dark)&#39;) <br>    if (mql.matches) { <br>      document.documentElement.classList.add(&#39;dark&#39;) <br>    } else { <br>      document.documentElement.classList.remove(&#39;dark&#39;) <br>    } <br>  } else { <br>    // if the setting exist in local storage, use it <br>    if (localStorage.theme === &#39;dark&#39;) { <br>      document.documentElement.classList.add(&#39;dark&#39;) <br>    } else { <br>      document.documentElement.classList.remove(&#39;dark&#39;) <br>    } <br>  } <br>} <br><br>// Add listener <br>const addChangeModeListener = () =&gt; { <br>  const mql = window.matchMedia(&#39;(prefers-color-scheme: dark)&#39;) <br>  mql.addEventListener(&#39;change&#39;, () =&gt; { <br>    // dark mode if local storage has the setting or not in local storage and media query matches <br>    if (localStorage.theme === &#39;dark&#39; || (!(&#39;theme&#39; in localStorage) &amp;&amp; mql.matches)) { <br>      document.documentElement.classList.add(&#39;dark&#39;) <br>    } else { <br>      document.documentElement.classList.remove(&#39;dark&#39;) <br>    } <br>  }) <br>} <br><br>// In a React Component, you might want to call those 2 like so <br>useEffect(() =&gt; { <br>  addChangeModeListener() <br>  updateMode() <br>}, []) <br>// Lastly, you need to call the changeMode when you want to change <br>// Change the local storage <br>const changeMode = (value: string) =&gt; { <br>  if (value === &#39;system&#39;) { <br>    localStorage.removeItem(&#39;theme&#39;) <br>  } else { <br>    localStorage.theme = value <br>  } <br>  updateMode() <br>} <br><br>// buttons to call the function <br>return ( <br>  &lt;&gt; <br>    &lt;button onClick={() =&gt; changeMode(&#39;light&#39;)}&gt;Light&lt;/button&gt;<br>    &lt;button onClick={() =&gt; changeMode(&#39;dark&#39;)}&gt;Dark&lt;/button&gt;<br>    &lt;button onClick={() =&gt; changeMode(&#39;system&#39;)}&gt;System&lt;/button&gt;<br>  &lt;/&gt; <br>)</pre><p>Here I show it with 3 buttons, but it can be radio, dropdown change, etc…</p><h3>I just want a component I can use</h3><p>If you really want to get something going without any more work, you can have a look at <a href="https://github.com/Agilxp/DarkModeToggle">https://github.com/Agilxp/DarkModeToggle</a> which is where the code shown here resides. You can use it as a component directly as well with yarn add @agilxp/dark-mode-toggle or npm. Installation instruction on the page.</p><p>In addition to the code in this post, it will cope with some Server Side rendering issue like missing window and will retry.</p><p>Work is still in progress and improvements will come but, for now, it uses Tailwind for some design and you can only customize the icon that is shown. Default is a sun for light mode and a moon for dark mode (and a computer for system).</p><p>You can see it at work at <a href="https://agilxp.github.io/DarkModeToggle">https://agilxp.github.io/DarkModeToggle</a>. Let me know if you have issues with it or just if you like it.</p><p><em>Originally published at </em><a href="https://agilxp.no/blogg/react-dark-mode-toggle-with-tailwind"><em>https://agilxp.no</em></a><em> on November 27, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e8c6f99322f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>