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.
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.
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.
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.