<?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>Forem: Steve Frenzel</title>
    <description>The latest articles on Forem by Steve Frenzel (@stvfrnzlnxm).</description>
    <link>https://forem.com/stvfrnzlnxm</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%2F523055%2Fb6403bf8-698c-4492-9130-b942216c3bb3.jpeg</url>
      <title>Forem: Steve Frenzel</title>
      <link>https://forem.com/stvfrnzlnxm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/stvfrnzlnxm"/>
    <language>en</language>
    <item>
      <title>ThankYouNext 🖤 - A Next.js starter template</title>
      <dc:creator>Steve Frenzel</dc:creator>
      <pubDate>Thu, 27 May 2021 14:19:48 +0000</pubDate>
      <link>https://forem.com/nexum/thankyounext-a-next-js-starter-template-4k25</link>
      <guid>https://forem.com/nexum/thankyounext-a-next-js-starter-template-4k25</guid>
      <description>&lt;p&gt;Website: &lt;a href="https://thankyounext.vercel.app/" rel="noopener noreferrer"&gt;https://thankyounext.vercel.app/&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a href="https://github.com/stevefrenzel/thankyounext" rel="noopener noreferrer"&gt;https://github.com/stevefrenzel/thankyounext&lt;/a&gt;&lt;br&gt;
Original post: &lt;a href="https://dev.to/stvfrnzl/thankyounext-next-js-starter-template-32fg"&gt;https://dev.to/stvfrnzl/thankyounext-next-js-starter-template-32fg&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;I first came into contact with &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; about a year ago and have been a big fan ever since! I love features like routing, image optimization or the flexibility to choose between SSG and SSR (or use both). Especially the developer experience feels more pleasant than with React and the support from people like &lt;a href="https://leerob.io/" rel="noopener noreferrer"&gt;Lee Robinson&lt;/a&gt; and &lt;a href="https://cassidoo.co/" rel="noopener noreferrer"&gt;Cassidy Williams&lt;/a&gt; is just priceless! To me, Next.js feels like a superset of React, similar like TypeScript to Javascript. 🙂&lt;/p&gt;

&lt;p&gt;For this reason, I decided to use Next.js for my personal projects. However, I didn't want to start from scratch every time and painstakingly put everything together until I have a base I feel comfortable coding on. So I decided to create a template to share with the public, as I'm interested in what other people would add, change or improve.&lt;/p&gt;

&lt;p&gt;Here you can find an illustration by me dear friend Ingrid, who visualized the flow of this template:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqisszlkyi6r2owd5fq9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqisszlkyi6r2owd5fq9a.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;It was bootstrapped with &lt;a href="https://nextjs.org/docs/api-reference/create-next-app" rel="noopener noreferrer"&gt;create-next-app&lt;/a&gt; and has the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://preactjs.com/" rel="noopener noreferrer"&gt;Preact&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/" rel="noopener noreferrer"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sass-lang.com/" rel="noopener noreferrer"&gt;Sass&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://eslint.org/" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt; and &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; configuration&lt;/li&gt;
&lt;li&gt;&lt;a href="https://piccalil.li/blog/a-modern-css-reset" rel="noopener noreferrer"&gt;CSS reset by Andy Bell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/advanced-features/module-path-aliases" rel="noopener noreferrer"&gt;Absolute imports&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode" rel="noopener noreferrer"&gt;React strict mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ready-to-use SEO setup&lt;/li&gt;
&lt;li&gt;Many security headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If possible, I recommend deploying it via Vercel, as it's a pain free process and gets you up and running within minutes (hint: This template was deployed via Vercel). More features are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fthankyounext.vercel.app%2F" rel="noopener noreferrer"&gt;A perfect Google Lighthouse score&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wave.webaim.org/report#/https://thankyounext.vercel.app/" rel="noopener noreferrer"&gt;No accessibility violations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://estimator.dev/#https://thankyounext.vercel.app/" rel="noopener noreferrer"&gt;Ships with zero byte of JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fthankyounext.vercel.app%2F" rel="noopener noreferrer"&gt;No HTML warnings or errors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fthankyounext.vercel.app%2F&amp;amp;profile=css3svg&amp;amp;usermedium=all&amp;amp;warning=1&amp;amp;vextwarning=&amp;amp;lang=en" rel="noopener noreferrer"&gt;No CSS errors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  1. Setup ⚙️
&lt;/h1&gt;
&lt;h2&gt;
  
  
  1.1 TypeScript
&lt;/h2&gt;

&lt;p&gt;If you don't feel comfortable using &lt;strong&gt;TypeScript&lt;/strong&gt; or simply don't need it, just rename all &lt;code&gt;.tsx&lt;/code&gt; files in the pages folder to &lt;code&gt;js&lt;/code&gt; and in the components folder to &lt;code&gt;.jsx&lt;/code&gt;. Then run &lt;code&gt;npm uninstall typescript&lt;/code&gt; to remove it from your project. You should use it though, especially when working on more complex projects. It's painful at first, but very rewarding once you get the hang of it.&lt;/p&gt;
&lt;h2&gt;
  
  
  1.2 Preact
