Video

Use WASM Compiled Golang Functions in NextJs

Use WASM Compiled Golang Functions in NextJs

What if you are using Next.js for your website but want to make use of Golang functionality written to support your backend APIs? This is a quick look at the Tinygo WebAssembly guide and how I integrated the output with NextJs.

The Tinygo Guide

Here is the Tinygo guide I used. It gives you a very basic first step to building a wasm binary from Go. Getting Golang set up correctly on my system was the hardest part for me, but even that didn’t take too long.

Uniform Codegen Project

Uniform Codegen Project

I’ve published my Uniform components TypeScript generation scripts to a cli package @davetayls/uniform-codegen.

Intro

Source code is here: https://github.com/davetayls/uniform-codegen

It looks like it might need a bit of TLC as it has some old Optimize types in there. I will be working on getting it updated over the next week or so.

It currently supports Contentful, BigCommerce and Hygraph types. It is simple to add a new integration, especially if it exposes a GraphQL endpoint.

Progressing through Environments with Uniform

Progressing through Environments with Uniform

When deploying anything other than a simple POC or personal website, a reliable application will need Environments. What is the right pattern for implementing environments for local developers as well as shared ones like staging and production?

Let’s look at how Uniform separates your configuration and content. Then look at how we can migrate both to new higher environments as a feature progresses through it’s software development workflow.

Uniform Project

Within Uniform the “Project” is the recommended way to separate configuration and content between environments. The screenshot below shows three projects used for my demo website.

Create Global UI State with React Context

Create Global UI State with React Context

How do you implement some UI state which can be changed from different parts of your React application?

In this example I implement a menu which can be toggled using a central UI context. I’ve built it in such a way that a central Provider component controls how this context will be updated. By doing it this way you will keep your code easy to read and will reduce the complexity of any bugs you encounter in the future.

Transferring Less JavaScript with Next Dynamic

Transferring Less JavaScript with Next Dynamic

As your application grows you will want to separate out JavaScript from your main bundle. You will arrive at a point where the majority of the JavaScript you are serving is not being used on any particular page your user is on.

In this video I walk through how you can structure your NextJs application code to dynamically split out JavaScript based on modules.