Clone & install using Docker

Clone code

ROQ One is published as open source. You can find the public repository here: github.com/roqtech/roq-one In the repository you find the Frontend and the Backend application of ROQ One. To get a local copy of it run this command in your workspace or download the source code directly from Github.

git clone git@github.com:roqtech/roq-one.git
CODE

Create .env file

To install it create an .env file in the root directory and copy&paste the credentials that you get in the console: ➚console.roq.tech/details

The content of the .env file will look similar to this:

# HOST used for connecting to ROQ Platform
ROQ_PLATFORM_HOST=https://saturn-pp.roq-platform.com
  
# Backend URL of your application (e.g. ROQ One Backend)
NEXT_PUBLIC_PLATFORM_HOST=https://saturn-pp.roq-platform.com

# Definition of Database connection for the Backend of your application
DATABASE_URL=postgres://roqone:roqone@localhost/roqone_dev
  
# ID of the ROQ Platform Tenant (e.g. environment)
TENANT_ID=...
  
# Key used for authentication with your ROQ Platform Tenant
API_KEY=...
NONE

Run local environment

Now you can run the command below. Make sure that Docker is installed and running on your computer because it's used to provision the database. If you are using Windows and get problems then we recommend to use WLS2. Also it’s important that there is no local Postgres running.

docker-compose up --build
CODE

As an alternative to the docker-compose command, you can also run:

docker compose up --build
CODE

In this case you need to make sure that you are using Docker Compose V2:

Open applications in browser

When the script is done then you can open the applications:

Behind the scenes

When you run the docker-compose command then the following commands will be executed:

(1) Installation of local Postgres database by using the backend/create-dev-db.sh script

(info) You can find the credentials and the used port in the docker-compose.yml

(2) Build of ROQ One Backend based on backend/Dockerfile This will execute sub-commands like:

  • npm install - Installs dependencies that are defined in backend/package.json

  • npm run createSchema - Creation of the GraphQL schema (see ➚Nest.js - Generate DSL)

  • npm run generateDocs - Generation of the GraphQL docs (see GraphQL API doc)

  • npm run migration:local:config - Creation of the ormconfig.json which provide configs for migration

  • npm run migration:local:run - Execution of database migrations, see Database migrations

  • npm run import:initial - Import of local seed data to the database, see File seeding

  • npm run start:dev - Starts application in “dev” mode using Nest.js’ command nest start --watch

(3) Build of ROQ One Frontend based on frontend/Dockerfile This will execute sub-commands like:

  • npm install - Installs dependencies that are defined in frontend/package.json

  • npm run translate - This command fetches translations from ROQ Platform, see Translations

  • npm run dev - Starts application in “dev” mode, see ➚Next.js documentation for details

Environment variables configuration

We are using best practices of ➚Nest.js configuration and also providing default values for all environment variables needed for service execution. In case when you need to override any of these variables - feel free to adopt the .env file and pass your values there. This file will be ignored by Git, so be careful not to get unexpected behavior on other environments. If you used docker-compose to install the dependencies then no additional configuration is needed here.

All configuration files of ROQ One Frontend can be found in:

frontend/src/configuration/*
CODE

All configuration files of ROQ One Backend can be found in:

backend/src/config/* 
CODE

The values can be set either directly in these files or indirectly via environment variables. For instance if you would like to change the name of your project, then you can either set a new value in backend/src/config/validation.schema.ts or inject the related environment variable: APP_NAME