Xnode NextJS Base Template

In order to show how easy it is to leverage Xnode Studio, XnodeOS (forked NixOS) and bare metal server providers, we are working with the open source developer community to host hackathons where devs can submit their new app templates and get rewarded! Check out our open source bounty platform called Open R&D where you can complete development tasks to earn bounties! These tasks are created, reviewed and funds escrowed in alignment to our Openmesh hackathon initiatives! The first one was completed during the Openmesh Speedhack hackathon at the Chainlink SmartCon HK 2024 event.

The Xnode NextJS Base Template

The NextJS base template is the foundational code needed to deploy your NextJS application locally and then onto Openmesh bare metal servers.

Xnode NextJS Base Template - Github Repo

This template is provided so you can make your NextJS app Xnode/Nix compatible.

Base Template Modification Steps

  1. Replace all instances of "xnode-nextjs-template" with the name of your project. This should be unique, as no apps with the same name can be run on a single Xnode.

  2. Build your NextJS app

  3. In case your npm dependencies change, run nix run in the root folder and replace the npmDepsHash in package.nix with the got hash in the error.

  4. Once your app is ready for deployment and runs using nix run, push to GitHub and copy your GitHub url (e.g. https://github.com/Openmesh-Network/xnode-nextjs-template).

  5. Go the the App Store in Xnode Studio and go to the advanced tab.

  6. Paste your GitHub url and enter the name of the project you choose during step 1.

  7. Hit deploy and wait for your app to be ready.

  8. Copy the deploy link and replace the one click deployment url in the next section. (to allow others to easily deploy your application)

One click deployment

You can find the one click deploy button at the Github repository readme page (cannot embed the link within Gitbook). When you click it it will quickly deploy this NextJS Base Template to Xnode after you connect your wallet to Xnode Studio.

Commands (in root folder)

nix run

Commands (in nextjs-app)

npm i
npm run dev
npm run build
npm run start

Deployment Tips

We are updating XnodeOS to use the latest NixOS features like Flakes. Therefore, if you have any errors that are Flake related please try the following nix run commands:

nix run --extra-experimental-features "nix-command flakes"

You can also update the ~/.config/nix/nix.conf file with the following to make it flakes permanent, so that the simple "nix run" will execute successfully:

experimental-features = nix-command flakes

Openmesh Developer Community Forks

During our Openmesh developer community hackathons, we have already had submissions for other NextJS base template Forks that you can deploy on top of Openmesh. All community submissions are external to Openmesh (not on the official repo or supported). Please conduct your own due diligence on the code modifications from the base template.

Last updated