Self-hosting the Members Portal
  • 29 Oct 2021
  • 2 Minutes to read
  • Comment

Self-hosting the Members Portal

  • Comment

You can customise your Nexudus portal in more detail by accessing the code used in the different pages.

Use this method when you need to host the members portal on your own infrastructure. For example:

  • You need to do a complete rewrite of all pages to apply radically different styles and layouts.

  • You want to use all or part of the portal features within your own marketing site or other platform features.

Caveats

There are a few areas you may want to pay special attention when self-hosting the members portal:

Callbacks

Users can leave your Members Portal to complete an action on other system and then come back to your portal. A common example is off-site payment methods such as Stripe Direct Debit, GoCardless or even hosted payment page. 

When user go back to your portal and you host the portal, you should always make the required request to our servers to complete that action for the user. For example, if you receive a request to https://yourdomain.com/en/callbacks/coCardlessPost?id=12345 you should proxy that call to https://your_nexudus_domain.spaces.nexudus.com/en/callbacks/coCardlessPost?id=12345 to complete the user action.

HomeUrl vs NativeHomeUrl

The business object in your portal's code has predefined variables to quickly obtain the domain for a given location (business). These are HomeUrl and NativeHomeUrl. When you are not self-hosting, those two variables point to Nexudus hosted servers but this is not the case when self-hosting. In this case, HomeUrl will return the domain pointing to your servers while NativeHomeUrl will always point to our servers. This can be useful if you want to make sure you always generate URLs pointing to us. 


For example, when constructing the URL for an image.

`${business.NativeHomeUrlWithLanguage}/coworker/getAvatar/${message.CoworkerId}?w=192&h=192&mode=pad`

How is it built?

The Nexudus portal is build using ReactJS on top of NextJS. It uses MobX as state management. 

Downloading and running from source code

You can download the most recent version of the portal using GIT. You will need a version Node greater than 10.19.0 and Yarn.

You will need to ask source@nexudus.com to access the repository and agree to its LICENSE.txt

Once you have downloaded the code, you will need to edit the configuration file to make sure the code uses your Nexudus account. In the example below xyz is the subdomain of a Nexudus account. You can find yours in Settings > Website.

mceclip0.png

Replace the env/config.js file with the code below, replacing xyz with your own Nexudus account domain.

module.exports = {
 apiRoot: 'https://xyz.spaces.nexudus.com',
 platformRoot:'https://spaces.nexudus.com',
};

Next, install all dependencies running yarn. This can take some time.

yarn

You will also need to install  i18next-parser to produce the translation files during the build process.

yarn global add i18next-parser

Once yarn has finished installing all packages, you can run the project using:

yarn run dev

If you want to create a release version to be published in the .next folder, run:

yarn run build


Attachments

Was this article helpful?