# Configuration

URL: https://zerodev.ca/docs/prism/configuration

> What lives in config.json, the environment variables Prism reads and where everything else is set.



Prism keeps only what it needs to start in `config.json`. Everything else is stored in your database and changed from the dashboard.

| Where             | What                                                                                           |
| ----------------- | ---------------------------------------------------------------------------------------------- |
| `config.json`     | Sign-in secret, database connection, ports and public URLs.                                    |
| **Settings** page | Language, console, branding, server URLs, SMTP, S3 storage, updates, sign-in and checkout.     |
| **Theme** page    | Colours, fonts, store layout and the sign-in screen. See [Storefront](/docs/prism/storefront). |
| **Configs** page  | Settings for each module.                                                                      |

The [setup wizard](/docs/prism/setup) fills in `config.json` for you. You only need to edit it to move to a new database or change a port.

## config.json

Prism creates this file on the first start.

```json title="config.json"
{
    "AUTHENTICATION": {
        "SECRET": "generated-on-first-start"
    },
    "DATABASE": {
        "TYPE": "POSTGRES",
        "HOST": "localhost",
        "PORT": "5432",
        "USER": "admin",
        "PASSWORD": "password",
        "DATABASE": "Prism"
    },
    "SERVER": {
        "WEB": {
            "PORT": 3000,
            "URL": null,
            "DEVELOPER": false
        },
        "API": {
            "PORT": 3001,
            "URL": null,
            "LOGS": true
        }
    }
}
```

| Key                                         | What it does                                                                                                   |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `AUTHENTICATION.SECRET`                     | Signs sessions and Prism's internal requests. Generated for you. Leave it alone once Prism is running.         |
| `DATABASE.TYPE`                             | `POSTGRES`, `MYSQL` or `MARIADB`.                                                                              |
| `DATABASE.HOST`, `PORT`, `USER`, `PASSWORD` | How to reach the database.                                                                                     |
| `DATABASE.DATABASE`                         | The database name. It must already exist.                                                                      |
| `SERVER.WEB.PORT`                           | Port for the store site and dashboard.                                                                         |
| `SERVER.WEB.URL`                            | Public site address, such as `https://shop.example.com`. Used for sign-in redirects and checkout return links. |
| `SERVER.WEB.DEVELOPER`                      | Serves the web app with live reload instead of a build. Only for working on Prism itself.                      |
| `SERVER.API.PORT`                           | API port.                                                                                                      |
| `SERVER.API.URL`                            | Public API address, such as `https://api.shop.example.com`.                                                    |
| `SERVER.API.LOGS`                           | Prints each API request to the console.                                                                        |

Leave both URLs as `null` while running on your own computer. Set them from **Settings > Server URLs** when you move to a domain.

## Environment Variables

These override `config.json` when set, which suits Docker and panels that only let you set variables. Prism also reads a `.env` file in its folder.

| Variable                  | Overrides                                    |
| ------------------------- | -------------------------------------------- |
| `PRISM_DATABASE_TYPE`     | `DATABASE.TYPE`                              |
| `PRISM_DATABASE_HOST`     | `DATABASE.HOST`                              |
| `PRISM_DATABASE_PORT`     | `DATABASE.PORT`                              |
| `PRISM_DATABASE_USER`     | `DATABASE.USER`                              |
| `PRISM_DATABASE_PASSWORD` | `DATABASE.PASSWORD`                          |
| `PRISM_DATABASE_NAME`     | `DATABASE.DATABASE`                          |
| `PRISM_WEB_PORT`          | `SERVER.WEB.PORT`                            |
| `PRISM_WEB_URL`           | `SERVER.WEB.URL`                             |
| `PRISM_API_PORT`          | `SERVER.API.PORT`                            |
| `PRISM_API_URL`           | `SERVER.API.URL`                             |
| `API_LOGS`                | Set to `false` to turn off API request logs. |

## Settings Page

**Settings** has three tabs.

### General

| Section     | What it holds                                                                                                           |
| ----------- | ----------------------------------------------------------------------------------------------------------------------- |
| Language    | Display language, secondary language and whether visitors see a language dropdown.                                      |
| Console     | Debug output, API request logs, 12-hour clock and seconds in timestamps.                                                |
| Branding    | Site name and a custom icon.                                                                                            |
| Server URLs | Public web and API addresses and ports. Changing them asks for a restart.                                               |
| SMTP        | The mail server for verification, password reset and email change messages. **Send Test Email** checks it.              |
| S3 Storage  | The bucket for product downloads: Cloudflare R2, Amazon S3 or any S3-compatible service. **Test Connection** checks it. |
| Updates     | Your version, update checks and automatic updates on restart.                                                           |

### OAuth

| Section             | What it holds                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------- |
| Discord Sign In     | Discord client ID and secret.                                                                     |
| Sign-in Providers   | Google, Apple and GitHub. Leave one blank to turn it off.                                         |
| Email & Password    | Show the email and password form, and send verification and reset emails. Sending needs SMTP.     |
| Allow Email Changes | Let people change the email on their account. See [Accounts](/docs/prism/accounts#email-changes). |

### Checkout

Payment gateways, currency, cart, addons, coupons, sales, points and the purchase webhook. See [Checkout](/docs/prism/checkout).

Secrets such as client secrets, the SMTP password, the S3 secret key and gateway keys are never sent back to the browser once saved. The field shows that a value is set, and saving without changing it keeps the stored value.

## Module Settings

Each module with settings has its own page under **Configs**. Core has none. The [Kora module](/docs/prism/extensions/kora) adds its API and automation settings there.

## Resetting

To start over, stop Prism and run:

```bash
npm run factory-reset
```

It asks whether to reset the database only or everything, then asks you to type the database name. It drops every table in that database and clears the settings cache. With the database only, the next start runs the setup wizard again with your database connection kept. With everything, `config.json` is deleted too and the wizard starts from scratch.

| Flag         | Effect                                               |
| ------------ | ---------------------------------------------------- |
| `--database` | Resets the database only, without asking.            |
| `--all`      | Resets everything, without asking for the scope.     |
| `--yes`      | Resets the database only and skips the confirmation. |
