Web3 Wallet Login for Self-Hosted Supabase: Setup Guide

Enable Sign in with Solana and Ethereum wallets on self-hosted Supabase. GoTrue env vars, client code, CAPTCHA protection, and trade-offs explained.

Cover Image for Web3 Wallet Login for Self-Hosted Supabase: Setup Guide

Email and OAuth cover most apps, but if you're building anything in the crypto space — an NFT marketplace, a token-gated community, a DeFi dashboard — your users expect to sign in with the wallet they already have. Supabase shipped Sign in with Web3 for exactly this: wallet-signature authentication for Solana and Ethereum, built on the EIP-4361 standard. The good news for self-hosters is that it's not a cloud-only feature. It lives entirely inside the Auth (GoTrue) service, which means it works on your own stack — once you flip the right environment variables.

This guide covers enabling Web3 auth on a self-hosted deployment, the client-side code, the abuse-protection settings you should not skip, and the honest trade-offs of accounts that have no email address. If you're new to configuring auth on your own instance, the auth providers documentation is a good companion reference.

How Sign in with Web3 Actually Works

Unlike OAuth, there's no third-party identity provider involved. The flow is cryptographic:

  1. Your frontend asks the user's wallet (Phantom, MetaMask, Solflare, etc.) to sign a structured plaintext message containing your app's domain, a nonce, and a timestamp.
  2. The signed message is sent to your Auth server.
  3. GoTrue verifies the signature against the wallet's public key, checks the domain and timestamp, and issues a standard Supabase JWT.

The message format follows Sign in with Ethereum (EIP-4361), and Solana support uses the equivalent Sign in with Solana (SIWS) convention. Because the wallet displays the domain in the signing prompt — and warns if it doesn't match the page the user is on — replay attacks from other sites are blocked at the UX level as well as server-side.

The result is a normal Supabase user with a web3 identity. Row Level Security, policies, and the rest of your stack treat them like any other user. The wallet address is available in the identity data, so you can key on-chain lookups off it directly.

One thing worth internalizing before you enable this: a Web3 user has no email and no phone number. That has real consequences, which we'll get to.

Prerequisites

  • A self-hosted Supabase stack with an Auth image from mid-2025 or later. Solana support landed first, with Ethereum following shortly after — if your supabase/auth image is older, upgrade it first. Our version upgrade guide walks through doing that safely.
  • supabase-js v2.49+ on the client.
  • A correctly configured SITE_URL and redirect allow list — wallet signing prompts validate your domain, so a misconfigured site URL produces confusing wallet warnings. See our guide on redirect URLs and Site URL configuration if you haven't locked this down.

Enabling Web3 Auth on Your Stack

On a Docker Compose deployment, Web3 providers are controlled by two GoTrue environment variables. Add them to the auth service (or your shared .env):

auth:
  environment:
    # Enable Sign in with Solana
    GOTRUE_EXTERNAL_WEB3_SOLANA_ENABLED: "true"
    # Enable Sign in with Ethereum
    GOTRUE_EXTERNAL_WEB3_ETHEREUM_ENABLED: "true"

Then recreate the service:

docker compose up -d auth

That's genuinely all the server-side setup — no client IDs, no secrets, no callback URLs to register with a third party. It's the simplest provider Supabase ships, because there's no external provider at all.

A common stumble here: the GitHub issues around self-hosted Web3 setups show people setting dashboard-style config names or SOLANA_ENABLED and wondering why nothing happens. Self-hosted GoTrue only reads the GOTRUE_-prefixed variables above. If you're unsure how env vars flow through the stack, our self-hosted environment variables guide covers the full map.

For local development with the Supabase CLI, the equivalent lives in your config file:

[auth.web3.solana]
enabled = true

[auth.web3.ethereum]
enabled = true

Note that CLI v3.4 generates config.jsonc instead of config.toml for new projects — the keys are the same, the syntax isn't. Our CLI v3 upgrade guide covers that transition.

The Client-Side Code

