Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 1.85 KB

File metadata and controls

60 lines (49 loc) · 1.85 KB

Network Access Setup

When accessing Tersa from other devices on your network, you need to ensure Supabase is accessible.

Problem

By default, local Supabase only listens on localhost (127.0.0.1), which isn't accessible from other devices.

Solutions

Option 1: Use Hosted Supabase (Recommended)

  1. Create a free account at https://supabase.com
  2. Create a new project
  3. Update your .env.local:
    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
    POSTGRES_URL=your-postgres-url

Option 2: Dynamic Environment Configuration

Create a .env.local that uses your machine's network IP:

# Replace with your machine's IP address
NEXT_PUBLIC_SUPABASE_URL=http://192.168.68.71:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-local-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-local-service-role-key

Then ensure Supabase is started with network binding (this may require Supabase CLI modifications).

Option 3: Use ngrok

  1. Install ngrok: brew install ngrok
  2. Start Supabase normally: npx supabase start
  3. Create a tunnel: ngrok http 54321
  4. Use the ngrok URL in your .env.local:
    NEXT_PUBLIC_SUPABASE_URL=https://your-subdomain.ngrok.io

Option 4: Reverse Proxy

Set up a reverse proxy (like nginx) on your machine to forward requests from your network IP to localhost:54321.

Security Warning

Exposing your local Supabase instance to your network can be a security risk. Only do this on trusted networks and for development purposes.

Accessing the App

Once Supabase is accessible, you can access the app from other devices using:

http://YOUR_MACHINE_IP:3000

Make sure your Next.js dev server is also listening on all interfaces:

npm run dev -- --hostname 0.0.0.0

or

pnpm dev --host