Mono Connect

A quick introduction to building with Mono connect

1328

Table of contents

  1. Clone the repository
  2. Set up your environment variables
  3. Run the quickstart

1. Clone the repository

Using HTTPS:

$ git clone https://github.com/withmono/quickstart.git
$ cd quickstart

Alternatively, if you use ssh:

$ git clone [email protected]:withmono/quickstart.git
$ cd quickstart

2. Set up your environment variables

$ cp .env.example .env

Copy .env.example to a new file called .env and fill out the environment variables inside. Add your REACT_APP_MONO_PUBLIC and MONO_SECRET. Get your Client ID and secrets from
the dashboard: https://app.mono.co/apps

NOTE: .env files are designed for development only. Never run a production application with an environment file that contains secrets.

3. Run the Quickstart

Run with Docker

Pre-requisites

Running

There are three make commands available

  • up: builds and starts the container
  • logs: tails logs for running application
  • stop: stops the container, you can also use the Docker GUI

Each of these should be used with a language argument, which is node. If unspecified, the default is node.

Start the container
$ make up language=node

The quickstart backend is now running on http://localhost:8080 and the frontend on http://localhost:3000.

If you change the contents of the server files or .env file, simply run make up language=node to rebuild and restart the server.

If you experience a Docker connection error when running the command above, try the following:

  • Make sure Docker is running
  • Try running the command prefixed with sudo
View the logs
$ make logs
Stop the container
$ make stop

Run without Docker

Prerequisites

  • The language you intend to use is installed on your machine and available at your command line.
    This repo should generally work with active LTS versions of each language such as node >= 14
  • Your environment variables populated in .env
  • npm
  • If using Windows, a command line utility capable of running basic Unix shell commands

Quickstart Scripts

Scripts are located in the main directory for your convenience.

Setup
./setup.sh

Run to install the required dependencies.

Node
./start_node.sh

This will run both the front and node backend simultaneously in a single convenient terminal.

1. Running the backend

Once started with one of the commands below, the quickstart will be running on http://localhost:8080 for the backend. Enter the additional commands in step 2 to run the frontend on http://localhost:3000.

Node
$ cd ./node
$ npm install
$ npm start

2. Running the frontend

$ cd ./frontend
$ npm install
$ npm start

Next steps

You have successfully finished the Mono Quickstart, congrats! From this point on, we encourage you to alter the Quickstart code in order to experience using the Mono API. You now have a few options for movement:

You can proceed to the Use cases page for a mapping of typical use cases to matching products if you're unsure of which Mono products you want to use.