# First Time Setup

{% embed url="<https://youtu.be/H0mCKO-OkQY>" %}

## Prerequisites

* Node.js 18 or later
* A [Supabase](https://supabase.com/) project **(free tier is fine)**
* A hosting provider (Vercel recommended) or a self-hosted server

{% stepper %}
{% step %}

### Install dependencies

Open a terminal in the project folder and run:

```bash
npm install
```

{% endstep %}

{% step %}

### Create your environment file

The project includes a `.env.local.example` file with every available variable and a description of each. Create a copy and call it `.env`

{% hint style="success" %}
Rename the `.env.example` to `.env`
{% endhint %}

Open `.env` in a text editor. The sections below explain where to find each value.

#### Supabase credentials

These are required for the app to connect to your database and auth service.

<table><thead><tr><th width="274.25">Variable</th><th>Where to find it</th></tr></thead><tbody><tr><td><code>NEXT_PUBLIC_SUPABASE_URL</code></td><td>Supabase dashboard → Select the Project  → Copy the Project URL under <em>"x's Project"</em></td></tr><tr><td><code>NEXT_PUBLIC_SUPABASE_ANON_KEY</code></td><td>Project Settings → API Keys → Legacy anon → <strong>Copy</strong> <code>anon public</code></td></tr><tr><td><code>SUPABASE_SERVICE_ROLE_KEY</code></td><td>Project Settings → API Keys → Legacy anon → <strong>Copy</strong> <code>service_role</code></td></tr><tr><td><code>DATABASE_URL</code></td><td>Project Overview → Connect <em>(Top of Page)</em> → Connection String → Change method to <strong>'Transaction pooler'</strong> → <strong>Copy</strong> database link</td></tr></tbody></table>

{% hint style="success" %}
You can view your project by navigating to <https://supabase.com/dashboard/org>
{% endhint %}

{% hint style="info" %}
Your `DATABASE_URL` will look like&#x20;

```bash
postgresql://postgres.xxx:[YOUR-PASSWORD]@aws-1-eu-west-1.pooler.supabase.com:6543/postgres
```

{% endhint %}

#### App URL

These three variables tell the app what URL it is running on. They are used to build absolute URLs for outbound emails, OAuth redirect callbacks, and the IMAP poller.

**Production (example):**

```env
APP_PROTOCOL=https
APP_HOST=your-app.vercel.app
APP_PORT=443
```

**Local development:**

```env
APP_PROTOCOL=http
APP_HOST=localhost
APP_PORT=3000
```

{% endstep %}

{% step %}

### Configure Supabase Auth

Before running the app, set the allowed URLs in your Supabase project so that OAuth and email callbacks work correctly.

1. Go to your Supabase dashboard → **Authentication → URL Configuration**.
2. Set **Site URL** to your app's URL, e.g. `https://your-app.vercel.app`.
3. Under **Redirect URLs**, add:
   * `https://your-app.vercel.app/auth/callback`
   * `http://localhost:3000/auth/callback` (for local development)

<figure><img src="https://2288520902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDhcWTW8fKc2Z5mCJbD74%2Fuploads%2Fxde2KVbAo6Slx8F5ZefK%2F%7BE3686B34-09AF-4E58-A28B-19A6BBE8CFD2%7D.png?alt=media&#x26;token=c14bf4f2-4902-4fa9-a974-6053861c52ea" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Run the application

```bash
npm run start
```

On first boot the application will automatically:

1. Run all pending database migrations
2. Create a default admin account

**Default admin credentials:**

```
Email:    admin@admin.com
Password: password123
```

{% hint style="danger" %}
**Important:** Log in immediately and change the admin password. You will be prompted to set the email and password
{% endhint %}
{% endstep %}
{% endstepper %}

## Next steps

* [Email Integration](https://docs.drakodevelopment.net/drako-tickets/getting-started/broken-reference) — set up SMTP outbound mail and IMAP inbound email-to-ticket
* [Discord Integration](https://docs.drakodevelopment.net/drako-tickets/getting-started/broken-reference) — connect the Discord bot to your server
* [Login Providers](https://docs.drakodevelopment.net/drako-tickets/getting-started/broken-reference) — enable Google, Discord, or Microsoft OAuth sign-in
