# Setup Guide

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

> Install Prism, run the setup wizard and get your shop online.



Prism is set up in the browser. You start it once, open the site and a setup wizard asks for everything it needs.

## Before You Start

You need:

* A host that runs **Node.js 20** or newer, or **Bun**.
* An empty **PostgreSQL**, **MySQL** or **MariaDB** database. Prism creates its own tables.
* A Discord application from the [Discord Developer Portal](https://discord.com/developers/applications).
* Your Prism license key from the [Zero Development Discord](https://discord.zerodev.ca).

## Hosting

| Option                        | Best for                                                                                    |
| ----------------------------- | ------------------------------------------------------------------------------------------- |
| Game panel (Pterodactyl)      | The easiest choice. The panel keeps Prism running and gives you a console and file manager. |
| Linux VPS or dedicated server | Full control. Use a process manager such as PM2 or systemd.                                 |
| Your own computer             | Testing and development.                                                                    |

## Install

<Tabs items="[&#x22;Pterodactyl&#x22;, &#x22;Linux&#x22;, &#x22;Windows&#x22;]">
  <Tab value="Pterodactyl">
    1. Create a server with a Node.js 20 or newer egg.
    2. Upload the Prism files.
    3. Set the startup command to `node index.js`.
    4. Start the server.
  </Tab>

  <Tab value="Linux">
    1. Open a terminal in the Prism folder.
    2. Run `npm install`.
    3. Run `node index.js`.

    To keep Prism running after you close the terminal, use PM2:

    ```bash
    npm install -g pm2
    pm2 start index.js --name Prism
    ```
  </Tab>

  <Tab value="Windows">
    1. Open PowerShell in the Prism folder.
    2. Run `npm install`.
    3. Run `node index.js`.
  </Tab>
</Tabs>

On the first start Prism creates `config.json`, builds the web app and serves it on port `3000`. The first build takes a few minutes. The console shows:

```text
Prism is not configured yet. Open the web address to run the setup wizard.
```

Prism installs the driver for your database the first time it connects, so there is nothing else to install.

## Discord Application

The Discord account on your license becomes the shop owner, so Discord sign-in is required. Google, Apple, GitHub and email sign-in are optional and can be added later.

1. Create an application in the [Discord Developer Portal](https://discord.com/developers/applications).
2. Go to **OAuth2** and add your site address followed by `/api/auth/callback/discord` under **Redirects**:
   * On your own computer: `http://localhost:3000/api/auth/callback/discord`
   * On a domain: `https://shop.example.com/api/auth/callback/discord`
3. Copy the **Client ID** and **Client Secret** for the wizard.

## Setup Wizard

Open `http://localhost:3000`, or your server's address on port `3000`.

| Step              | What you enter                                                                                                               |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Welcome           | The language.                                                                                                                |
| Database          | Type, host, port, user, password and database name. Click **Test Connection**.                                               |
| License           | Your license key. Click **Check License**. The Discord account on the license becomes the owner.                             |
| Branding          | Site name, accent colour, **Web URL** and **API URL**. Leave the URLs empty on your own computer.                            |
| Sign-in Providers | Discord client ID and secret, plus any optional providers. The wizard shows the redirect to add. Click **Test Credentials**. |
| Launch            | Click **Launch Prism**.                                                                                                      |

Prism then saves your settings, connects to the database, activates the license, loads its modules and checks for updates. The wizard shows each stage with the live console. When it finishes, click **Go to Sign In** and sign in with Discord. There is no restart.

## Hosting on a Domain

Point a reverse proxy at each port. Pick yours:

<ReverseProxy sites="[{ domain: &#x22;shop.example.com&#x22;, port: 3000 }, { domain: &#x22;api.shop.example.com&#x22;, port: 3001 }]" />

The site on port `3000` already forwards `/api/v1/` to the API, so customers and the store only need the first domain. Give the API its own domain if your products or scripts call it directly.

Set **Web URL** and **API URL** in the wizard, or later under **Settings > Server URLs**. Changing them later asks you to restart Prism.

<Callout type="warn">
  The Web URL, the address in your browser and the redirects in each provider's console must all match, or sign-in fails.
</Callout>

## Next

* [Products](/docs/prism/products) to create your first product.
* [Checkout](/docs/prism/checkout) to start taking payments.
* [Storefront](/docs/prism/storefront) to design your site.
