<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: James O'Halloran</title>
    <description>The latest articles on DEV Community by James O'Halloran (@jamespohalloran).</description>
    <link>https://dev.to/jamespohalloran</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F254842%2F1854d76a-2f59-4cfe-a4b2-22d0c0d1b6af.png</url>
      <title>DEV Community: James O'Halloran</title>
      <link>https://dev.to/jamespohalloran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jamespohalloran"/>
    <language>en</language>
    <item>
      <title>Validating your site's links in a world of SSR and server components</title>
      <dc:creator>James O'Halloran</dc:creator>
      <pubDate>Sun, 13 Nov 2022 12:14:40 +0000</pubDate>
      <link>https://dev.to/jamespohalloran/validating-your-sites-links-in-a-world-of-ssr-and-server-components-1fbk</link>
      <guid>https://dev.to/jamespohalloran/validating-your-sites-links-in-a-world-of-ssr-and-server-components-1fbk</guid>
      <description>&lt;p&gt;Over the last 5 years, I have loved working in the "Jamstack" movement, where static site generators (like Hugo, Jekyll, Gatsby, etc) pre-generated your HTML for you, and your pages were served from a CDN. Validating links before pull-requests were merged was easy, because all your checks could run against this pre-generated HTML&lt;/p&gt;

&lt;p&gt;Lately though, with popular frameworks like NextJS, Remix, and the whole shift to Server Components, more of the modern web if shifting back to server-side rendering. It's becoming harder to do these checks BEFORE pull-requests are merged. &lt;/p&gt;

&lt;p&gt;This is why I built &lt;a href="https://github.com/jamespohalloran/linkproofer"&gt;LinkProofer&lt;/a&gt;, an extremely lightweight CLI tool for validating links stored in &lt;code&gt;js&lt;/code&gt; or &lt;code&gt;ts&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/pC4IgjB4fxVZFggIPG/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/pC4IgjB4fxVZFggIPG/giphy.gif" alt="linkproofer" width="480" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of proofing the links in the built-html, it proofs them before they are consumed. &lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Out-of-the-box Typescript support.&lt;/li&gt;
&lt;li&gt;Customizable entry (Provide your own filepath glob, or store links in &lt;code&gt;*.linkproof.&amp;lt;js | ts&amp;gt;&lt;/code&gt; files).&lt;/li&gt;
&lt;li&gt;Support for absolute or relative links.&lt;/li&gt;
&lt;li&gt;Run LinkProofer checks locally, or in CI.&lt;/li&gt;
&lt;li&gt;Lightweight! (~50 kB).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can learn more about the project by checking out the &lt;a href="https://github.com/jamespohalloran/linkproofer"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Do "Future you" a favour and setup your "indie project boilerplate"</title>
      <dc:creator>James O'Halloran</dc:creator>
      <pubDate>Fri, 26 Aug 2022 20:19:54 +0000</pubDate>
      <link>https://dev.to/jamespohalloran/do-future-you-a-favour-and-setup-your-indie-project-boilerplate-16j1</link>
      <guid>https://dev.to/jamespohalloran/do-future-you-a-favour-and-setup-your-indie-project-boilerplate-16j1</guid>
      <description>&lt;p&gt;As a developer, how many times have you been asked:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How long would it take to make ?".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I can't count the amount of times I relearned the lesson that these types of projects always take longer than expected to fully launch.&lt;/p&gt;

