> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weventures.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication & Real-time

> Auth providers and real-time communication solutions

## Authentication Providers

<Tabs>
  <Tab title="Managed Solutions">
    ### Clerk

    **Complete user management platform**

    Beautiful pre-built UIs, social logins, MFA, webhooks, user management dashboard.

    **Pricing:** Free up to 10K MAU, then per-seat pricing

    **Best for:** Startups, B2B SaaS, rapid development

    **Features:**

    * Beautiful customizable UI components
    * Social logins & passwordless
    * Multi-factor authentication
    * User management dashboard
    * Organizations & teams
    * Webhooks & integrations

    [Documentation](https://clerk.com/docs) • [Get Started](https://clerk.com)

    ***

    ### Auth0

    **Enterprise identity platform (Okta)**

    Battle-tested, multi-language support, M2M auth, enterprise-grade security.

    **Pricing:** \$0.07/MAU (not public beyond 20K)

    **Best for:** Enterprise, multi-language apps, M2M authentication

    **Features:**

    * Multi-language support
    * Machine-to-machine auth
    * Advanced security features
    * Okta integration
    * Enterprise SSO

    [Documentation](https://auth0.com/docs) • [Get Started](https://auth0.com)

    ***

    ### Supabase Auth

    **PostgreSQL-backed authentication**

    JWT-based, Row-Level Security, integrates with Supabase ecosystem.

    **Pricing:** \$0.00325/MAU (most affordable)

    **Best for:** Supabase users, SQL-based auth, budget-conscious projects

    **Features:**

    * JWT authentication
    * Row-Level Security
    * Social logins
    * Email/SMS verification
    * Direct PostgreSQL integration

    [Documentation](https://supabase.com/docs/guides/auth) • [Get Started](https://supabase.com/auth)

    ***

    ### Firebase Auth

    **Google's authentication service**

    Easy social logins, phone auth, email verification.

    **Best for:** Mobile apps, Firebase users, simple auth needs

    **Features:**

    * Social authentication
    * Phone number auth
    * Email verification
    * Anonymous auth
    * Firebase integration

    [Documentation](https://firebase.google.com/docs/auth) • [Get Started](https://firebase.google.com/products/auth)
  </Tab>

  <Tab title="Open-Source">
    ### NextAuth.js / Auth.js

    **Open-source auth for Next.js**

    50+ OAuth providers, self-hosted, database-agnostic. Full control.

    **Pricing:** Free (open-source)

    **Best for:** Self-hosting, custom requirements, budget constraints

    **Features:**

    * 50+ OAuth providers
    * Database-agnostic
    * JWT or database sessions
    * Self-hosted
    * Fully customizable

    [Documentation](https://next-auth.js.org) • [Get Started](https://next-auth.js.org/getting-started/introduction)

    ***

    ### Lucia

    **Lightweight auth library**

    TypeScript-first, framework-agnostic, minimal abstraction.

    **Best for:** Developers who want auth without magic, custom flows

    **Features:**

    * TypeScript-first
    * Framework-agnostic
    * Minimal abstraction
    * Full control
    * Lightweight

    [Documentation](https://lucia-auth.com) • [Get Started](https://lucia-auth.com/getting-started)

    ***

    ### SuperTokens

    **Open-source alternative to Auth0**

    Self-hostable, session management, social & passwordless login.

    **Best for:** Self-hosting, avoiding vendor lock-in, compliance needs

    **Features:**

    * Self-hostable
    * Session management
    * Social logins
    * Passwordless auth
    * Open-source

    [Documentation](https://supertokens.com/docs) • [Get Started](https://supertokens.com)
  </Tab>
</Tabs>

## Real-time & WebSockets

<CardGroup cols={2}>
  <Card title="Supabase Realtime" icon="wave-pulse">
    **PostgreSQL change data capture**

    Listen to database changes in real-time. Built on Phoenix Channels.

    **Best for:** Supabase users, database-driven real-time

    * PostgreSQL CDC
    * Included with Supabase
    * Phoenix Channels
    * Presence & broadcast

    [Documentation](https://supabase.com/docs/guides/realtime)
  </Card>

  <Card title="Socket.io" icon="plug">
    **Real-time bidirectional communication**

    WebSockets with fallbacks, rooms, namespaces. Battle-tested.

    **Best for:** Chat apps, multiplayer games, real-time dashboards

    * WebSocket-based
    * Rooms & namespaces
    * Automatic fallbacks
    * Battle-tested

    [Documentation](https://socket.io/docs)
  </Card>

  <Card title="Pusher" icon="signal-stream">
    **Hosted WebSocket service**

    Managed WebSocket infrastructure, presence channels, client SDKs.

    **Best for:** Managed solution, rapid development, global scale

    * Fully managed
    * Presence channels
    * Global CDN
    * Client SDKs

    [Documentation](https://pusher.com/docs)
  </Card>

  <Card title="Ably" icon="tower-broadcast">
    **Realtime experience platform**

    Pub/sub messaging, presence, history, guaranteed message delivery.

    **Best for:** Mission-critical real-time, financial apps, IoT

    * Guaranteed delivery
    * Message history
    * Global edge network
    * Pub/sub messaging

    [Documentation](https://ably.com/docs)
  </Card>

  <Card title="Liveblocks" icon="users">
    **Collaborative experiences platform**

    Real-time collaboration primitives (presence, rooms, storage, comments).

    **Best for:** Collaborative apps (Figma-like), multiplayer features

    * Presence awareness
    * Real-time comments
    * Conflict-free storage
    * Collaboration SDK

    [Documentation](https://liveblocks.io/docs)
  </Card>

  <Card title="PartyKit" icon="party-horn">
    **Real-time multiplayer platform**

    Durable objects for real-time, WebSocket server on the edge.

    **Best for:** Multiplayer apps, edge-based real-time

    * Edge deployment
    * Durable objects
    * WebSocket support
    * Multiplayer-first

    [Documentation](https://docs.partykit.io)
  </Card>
</CardGroup>

## Authentication Comparison

| Provider          | Pricing       | Free Tier | Best For                   |
| ----------------- | ------------- | --------- | -------------------------- |
| **Clerk**         | Per-seat      | 10K MAU   | B2B SaaS, startups         |
| **Auth0**         | \$0.07/MAU    | 7K MAU    | Enterprise, M2M            |
| **Supabase Auth** | \$0.00325/MAU | 100K MAU  | Budget-conscious, Supabase |
| **NextAuth.js**   | Free (OSS)    | Unlimited | Self-hosting, full control |
| **Firebase Auth** | Pay-per-use   | Generous  | Mobile apps, Firebase      |
| **Lucia**         | Free (OSS)    | Unlimited | Custom flows, minimal      |
| **SuperTokens**   | Free (OSS)    | Unlimited | Self-hosting, compliance   |

## Real-time Comparison

| Solution              | Type              | Best For               | Pricing                |
| --------------------- | ----------------- | ---------------------- | ---------------------- |
| **Supabase Realtime** | Database CDC      | Database-driven apps   | Included with Supabase |
| **Socket.io**         | WebSocket library | Custom real-time logic | Free (self-hosted)     |
| **Pusher**            | Managed service   | Rapid development      | $0 - $499/month        |
| **Ably**              | Managed service   | Mission-critical apps  | Pay-as-you-go          |
| **Liveblocks**        | Collaboration SDK | Collaborative apps     | $0 - $99/month         |
| **PartyKit**          | Edge platform     | Multiplayer games      | $0 - $20/month         |

## Decision Trees

<Accordion title="Choosing Authentication">
  **B2B SaaS with beautiful UI needs?** → Clerk

  **Enterprise with M2M auth?** → Auth0

  **Budget-conscious or using Supabase?** → Supabase Auth

  **Need full control & self-hosting?** → NextAuth.js

  **Mobile app with Firebase?** → Firebase Auth

  **Want minimal abstraction?** → Lucia

  **Compliance & self-hosting?** → SuperTokens
</Accordion>

<Accordion title="Choosing Real-time Solution">
  **Using Supabase already?** → Supabase Realtime

  **Need custom WebSocket logic?** → Socket.io

  **Want fully managed solution?** → Pusher or Ably

  **Building collaborative apps?** → Liveblocks

  **Multiplayer game on the edge?** → PartyKit

  **Mission-critical financial app?** → Ably
</Accordion>

## Social Login Support

All major auth providers support these social logins:

* Google
* GitHub
* Facebook
* Twitter/X
* Apple
* Microsoft/Azure AD
* Discord
* Spotify
* Twitch
* LinkedIn

**Implementation varies:**

* **Clerk** → Pre-built UI components
* **Auth0** → Social connections config
* **Supabase** → OAuth provider setup
* **NextAuth.js** → Provider configuration
* **Firebase** → Google provider optimized

## WebSocket vs Supabase Realtime

<Tabs>
  <Tab title="WebSockets (Socket.io)">
    **Custom real-time logic**

    **Pros:**

    * Full control over messages
    * Custom event handling
    * Rooms & namespaces
    * Works with any backend

    **Cons:**

    * More code to write
    * Need to manage connections
    * Scaling can be complex

    **Use when:** You need custom real-time logic separate from database
  </Tab>

  <Tab title="Supabase Realtime">
    **Database-driven real-time**

    **Pros:**

    * Zero configuration
    * Automatic from database changes
    * PostgreSQL Row-Level Security
    * Scales automatically

    **Cons:**

    * Tied to Supabase
    * Limited to database changes
    * Less flexible for custom events

    **Use when:** Real-time needs match database operations
  </Tab>
</Tabs>

## Recommended Combinations

<Steps>
  <Step title="Full Supabase Stack">
    **Supabase Auth** + **Supabase Realtime** + **Row-Level Security**

    Perfect for: SQL-first apps with integrated auth and real-time
  </Step>

  <Step title="Next.js Full-Stack">
    **Clerk** + **Pusher** or **Liveblocks**

    Perfect for: B2B SaaS with collaborative features
  </Step>

  <Step title="Budget-Conscious">
    **NextAuth.js** + **Socket.io** (both self-hosted)

    Perfect for: Startups minimizing costs
  </Step>

  <Step title="Enterprise">
    **Auth0** + **Ably**

    Perfect for: Mission-critical apps with compliance needs
  </Step>
</Steps>
