ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข4y agoโ€ข
1 reply
PlayWolf

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
User
-Model in my
prisma.schema
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
prisma.schema
to reference users and their data.

For reference, here is (a part of) my
prisma.schema
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
}
/// 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
User
-Model, or would I scrap that entirely? What would the
Artist
Artist
-Model reference instead?
And how would I have to setup the
api/functions/auth.ts
api/functions/auth.ts
from RedwoodJS, so it would work with the users from Supabase?

Thanks in Advance!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Supabase with ReactJS and Prisma
SupabaseSSupabase / help-and-questions
4y ago
How to use Prisma with Supabase Auth?
SupabaseSSupabase / help-and-questions
4y ago
PrismaV7 + Supabase
SupabaseSSupabase / help-and-questions
2mo ago
Prisma and Supabase Schema
SupabaseSSupabase / help-and-questions
3y ago