ShipNow
Features

Authentication

ShipNow supports both Supabase Authentication and Auth.js for secure user authentication with multiple providers.

Overview

ShipNow provides two authentication solutions to choose from:

Choosing an Auth Provider

Both solutions offer excellent authentication capabilities, but they have different strengths:

Choose Supabase Auth if you:

  • Are using Supabase as your backend
  • Need built-in user management
  • Want to use real-time subscriptions for your data

Choose Auth.js if you:

  • Need custom domain (Supabase requires $35/month)
  • Want to use other database
  • Need flexible provider configuration

Configuration Auth Provider

You can switch between auth providers by setting an environment variable:

.env.local
# Use Auth.js (default)
NEXT_PUBLIC_AUTH_PROVIDER=nextauth
 
# Or use Supabase
NEXT_PUBLIC_AUTH_PROVIDER=supabase

Common Auth Utilities

Both implementations use the same auth utilities interface for a consistent developer experience:

import { useUser, signIn, signOut } from '@/lib/auth/client';
 
// Get current user
const user = useUser();
 
// Sign in with provider
await signIn('github');
 
// Sign out
await signOut();

Get Current User

You can use the useUser hook to get the current user in client components.

'use client';
 
import { useUser } from '@/lib/auth/client';
 
export function UserProfile() {
  const user = useUser();
 
  if (!user) {
    return <div>Please sign in</div>;
  }
 
  return <div>Welcome {user.email}</div>;
}

Next Steps

On this page