Skip to content

Getting started

Matt Smith edited this page Jan 24, 2020 · 2 revisions

System requirements

The application requires Node JS, NPM package manager and Redis to be installed.

Installing Node JS and NPM

Installing Node on OSX

The best way to install Node JS on OSX is via the Homebrew package manager. This should install NPM by default. To install Node JS with Homebrew run:

brew install node

Installing Node on Linux

To install Node on Linux run:

sudo apt install nodejs

Managing multiple versions of Node JS

Node Version Manager (NVM) is a useful module for managing multiple versions of Node JS on a single machine.

Installing Redis

The application uses Redis for session storage. To run the application locally a local instance of Redis is required to be running.

Installing and running Redis on OSX

The best way to install Redis on OSX is via the Homebrew package manager. To install Redis with Homebrew run:

brew install redis

To start the Redis server run:

brew services start redis

To stop the Redis server run:

brew services stop redis

To check the Redis server is running run:

redis-cli ping

Installing Redis on Linux

To install Redis on Linux run:

sudo apt install redis-server

Installing dependencies

To install the project dependencies run the following command from the project root:

npm install

Setting environment variables

Before starting the application or running tests, ensure that the correct environment variables have been set. A list of required environment variables can be found in sample.env.

To run the app locally, duplicate sample.env and rename to .env. dotenv will then use the .env file to set local environment variables. It is important that .env is never committed to the code repository as it may contain sensitive data.

Running the application

To start the application run the following command:

// Build the application
npm run build

// Start the application
npm start

Alternatively the application can be built and run using a single command that uses nodemon to watch for changes:

npm run start:dev

* N.B. The build target is automatically run in the postinstall hook defined in package.json. This is useful for building the project during deployment.

Clone this wiki locally