@joystick.js/core

Environment Settings

How to configure your Joystick app with settings..json files.

To provide configuration for your app, Joystick relies on settings.<env>.json files at the root of your app. You should have one settings.<env>.json file for each environment your app will run in (this environment is denoted by the value of process.env.NODE_ENV).

When you start your app with joystick start via the CLI, this defaults to development. If you deploy your app using Push, this defaults to production.

The following settings files and environments are recommended:

  • settings.development.json — Settings for your local/development environment.
  • settings.staging.json — Settings for your staging environment (a private but internet-accessible version of your app running on hardware similar to your production environment).
  • settings.production.json — Settings for your production environment.
  • settings.test.json — Settings for your app used when running joystick test via the Joystick CLI.

Non-development environment behavior

While you can use any environment name you wish, keep in mind that Joystick treats any environment name other than development as a production-like environment.

Settings File Structure

For all of your supported environment files, the following structure should be utilized. A description of each field's behavior can be found below.

{
  "config": {
    "databases": [],
    "i18n": {
      "default_language": "en-US"
    },
    "middleware": {},
    "email": {
      "from": "",
      "smtp": {
        "host": "",
        "port": 587,
        "username": "",
        "password": ""
      }
    }
  },
  "global": {},
  "public": {},
  "private": {}
}

API

Parameters

config object required
Contains Joystick-specific settings for your app.
databases array required
Connection settings for the databases you'd like to connect to your app.
provider string required
The provider ID of one of Joystick's supported database providers (e.g., mongodb).
users boolean
Whether user management should be enabled for this database (defaults to false).
options object
Additional configuration for the provider's Node.js driver.
connection object
Specify a remote connection for the provider.
username string
Username for the remote connection.
password string
Password for the remote connection.
database string
Name of the database for the remote connection.
hosts array
An array of hosts for the remote connection.
hostname string
Hostname for the remote DB (e.g., us1.mongodbprovider.com).
port integer
Port number for the hostname.
build object
Configuration for Joystick's build process.
excluded_paths array
Paths to exclude from the build process.
copy_paths array
Custom paths to copy during the build process.
middleware object
Overrides for Joystick's built-in middleware.
i18n object
Internationalization (i18n) settings.
defaultLanguage string
ISO-693 language + ISO-3166 country code (e.g., en-US, de-DE).
email object
Email settings for SMTP providers.
from string
Default from address if none passed to email.send().
smtp object
SMTP provider settings.
host string
SMTP hostname.
port integer
SMTP port (commonly 587 for TLS).
username string
SMTP username.
password string
SMTP password.
global object
Global settings accessible on both client and server.
public object
Public settings accessible on both client and server.
private object
Private settings accessible only on the server.