Running Trustroots locally
These instructions are for installing locally. If you’d like to have containerised setup, see Installing with Docker instead.
Prerequisites
Make sure you have installed all these prerequisites:
- Unix operating system, like Linux or MacOS. If you use Windows, please look into installing via Docker instead.
- Git (
git --version
, preinstalled on MacOS) - Node.js:
- See “engines” from
package.json
for supported versions - Use
node --version && npm --version
to check your current version. - We recommend managing Node.js versions using NVM.
- See “engines” from
- MongoDB
- See “engines” from
package.json
for supported versions - Use
mongod --version
to check your current version.
- See “engines” from
- Some of the NPM modules require compiling native code, which might require installing:
- MacOS: X-Code’s Command line tools. You can install or confirm they’re installed by running
xcode-select --install
- Linux:
build-essential
andmake
- MacOS: X-Code’s Command line tools. You can install or confirm they’re installed by running
- GraphicsMagick.
- In MacOS, you can simply use Homebrew to install it:
brew install graphicsmagick
- In MacOS, you can simply use Homebrew to install it:
Installing
1. Clone the repository:
git clone https://github.com/Trustroots/trustroots.git
cd trustroots
2. Make sure MongoDB is running on the default port (27017):
mongod
Optional: If you need to modify connection settings, see config/env/local.js
config file.
3. Install dependencies and start the app:
npm ci
npm start
🎉 Open http://localhost:3000 in your browser.
Good to know
- Run the app by typing
npm start
. - Run commands in production mode by appending
NODE_ENV
to command, e.g.:NODE_ENV=production npm start
. - Stop the app by hitting
Ctrl+C
. - When you change any file, they get recompiled and the browser is refreshed.
- Keep an eye on the console in case of compiling errors.
- NPM dependencies can be updated with
npm ci
- You can start clean by running
npm run dropdb && npm run distclean
.
Modifying configurations
Add any configurations you want to keep out of version control to config/env/local.js
file. It’s created for you on the first start and overrides anything in config/env/local.js
.
Next Steps
Check out Development Getting Started to learn more about general project structure. Check out the Development docs for more info about tooling, mock data, running tests, etc.