&lt;p&gt;This recently happened to me when a friend brought up the idea of a "Fantasy Football Draft Order Generator", any my response was naively:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"A few hours or so". &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;(You can checkout the final product &lt;a href="https://www.draftorders.com/"&gt;here&lt;/a&gt;. While it's very simple, I can promise it was more than a few hours.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I usually get started creating these projects using a tool like &lt;code&gt;create-next-app&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I'll add Typescript, Tailwind, a component library, wire up my site's layout, fiddle with flex-box in the footer, Figure out how external scripts should be loaded in Next JS , etc etc etc.&lt;/p&gt;

&lt;p&gt;Many of these individual tasks are fairly trivial on their own, but it's often a death by 1000 cuts, where your "1 hour project" quickly turns into a whole ordeal. Before you know it, this trivial project starts eating into your evenings/weekends (or maybe you never get around to properly launching the project).&lt;/p&gt;

&lt;p&gt;Do "future you" a favour...and create your own "Indie Boilerplate".&lt;/p&gt;

&lt;p&gt;I've created mine here:&lt;br&gt;
&lt;a href="https://github.com/jamespohalloran/indie-boilerplate"&gt;https://github.com/jamespohalloran/indie-boilerplate&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;On my next hobby project I'll be able to get started with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-next-app@latest -e https://github.com/jamespohalloran/indie-boilerplate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I won't need to worry about dealing with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the site's layout (Let's face it, these usually aren't that unique)&lt;/li&gt;
&lt;li&gt;Configuring SEO meta fields&lt;/li&gt;
&lt;li&gt;Setting up Tailwind &amp;amp; my preferred component library (DaisyUI in my case)&lt;/li&gt;
&lt;li&gt;Adding my personal links to the footer&lt;/li&gt;
&lt;li&gt;Adding copyright info&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also even have my own "Indie Project Checklist" in the readme to keep me on track.&lt;/p&gt;

&lt;p&gt;I hope this helps out "future you" on your next hobby project!&lt;/p&gt;




&lt;p&gt;To follow along with more of my hobby projects, follow me on &lt;a href="https://twitter.com/jamespohalloran"&gt;twitter&lt;/a&gt; &amp;amp; checkout my &lt;a href="https://johalloran.dev"&gt;portfolio site&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>startup</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Let's make static sites dynamic again! ...sorta (with NextJS "preview-mode")</title>
      <dc:creator>James O'Halloran</dc:creator>
      <pubDate>Tue, 10 Mar 2020 13:15:01 +0000</pubDate>
      <link>https://dev.to/jamespohalloran/let-s-make-static-sites-dynamic-again-sorta-with-nextjs-preview-mode-1imj</link>
      <guid>https://dev.to/jamespohalloran/let-s-make-static-sites-dynamic-again-sorta-with-nextjs-preview-mode-1imj</guid>
      <description>&lt;p&gt;I've been working with static sites for several years now. Before that, Wordpress was my go-to... and I hope to never again dig through their source-code 🙃. The switch to developing with static site generators has made my sites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster&lt;/li&gt;
&lt;li&gt;Cheaper (free) to run&lt;/li&gt;
&lt;li&gt;More secure&lt;/li&gt;
&lt;li&gt;MUCH easier to manage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For these reasons... when I first heard about Next.js, I was a bit confused about their focus on "Server Rendering". I wasn't sure why I should care about server rendering for my use-case as most of my sites were pretty small. I was fully accustomed to my SSG's of choice building everything up front, and then deploying the static assets. The datasource was consumed at build-time, and I could just run the site locally in dev-mode as I made changes to my content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wait, I thought the title of this blog was "Let's make static sites dynamic again!"...
&lt;/h2&gt;

&lt;p&gt;Well, I didn't realize it, but there were some definite drawbacks of having all my pages static.&lt;/p&gt;

&lt;p&gt;When a site is built statically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content is consumed at build-time. If I want to see a new "preview" of an edit, I need to rebuild the site.&lt;/li&gt;
&lt;li&gt;For each of these previews, the entire site needs to be completely rebuilt which can be sloooow. &lt;em&gt;Note: Gatsby is currently working on a "Incremental Builds" to get around this, but it's not ready yet&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;If I'm running a 'preview' server to rebuild when my datasource is updated, I need one server running per datasource. Why does this matter? What if me and a team of editors are making changes to 3 different branches of my site at once? I would need 3 servers running 3 different versions of my site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those might seem like minor qualms, but I think it's a huge part of the reason that static site CMS's haven't caught up to the editing/collaboration experience of services like Squarespace. Seeing a live preview of a site is a crucial step before publishing changes, and the above drawbacks make it challenging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next's &lt;a href="https://nextjs.org/blog/next-9-3#preview-mode"&gt;"Preview Mode"&lt;/a&gt; to the rescue
&lt;/h2&gt;

&lt;p&gt;With this latest NextJS release, Each page template can be designed to export statically, but can provide alternate behaviour for when they are run using SSR.&lt;/p&gt;

&lt;p&gt;This has allowed us at &lt;a href="https://tinacms.org/"&gt;TinaCMS&lt;/a&gt; to provide an "open authoring" solution where our site is static, but can be run in dynamic "edit" mode with custom content per-user.&lt;/p&gt;

&lt;p&gt;So... back to our drawbacks of static-building mentioned above...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Content is consumed at build-time. If I want to see a new "preview" of an edit, I need to rebuild the site."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With SSR, the data is consumed dynamically per-request. In the case of TinaCMS's open authoring, it lets each editor load dynamic data per-request from their own fork.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"For each of these previews, the entire site needs to be completely rebuilt which can be sloooow."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nope! No rebuild is needed for preview mode. SSR renders each page on-the-fly as we need it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If I'm running a 'preview' server to rebuild when my datasource is updated, I need one server running per datasource."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nope! Just one. With SSR, the data is dynamic, so each user's request can query a different dataset. Also, In the case of deploying with Zeit, they automatically set up serverless Lambda functions for each of my templates, so I don't have to deal with managing any servers 🎉!&lt;/p&gt;

&lt;h2&gt;
  
  
  Neat!
&lt;/h2&gt;

&lt;p&gt;And of course, my live production site is still fully static. When I enter enter-mode, it switches to use SSR. It's the best of both worlds!&lt;/p&gt;

&lt;p&gt;This (in my opinion) is going to be a gamechanger. Good work, Zeit team!&lt;/p&gt;

&lt;p&gt;So... Let's make static sites dynamic again! &lt;strong&gt;(&lt;em&gt;conditionally... in preview-mode&lt;/em&gt; 🙂)&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>jamstack</category>
      <category>javascript</category>
      <category>nextjs</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
