T
all articles

Building for Accessibility and Performance: The Story of Heckerspace ๐ŸŒš๐ŸŒ

image of the author - ลukasz Fiuk

ลukasz Fiuk

9 minutes read โณ

Setting Goals ๐ŸŽฏ

Decision made, I'm building a blog! I knew that it'll be crucial to set clear goals and choose the right tools to bring my vision to life. ๐Ÿ”ฎ

Key objectives:
1.๐Ÿš€ Performance: Heckerspace has to be fast. Who the heck likes to wait?

2.๐Ÿ™ Accessibility: Hey, it's 2023, let's make things easy for everyone! Accessibility should be a no-brainer, not an afterthought.

3.๐ŸŽจ Theme support: I don't want your eyes to bleed at night and users shouldn't have to struggle in sunny days. Gimmie the the choice!

4.๐Ÿ“ Content creation: I'll be writing articles in markdown, so I need to find a way to render that content.

5.๐ŸŽจ Syntax highlighting: As I'll be sharing code snippets, it'd be important to have a system for syntax highlighting. Bonus points if users can also easily copy that code.

6.๐Ÿงฑ Content management: With a growing number of entries, it'll be handy to have a CMS that makes it easy to manage and organize content.

7.๐Ÿ’ฌ Feedback: It would be great to have a comment system in place.

8. ๐Ÿ’Œ Newsletter: While it's not a top priority now, I may add a newsletter in the future to keep my readers up-to-date with new content.

9.๐Ÿ†• CI/CD: I'd like to have a CI/CD pipeline that will automatically rebuild and update the page as new features / articles fly in.

10.๐Ÿ”Ž SEO: Last but not least, I want to make sure that this content is easily discoverable. This means paying attention to SEO best practices.

Choosing my weapons ๐Ÿชš

It's time to pick the tools ๐Ÿ”ง for my project! Here's what I settled on:

  • Next.js: A well-optimized, React-based framework with great performance and built-in SEO ๐Ÿ“ฆ
  • TypeScript: I need type-safety for sure! ๐Ÿ”’
  • Framer Motion: A lightweight animation library with a great set of features โœจ
  • Hygraph and GraphQL: More on that in the CMS Chapter ๐Ÿง‘โ€๐Ÿ’ผ
  • Zustand/react-hooks-global-state: A neat tool for simple global state management, based on Zustand ๐ŸŒ
  • Styled Components: I considered using CSS-Modules or zero-runtime alternatives such as Linaria, but I decided to stick with Styled Components. My testing showed minimal performance impact, and I find CSS-in-JS to be more convenient and legible. One day I'll write a separate article comparing these tools in detail. ๐Ÿ’…
  • use-hooks-ts: A lovely set of well-typed hooks ๐Ÿช

Building this blog was a wild ride through the vast landscape of tech solutions. โ›ฐ๏ธ I invested a significant amount of time and energy into it, but ultimately realized that overanalyzing every option is a waste of time. โณ More often than not, the differences between technologies are subtle and go unnoticed by the end users. ๐Ÿคท

So, heed my advice fellow heckers and avoid falling into the same trap I did.

Choose the tools that you're familiar with and enjoy using, create a minimum viable product that simply works, and then refine the details as you go.

Finding the Ultimate CMS ๐Ÿ”

Finding the ideal CMS was quite the rollercoaster. ๐ŸŽข First, I was going to go with MDX to keep things local. ( MDX is a fancy way of writing markdown with added React component perks. ) It was looking promising, but I realized I missed having my content and code separated. So, I thought about setting up a Strapi app, but then I found out that Heroku won't be free soon and the whole setup was becoming a hassle. ๐Ÿ˜ช So I started searching for a hosted alternative and let me tell you, I couldn't find anything that could match Strapi's versatility.

But then, drumroll ๐Ÿฅ please... I stumbled upon Hygraph CMS! ๐Ÿ’• It's got all the perks of Strapi but with the added bonus of a cloud-based setup, so no configuration necessary! You can create modules and posts in markdown and there's even a fantastic playground for crafting those GraphQL queries. And the best part? Their community/free tier is extremely generous. ๐ŸŽ‰

Accessibility ๐Ÿงโ€โ™€๏ธ

I made a conscious effort to design this blog with accessibility in mind, so that everyone can comfortably use it.

Responsiveness and browser zoom

  • Starting from the basics - the whole website is responsive and should work well on both phones and 4K screens. It should also not break if you use browser zoom or reader view.

Colors

  • This blog supports both light and dark theme, and I was trying to make sure that all colors have sufficient color-ratio, without making the contrast too high.

Keyboard navigation

  • I did some testing with Accessibility Insights to make sure that all elements are focusable with Tab and that there are no focus traps. Finally to make your experience a bit better I have added some keyboard shortcuts and visual cues that appear once u press Tab

Content structure

  • I was aiming to use semantically correct tags so users can easily navigate through page landmarks, and heading structure should be quite healthy.

While I tested this site's accessibility using Accessibility Insights, there is still room for improvement in the future. I will continue to make updates to ensure that everyone can enjoy a seamless and inclusive browsing experience. ๐Ÿฆ‹

Performance ๐Ÿ’ฅ

NextJS is fast out-of-the-box, so the challenge was not to break it. To optimize the bundle size for production, I'm using Preact and loading all the bells and whistles with lazy-loading. This means they are only loaded when they are actually needed, thus avoiding any delay in the initial page load.

Additionally, I carefully chose external packages using BundlePhobia.

The end result is quite satisfying, with a 100/100 rating from Google LightHouse ๐Ÿš€, four times over ๐Ÿฅณ.

heckerspace-lighthouse-stats.webp

Hosting Made Easy ๐Ÿง

Choosing a hosting was a piece of cake, thanks to the big brains ๐Ÿง  behind NextJS who also happened to create the best hosting platform out there: Vercel ๐Ÿ’ฅ It seamlessly connects to your GitHub repository and Hygraph CMS has a ready-made integration for Vercel, making it super easy to use. ๐Ÿ’ฏ

Vercel boasts a user-friendly interface, top-notch analytics ๐Ÿ“Š, build logs and tons of build-in integrations. When paired with Checkly (the tool that checks performance before every deploy), it's the ultimate choice for programmers heckers ๐Ÿ™.

Comment System ๐Ÿ’ฌ

Having a way to engage with my audience was crucial for me, as thats one of the main reasons why I'm even building this blog. After some research I found two great options: Utterances and Giscus.

I ultimately decided to go with Giscus over Utterances because it's powered by GitHub Discussions, while Utterances uses Github Issues. (And I don't want to clutter Issues tab with comments)

With Giscus, each article generates a new discussion on GitHub where all comments are neatly organized.Thanks to GitHub Authentication there's no risk of bot-generated spam. On top of that it supports markdown, with familiar Github code highlighting and lazy-loading for faster page loads. ๐Ÿ’จ

I can't wait to see what kind of conversations will emerge in the comments section! ๐Ÿค—

0

Comments ๐Ÿ’ฌ

Hello world! Hello Heckers! ๐ŸŒŽ๐Ÿ‘ฝ