# Supabase

{% @github-files/github-code-block url="<https://github.com/BitBadges/bitbadges-supabase-demo>" %}

This repository is a basic example for getting started with Supabase and Sign in with BitBadges. It is meant to be a starting point and is not production ready.

This example:

* Uses the Next.js x Supabase template
* Uses traditional Supabase authentication and once signed in, you can additionally Sign In with BitBadges. This effectively creates a username <-> address mapping that you can use.

<figure><img src="https://2198930329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7R34Y0QZwgpUGaJnJ4dq%2Fuploads%2Fgit-blob-8b2a5f406d7ce9e2d376a60ba3e1935e5cb5a17b%2Fimage%20(398).png?alt=media" alt=""><figcaption></figcaption></figure>

Anything else is left as an exercise for you.

* Gating the entire site rather than using traditional authentication
* Gating specific pages / implementing your utility
* Linking claims

Note: Supabase is flexible. You may choose to implement it via Express, Auth0, or another way as well. This is just a reference to help you get started.

**Setup**

1. Setup Supabase as explained via their documentation
2. Add your BitBadges API key, client ID, and client secret to your .env
3. Execute the SQL in supabase/migrations folder to setup the tables. This can be done via the SQL Editor in the dashboard.