With the server enabled, sign-in is one call. For Solana, supabase-js will use the wallet standard provider (e.g. Phantom) available in the browser:

const { data, error } = await supabase.auth.signInWithWeb3({
  chain: 'solana',
  statement: 'I accept the Terms of Service at https://yourapp.com/tos',
});

For Ethereum, it uses the injected EIP-1193 provider (e.g. MetaMask):

const { data, error } = await supabase.auth.signInWithWeb3({
  chain: 'ethereum',
  statement: 'I accept the Terms of Service at https://yourapp.com/tos',
});

The statement appears in the wallet's signing prompt, so make it human-readable — it's the closest thing this flow has to a consent screen. On success you get a normal Supabase session; data.user.identities contains the wallet address and chain, which you can mirror into a profiles table with a trigger if you want it queryable.

Do Not Skip Abuse Protection

Here's the part most tutorials gloss over: wallet creation is free and instant. Unlike email sign-up (which requires a mailbox) or OAuth (which requires an account with Google or GitHub), an attacker can generate thousands of keypairs per second and turn your sign-in endpoint into a user-table firehose. Supabase's own docs are blunt about this, and self-hosters don't get the platform-level bot filtering that fronts the cloud offering.

Two mitigations, both of which you should treat as mandatory:

1. Enable CAPTCHA. GoTrue supports Cloudflare Turnstile and hCaptcha, and the challenge applies to Web3 sign-ins:

auth:
  environment:
    GOTRUE_SECURITY_CAPTCHA_ENABLED: "true"
    GOTRUE_SECURITY_CAPTCHA_PROVIDER: "turnstile"
    GOTRUE_SECURITY_CAPTCHA_SECRET: "${CAPTCHA_SECRET}"

We've published a full walkthrough of CAPTCHA protection for self-hosted Supabase, including the client-side token wiring — the flow is identical for Web3.

2. Rate limit the endpoint. GoTrue exposes a dedicated knob for Web3 sign-ins:

GOTRUE_RATE_LIMIT_WEB3: "30"

That caps Web3 attempts per 5-minute window per IP. Pair it with gateway-level limits — our guide on API rate limiting and security covers layering this at the proxy, which matters more now that Envoy is the default gateway for new self-hosted stacks.

The Trade-Offs, Honestly

Web3 auth is elegant, but accounts without email addresses change some assumptions:

  • No password recovery, no magic links, no email comms. If the user loses their wallet, they lose the account. There is nothing to reset. For some products that's acceptable; for anything with billing attached, it probably isn't.
  • You'll likely want identity linking. The pragmatic pattern is wallet-first sign-up, then prompting users to attach an email later. Supabase supports this natively — see our identity linking setup guide.
  • Signature proves key possession, not humanity. Hence the CAPTCHA section above. Budget for junk users in your metrics regardless.
  • One wallet ≠ one person. Users routinely hold multiple wallets. If your data model assumes one account per human, decide early whether wallets map to accounts or to linked identities.

None of these are self-hosting-specific — cloud users face the same model — but self-hosters own the cleanup when a bot wave hits, so the protections are on you.

Managing Auth Config Across Projects

If you run one project, editing docker-compose.yml and bouncing the auth container is a five-minute job. If you run several — client projects, staging and production, a side project per idea — hand-editing env files on each server is where config drift starts: Web3 enabled here, CAPTCHA forgotten there.

This is the workflow Supascale is built around: auth provider configuration through a UI, environment management per project, and a REST API to script changes across instances, on servers you own. One license covers unlimited projects, so adding a wallet-login experiment next to your production apps doesn't cost anything extra.

Wrapping Up

Enabling wallet login on self-hosted Supabase is two environment variables and one client call — by far the lowest-friction auth provider in the stack, because there's no external provider to register with. The real work is operational: enable CAPTCHA before you ship, set the Web3 rate limit, get your Site URL right so wallet prompts don't scare users, and plan for the fact that your users have no email address until they link one. Do those four things and you have a production-grade wallet login on infrastructure you control.

Further Reading