<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Max</title>
    <description>The latest articles on Forem by Max (@madebymax).</description>
    <link>https://forem.com/madebymax</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3545854%2Fd32f6ff2-e85a-4316-a24e-8926fbd9db17.JPG</url>
      <title>Forem: Max</title>
      <link>https://forem.com/madebymax</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/madebymax"/>
    <language>en</language>
    <item>
      <title>Setting up Prisma and Supabase in your Next.js app</title>
      <dc:creator>Max</dc:creator>
      <pubDate>Fri, 03 Apr 2026 04:03:00 +0000</pubDate>
      <link>https://forem.com/madebymax/setting-up-prisma-and-supabase-in-your-nextjs-app-7a9</link>
      <guid>https://forem.com/madebymax/setting-up-prisma-and-supabase-in-your-nextjs-app-7a9</guid>
      <description>&lt;p&gt;Next.JS, Supabase, and Prisma are a pretty commonly recommended tech stack, using Next.JS as a Fullstack framework, Supabase as a database, and Prisma as an ORM (Object Relational Mapper) that translates the data from the Supabase into objects.&lt;/p&gt;

&lt;p&gt;When I was trying to get them all working together it was surprisingly hard to find accurate integration steps. Most blog posts I could find were out of date, and even Google’s AI overview and Supabase’s documentation had outdated information. So here’s the steps I took to get everything working as of April, 2026.&lt;/p&gt;

&lt;p&gt;1. Install your Next.JS app. Customize your settings as you see fit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install prisma @prisma/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Install Prisma in your project directory and then initialize Prisma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install prisma @prisma/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3. Sign up for a &lt;a href="https://supabase.com/" rel="noopener noreferrer"&gt;Supabase account&lt;/a&gt; and create a new project if you haven’t already. Make sure you save your database password somewhere safe - you’ll need that later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F178khealky3av4h5tuy1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F178khealky3av4h5tuy1.png" alt="a screenshot of the supabase create new project page&amp;lt;br&amp;gt;
" width="732" height="772"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4. Find the Connections section in Supabase and select ORM connections and make sure Prisma is selected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fip0vaxfc89hs2mkg1afy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fip0vaxfc89hs2mkg1afy.png" alt="a screenshot of the connections page in supabase&amp;lt;br&amp;gt;
" width="800" height="1233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. Copy the DATABASE_URL and DIRECT_URL into the .env file in your project folder, replacing [YOUR-PASSWORD] with your Supabase password.&lt;/p&gt;

&lt;p&gt;6. Go to your prisma.config.ts file and change datasource from DATABASE_URL to DIRECT_URL. Note that this was a &lt;a href="https://www.prisma.io/docs/orm/reference/prisma-config-reference#datasourceurl" rel="noopener noreferrer"&gt;change in Prisma ORM v7&lt;/a&gt;. In older versions of Prisma you could add both your database and direct URLs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuml740igefsu6f4mk8je.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuml740igefsu6f4mk8je.png" alt="a screenshot of the prisma.config file&amp;lt;br&amp;gt;
" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7. Create your Prisma schema in the schema.prisma file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmawsibwipk4pxv7m8vgn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmawsibwipk4pxv7m8vgn.png" alt="a screenshot of the schema.prisma file with the schema added&amp;lt;br&amp;gt;
" width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8. Upload your schema to Supabase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma migrate dev --name init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should now see your tables updated in Supabase!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6ycycvrxdcw48nrp26y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6ycycvrxdcw48nrp26y.png" alt="a screenshot of the created tables in supabase&amp;lt;br&amp;gt;
" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to make any changes or updates to your Prisma schema run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma db push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9. Generate the client API&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prisma generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10. Once you’re ready to start sending or querying data through the API you’ll want to change your datasource back to “DATABASE_URL”&lt;/p&gt;

&lt;p&gt;Now you should be all set to start interacting with your new database!&lt;/p&gt;

</description>
      <category>fullstack</category>
      <category>webdev</category>
      <category>prisma</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
