Setup a Node & Frontend Locally

This doc will teach you how to set up your dev environment. Although it's not a hard prerequisite, we recommend skimming the DeSo Code Walkthrough first, as it provides some useful context.

Prerequisites

To run the frontend repo, you will need to be running Node v13.13.0 and NPM 6.14.4. We recommend using NVM to set this environment up. To run the backend you'll need Go v1.15.6 installed. These can be installed via homebrew by running:

brew install nvm
# follow the output to set up your ~/.nvm folder, nvm script, and shell completion
nvm install 13
# check the versions
node -v
npm -v
# then install go
brew install [email protected]
# check the version
go version

We will also assume that you have Goland installed. This is the recommended IDE for developing on DeSo since most of the code is Go code.

Another prerequisite is vips which can be installed with homebrewbrew install vips – or apt install libvips-tools on Ubuntu.

Setup

First, you must checkout all repos into the same directory. Some of these repos are technically optional, but checking them all out allows you to hop around the code more easily.

Once all of these repos are checked out, we recommend importing them into a single Goland project. This allows you search across and develop on all of of the repos concurrently. To do this, open Goland, hit File > Open, select a repo folder, and select "Attach" when prompted. If you do this correctly, you should have all four repos loaded into a single Goland project.

If you're not familiar with Goland, the following hotkeys are useful for jumping around the code (full cheat sheet here):

  • SHIFT+SHIFT: Open any file across all four repos with fuzzy search.

  • CTRL+SHIFT+F: Search across all four repos at once with regexes.

  • CTRL+SHIFT+A: Runs any action that you would normally find in a menu.

  • CTRL+B: Jump to definition or find usages.

If you like Vim, you can also install the Vim plugin so you get your typical Vim hotkeys.

Building and running locally

Running the frontend in development mode

Running the node in testnet mode

By default, your browser will point at localhost:17001, which is the default "mainnet" API port. However, when you run n0_test, your node spins up on localhost:18001. To point your frontend at your testnet node, however, you must open up your inspector and change your lastLocalNodev2 parameter to localhost:18001 as shown in the screenshot below. After you do this, you should be able to Sign Up, and everything should work normally.

Running the node in mainnet mode

Most of the time, we develop using testnet mode because it's fast and cheap. However, to make sure our changes work before pushing we like to run full-blown mainnet nodes locally.

Running a local identity service (optional)

Running an identity service locally is generally not required. However, doing so is as easy as running the Angular app:

In order to point your browser at your local identity service rather than at identity.deso.org, you must change a localStorage value similar to what we did to get the testnet node running. In this case, we must change lastIdentityServiceURL to http://localhost:4201. See the screenshot below:

Last updated

Was this helpful?