logo
Custom Server Environment

Database

Supabase

The database for ProShot is powered by Supabase, an open source Firebase alternative built on top of PostgreSQL. For a custom server environment, you have two options: use Supabase Cloud (easiest) or self host Supabase via Docker on your server (full control).

Option 1: Supabase Cloud (Easiest)

This is the same setup as the production environment. You create a project on supabase.com and use their managed infrastructure. Follow the exact same steps as the Production Environment Database Guide, using your custom server domain for the URL configuration instead of a Vercel URL.

Option 2: Self Hosted Supabase (Docker)

If you want full control over your data and infrastructure, you can run Supabase on the same server using Docker.

Docker and Docker Compose must be installed and running on your server before proceeding. If you followed the Getting Started guide, Docker should already be installed.

Clone the Supabase Docker Repository

git clone --depth 1 https://github.com/supabase/supabase -b master /opt/supabase
cd /opt/supabase/docker

Configure Environment Variables

Copy the example environment file and edit it:

cp .env.example .env
nano .env

Update the following values at minimum:

POSTGRES_PASSWORD=your-secure-database-password
JWT_SECRET=your-jwt-secret-at-least-32-characters
ANON_KEY=your-generated-anon-key
SERVICE_ROLE_KEY=your-generated-service-role-key
DASHBOARD_USERNAME=your-admin-username
DASHBOARD_PASSWORD=your-admin-password

You can generate JWT tokens using the Supabase JWT Generator. Use your JWT_SECRET along with the anon and service_role roles to generate the ANON_KEY and SERVICE_ROLE_KEY.

Start Supabase

docker compose up -d

Supabase Studio will be available at http://your-server-ip:8000. The API will be available at the same address.

Create Database Tables

In your ProShot source code, open the file supabase/schema.sql. This file contains the complete SQL schema including all tables, Row Level Security policies, functions, and default configuration.

Access Supabase Studio at http://your-server-ip:8000, navigate to SQL Editor, paste the entire contents of schema.sql, and click Run.

Run the schema only once on a fresh instance. Running it again will not cause errors but should be avoided.

Connect SMTP

In Supabase Studio, navigate to Project Settings then Authentication. Scroll down to SMTP Settings and enable it. Enter your SMTP provider details:

Sender email = anyname@your-resend-verified-domain
Sender name = Your App Name
Host = smtp.resend.com
Port number = 465
Minimum interval between emails being sent = 60
Username = resend
Password = your-resend-api-key

If you use a different email provider (such as AWS SES, Postmark, or Mailgun), the Host, Port, Username, and Password fields will be different. Refer to your provider's SMTP documentation for the correct values.

Configure URLs

In Supabase Studio, navigate to Authentication then URL Configuration. Set:

Site URL = https://your-domain.com/
Redirect URL = https://your-domain.com/**

Replace your-domain.com with your actual server domain. The Site URL must end with a trailing slash. The Redirect URL must end with /**.

Enable Authentication Providers

Navigate to Authentication then Providers. Enable:

Email: Should be enabled by default. Handles email plus password sign ups.

Google: Optional but recommended. Follow Google Auth with Supabase for setup.

Update Application .env

Update the Supabase variables in your ProShot .env file:

NEXT_PUBLIC_SUPABASE_URL=http://your-server-ip:8000
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-anon-key
SUPABASE_SECRET_KEY=your-service-role-key

This completes your database setup. Proceed to deploy the application.