Redwood Auth with Supabase and Prisma

Hey there!
I recently switched my application to vercel and supabase (note: it is not yet production-ready, still very deep in development). I managed to get vercel and supabase running, I also managed to get RedwoodJS working with supabase. Though I did ran into a "problem":

I currently have a
User
-Model in my
prisma.schema
. Though I did notice that Supabase has their own system for users, which in return allows for authentication with google, github, etc.. I do want to use this, though I am not sure on how I should implement the authentication-logic with Redwood, and how I need to adjust my
prisma.schema
to reference users and their data.

For reference, here is (a part of) my
prisma.schema
-file:

/// The User model
model User {
  id                  String    @id @default(cuid())
  email               String    @unique
  username            String    @unique

  // Previously used for dbAuth, will be removed.
  hashedPassword      String
  salt                String
  resetToken          String?
  resetTokenExpiresAt DateTime?

  artist              Artist?
  createdAt           DateTime  @default(now())
  updatedAt           DateTime  @updatedAt
}

/// The artist profile of a user. It contains information about tags, commission packages, etc.
model Artist {
  id          String    @id @default(cuid())
  /// An artist always refers to its user
  user        User      @relation(fields: [userId], references: [id])
  userId      String    @unique
  /// If an artist is well known, he may request a verification, which grants him a verification-badge so users can recognize him
  verified    Boolean   @default(false)
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
}


Do I still need a
User
-Model, or would I scrap that entirely? What would the Artist-Model reference instead?
And how would I have to setup the api/functions/auth.ts from RedwoodJS, so it would work with the users from Supabase?

Thanks in Advance!
Was this page helpful?