Orbit Docs
Get Started
Deployment
Architecture
Architecture Overview
Shared Packages
Database
Database Schema
Triggers & Functions
Features
Spaces
Posts
Comments
Follows
Notifications
Feeds
Roles
Roles & Permissions
Api
Admin Api
Users
Roles
Site Configuration
Content Moderation — Posts
Content Moderation — Spaces
Hub Api
Spaces
Posts
Comments
Reactions
Memberships
Follows
Feeds
Uploads
Views
Other Api
Profile
Public Profiles
Notifications
Leaderboard
About
OG Metadata
User Search
Sponsored
Aveiro
aveiro.app
TrademarkTrademark
Ctrl k
Search...
Sign up
Orbit Docs
Get Started
Deployment
Architecture
Architecture Overview
Shared Packages
Database
Database Schema
Triggers & Functions
Features
Spaces
Posts
Comments
Follows
Notifications
Feeds
Roles
Roles & Permissions
Api
Admin Api
Users
Roles
Site Configuration
Content Moderation — Posts
Content Moderation — Spaces
Hub Api
Spaces
Posts
Comments
Reactions
Memberships
Follows
Feeds
Uploads
Views
Other Api
Profile
Public Profiles
Notifications
Leaderboard
About
OG Metadata
User Search

Deployment

Prerequisites, environment variables, and step-by-step Vercel deployment for the Supa Hub monorepo.
Updated 11d ago
Orbit Docs
Sponsored
Aveiro
aveiro.app
Sponsored
Aveiro
aveiro.app
Sponsored
Aveiro
aveiro.app
TrademarkTrademark
OrbitSupa Social by Dopler
© Dopler. All rights reserved.
Built with Aveiro
This guide covers everything needed to deploy the Supa Hub monorepo from scratch.

Prerequisites

Before deploying, you need accounts and projects set up on the following services:
  • Supabase — Create a project at supabase.com
  • Upstash — Create a Redis database at upstash.com (used for rate limiting)
  • Vercel — Two separate Vercel projects (hub, auth)
  • Domain — A domain with two subdomains (e.g. example.com for hub, auth.example.com for auth)

Supabase Setup

  • Run the Database Schema

Open the SQL Editor in your Supabase dashboard and run the contents of setup.sql from the repository root. This single file creates all tables, enums, indexes, triggers, functions, and seed data. The script is idempotent — it uses IF NOT EXISTS and ON CONFLICT throughout, so it's safe to run multiple times.

  • Create Storage Buckets

In Storage, create the following bucket:
Bucket
Public
Purpose
hubYesSpace avatars, covers, and post image attachments
Set the bucket to public so uploaded images are accessible via URL.

  • Configure Auth Providers

In Authentication > Providers, enable the providers you want (e.g. Google, GitHub, email/password).

  • Set Redirect URLs

In Authentication > URL Configuration, add these redirect URLs: Local development: Production:

  • Set the Site URL

Set the Site URL to your auth app's URL:

Upstash Setup

Create a Redis database in Upstash. You'll need the REST URL and REST Token from the database details page.

Environment Variables

Hub App (apps/hub)

Variable
Description
NEXT_PUBLIC_SUPABASE_URLSupabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEYSupabase anon/public key
SUPABASE_SERVICE_ROLE_KEYSupabase service role key (server-side only)
UPSTASH_REDIS_REST_URLUpstash Redis REST URL
UPSTASH_REDIS_REST_TOKENUpstash Redis REST token
NEXT_PUBLIC_AUTH_URLURL of the auth app (e.g. https://auth.yourdomain.com)
NEXT_PUBLIC_DOMAINCookie domain for cross-subdomain auth (e.g. .yourdomain.com)
NEXT_PUBLIC_COOKIE_DOMAINCookie domain for cross-subdomain auth (e.g. .yourdomain.com)

Auth App (apps/auth)

Variable
Description
NEXT_PUBLIC_SUPABASE_URLSupabase project URL (same as hub)
NEXT_PUBLIC_SUPABASE_ANON_KEYSupabase anon/public key (same as hub)
SUPABASE_SERVICE_ROLE_KEYSupabase service role key (same as hub)
NEXT_PUBLIC_HUB_URLURL of the hub app (e.g. https://yourdomain.com)
NEXT_PUBLIC_DOMAINCookie domain (e.g. .yourdomain.com)
NEXT_PUBLIC_COOKIE_DOMAINCookie domain for cross-subdomain auth (e.g. .yourdomain.com)

Local Development

For local development, create .env.local files in each app directory with the same variables. Use localhost URLs:

Vercel Deployment

Hub Project

  • Import the repository in Vercel
  • Set Root Directory to apps/hub
  • Set Framework Preset to Next.js
  • Add all hub environment variables
  • Set custom domain to yourdomain.com

Auth Project

  • Import the same repository in a new Vercel project
  • Set Root Directory to apps/auth
  • Set Framework Preset to Next.js
  • Add all auth environment variables
  • Set custom domain to auth.yourdomain.com

Documentation

Documentation is no longer part of the monorepo. This site is hosted on Aveiro and published independently of any Vercel deployment, so there is nothing to configure here.

Cross-Subdomain Authentication

The hub and auth apps share authentication cookies across subdomains. This is achieved by:
  • Setting NEXT_PUBLIC_DOMAIN to the parent domain (e.g. .yourdomain.com) — note the leading dot
  • The Supabase client in packages/sb sets cookies with domain scoped to this value
  • The auth app handles login/signup and redirects back to the hub
  • The hub reads the shared cookie to identify the user
For local development, both apps run on localhost (different ports), so cookies are shared automatically.

Post-Deployment Checklist

  • Run setup.sql in Supabase SQL Editor
  • Create the hub storage bucket (public)
  • Configure auth providers in Supabase
  • Add redirect URLs in Supabase
  • Set environment variables in both Vercel projects
  • Configure custom domains and DNS
  • Sign up as the first user, then manually set your role to admin in the user_global_roles table
http://localhost:3000/api/auth/callback
http://localhost:3001/api/auth/callback
https://auth.yourdomain.com/api/auth/callback
https://yourdomain.com/auth
https://auth.yourdomain.com
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-redis-token
NEXT_PUBLIC_AUTH_URL=http://localhost:3001
NEXT_PUBLIC_DOMAIN=localhost
# No domain needed for localhost
NEXT_PUBLIC_COOKIE_DOMAIN=