&lt;/h2&gt;

&lt;p&gt;This template runs with &lt;strong&gt;Preact&lt;/strong&gt; instead of React, which results in a smaller build and the same developer experience. &lt;a href="https://preactjs.com/guide/v8/differences-to-react/" rel="noopener noreferrer"&gt;More info about the differences to React&lt;/a&gt;. Want to switch back to React? Easy as cake, just delete or comment out the following in &lt;code&gt;next.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;webpack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isServer&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;dev&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isServer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;react&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;preact/compat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom/test-utils&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;preact/test-utils&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;preact/compat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to clean up your project, run &lt;code&gt;npm uninstall preact preact-compat&lt;/code&gt; to uninstall it.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Performance 🏃‍♀️
&lt;/h1&gt;

&lt;p&gt;Inspired by this post from Lee Robinson - &lt;a href="https://leerob.io/blog/fonts" rel="noopener noreferrer"&gt;Web Fonts in 2021&lt;/a&gt; - I'm using the following web safe fonts to increase performance for this template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;font-family&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;Georgia&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;'Times New Roman'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;Times&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;serif&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This template also ships with zero byte of client-side JavaScript, thanks to the following lines of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;unstable_runtimeJS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to use things like &lt;strong&gt;next/image&lt;/strong&gt; or &lt;strong&gt;React hooks&lt;/strong&gt; though, you will have to remove it, otherwise they will not work.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Accessibility 🌍
&lt;/h1&gt;

&lt;p&gt;Make sure your website or application can be used by any human being. If you're not familiar with the topic of accessibility, here are some resources you can check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/standards-guidelines/wcag/" rel="noopener noreferrer"&gt;Web Content Accessibility Guidelines (WCAG)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility" rel="noopener noreferrer"&gt;MDN Web Docs - Accessibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://webaim.org/resources/" rel="noopener noreferrer"&gt;WebAIM resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://moz.com/blog/accessibility-seo-1" rel="noopener noreferrer"&gt;What you should know about accessibility and SEO&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://motherfuckingwebsite.com/" rel="noopener noreferrer"&gt;Motherf*cking website (NSFW)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://webaim.org/resources/" rel="noopener noreferrer"&gt;Inclusive components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://briefs.video/" rel="noopener noreferrer"&gt;Webbed briefs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This template already includes some elements that will improve the accessibility of your project, like a &lt;strong&gt;skip link&lt;/strong&gt;, an &lt;strong&gt;external link component&lt;/strong&gt;, &lt;strong&gt;keyboard focus&lt;/strong&gt; (working in all major browsers) and a &lt;strong&gt;proper, flexible font size&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Security 🔒
&lt;/h1&gt;

&lt;p&gt;Thanks to &lt;a href="https://twitter.com/leeerob/status/1381605537742254082" rel="noopener noreferrer"&gt;Lee Robinson's tweet about security headers&lt;/a&gt;, I became aware that my standard &lt;strong&gt;Next.js&lt;/strong&gt; project was missing a bunch of them and didn't rank so well at &lt;a href="https://observatory.mozilla.org/" rel="noopener noreferrer"&gt;Mozilla Observatory&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I followed his configuration with some slight adjustments, but please configure them according to your project purpose. In &lt;code&gt;next.config.js&lt;/code&gt; you will find the following seven security headers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP" rel="noopener noreferrer"&gt;Content Security Policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy" rel="noopener noreferrer"&gt;Referrer-Policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" rel="noopener noreferrer"&gt;X-Frame-Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options" rel="noopener noreferrer"&gt;X-Content-Type-Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control" rel="noopener noreferrer"&gt;X-DNS-Prefetch-Control&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security" rel="noopener noreferrer"&gt;Strict-Transport-Security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy" rel="noopener noreferrer"&gt;Permissions Policy (formerly known as Feature Policy)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  5. Styling 💅
&lt;/h1&gt;

&lt;p&gt;You have a lot of options to style your project, I just went with good ol' &lt;strong&gt;Sass&lt;/strong&gt;. If it gets more complex, you could also use &lt;strong&gt;Sass modules&lt;/strong&gt; for individual components. Use whatever works best for you, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/basic-features/built-in-css-support#adding-a-global-stylesheet" rel="noopener noreferrer"&gt;A global stylesheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/basic-features/built-in-css-support#adding-component-level-css" rel="noopener noreferrer"&gt;CSS (or Sass) Modules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/basic-features/built-in-css-support#css-in-js" rel="noopener noreferrer"&gt;CSS-in-JS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://styled-components.com/" rel="noopener noreferrer"&gt;styled-components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://duckduckgo.com/?t=ffab&amp;amp;q=css+sucks&amp;amp;ia=web" rel="noopener noreferrer"&gt;No CSS at all&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  6. Search engine optimization 🔍
&lt;/h1&gt;

&lt;p&gt;I've created a &lt;code&gt;Meta.tsx&lt;/code&gt; component which does all the heavy lifting regarding SEO. You can setup default props or feed it dynamically with data, depending on the context.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>saas</category>
      <category>a11y</category>
    </item>
  </channel>
</rss>
