<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dev Garg on Medium]]></title>
        <description><![CDATA[Stories by Dev Garg on Medium]]></description>
        <link>https://medium.com/@gargdev010300?source=rss-4b7014a2e380------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TLl2NOTmzqNipMxd</url>
            <title>Stories by Dev Garg on Medium</title>
            <link>https://medium.com/@gargdev010300?source=rss-4b7014a2e380------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 08:28:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gargdev010300/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Configured Prisma 7 (New Changes, Issues, and How I Solved Them)]]></title>
            <link>https://medium.com/@gargdev010300/how-i-configured-prisma-7-new-changes-issues-and-how-i-solved-them-d5ca728c5b9f?source=rss-4b7014a2e380------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5ca728c5b9f</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dev Garg]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 19:24:43 GMT</pubDate>
            <atom:updated>2025-11-27T19:24:43.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlqf8yMmOxSRtViZ7lt2OQ.png" /></figure><p>Prisma 7 is a very recent release (Nov 19, 2025), and when I tried setting it up for the first time, I couldn’t find <strong>a single blog or tutorial</strong> that explained the configuration changes properly.<br> So, I decided to write this guide based on my own experience — after reading the Prisma docs, exploring the declaration files generated in my project, and debugging multiple errors.</p><p>This was also my first time using Prisma. Until now, I had always worked with <strong>MongoDB + Mongoose</strong>, so switching to SQL and Postgres meant I needed to learn an ORM. Prisma is the most popular one, so naturally, I picked it.</p><p>But very quickly I realized that almost every resource available online — YouTube tutorials, blogs, GitHub examples — was based on <strong>Prisma v6 or earlier</strong>. Version 7 has some important breaking changes, so I had to figure things out on my own.</p><p>Here’s everything I learned.</p><h3>1. First Big Change: prisma.config.ts</h3><p>After installing Prisma, the very first thing I noticed was a completely new file that Prisma generates automatically:</p><pre>prisma.config.ts</pre><p>Earlier, the database connection string (DATABASE_URL) lived inside schema.prisma.<br> Now, Prisma has moved it into this new prisma.config.ts file.</p><p>Here is what Prisma generated for me:</p><pre>// This file was generated by Prisma and assumes you have installed the following:<br>// npm install --save-dev prisma dotenv<br>import &quot;dotenv/config&quot;;<br>import { defineConfig, env } from &quot;prisma/config&quot;;<br><br>export default defineConfig({<br>  schema: &quot;prisma/schema.prisma&quot;,<br>  migrations: {<br>    path: &quot;prisma/migrations&quot;,<br>  },<br>  datasource: {<br>    url: env(&quot;DATABASE_URL&quot;),<br>  },<br>});</pre><h3>What changed?</h3><ul><li>The env(&quot;DATABASE_URL&quot;) is <strong>no longer inside </strong><strong>schema.prisma</strong>.</li><li>All environment-related configuration is now moved to this new file.</li><li>The schema file stays cleaner and only contains models.</li></ul><h3>2. Fixing tsconfig.json Root Directory Issue</h3><p>If your tsconfig.json has this:</p><pre>&quot;rootDir&quot;: &quot;./src&quot;</pre><p>TypeScript will get angry because prisma.config.ts is outside the src folder.</p><p>The fix is simple:</p><pre>&quot;rootDir&quot;: &quot;./&quot;</pre><p>This allows TypeScript to include all files properly.</p><h3>3. Migrating and Generating the Client</h3><p>After creating my models, I ran:</p><pre>npx prisma migrate dev<br>npx prisma generate</pre><p>In the schema.prisma file it’s written that where will the generated client will be created which is in the src folder.</p><pre>generator client {<br>  provider = &quot;prisma-client&quot;<br>  output   = &quot;../src/generated/prisma&quot;<br>}</pre><p>So far everything looked fine — until I tried to initialize PrismaClient.</p><h3>4. The Most Confusing Error: “Expected 1 argument, got 0”</h3><p>When I wrote this:</p><pre>const prisma = new PrismaClient();</pre><p>While writing this make sure you import PrismaClient from the client.js file and not from the class.js file.</p><p>I got an error:</p><pre>Expected 1 argument, but got 0.</pre><p>This was confusing because <strong>all tutorials</strong> online (and even some older documentation) show creating PrismaClient without arguments.</p><p>So I tried to look for the place where this PrismaClient is defined and what arguments does it wants? then i opened Prisma’s files inside my generated folder (mainly client.ts and class.ts file where about this PrismaClient was defined) and noticed that PrismaClient now expects a configuration object — specifically something called:</p><pre>accelerateURL</pre><p>This wasn’t explained anywhere clearly, so I searched the docs and then found about it.</p><h3>5. Introducing accelerateURL (New in Prisma 7)</h3><p>After digging into the docs, I understood that Prisma 7 integrates deeply with <strong>Prisma Accelerate</strong>, which is Prisma’s global caching layer + connection pooling service.</p><p>Documentation:</p><p><a href="https://www.prisma.io/docs/accelerate">Prisma Accelerate | Prisma Documentation</a></p><p>Accelerate improves performance by:</p><ul><li>Caching queries globally</li><li>Reducing latency</li><li>Handling connection pooling for serverless apps</li></ul><p>To use it, PrismaClient <strong>requires</strong> an accelerateURL.</p><h3>6. Prisma Now Provides Its Own Cloud Database</h3><p>Another new feature: Prisma now has its own cloud PostgreSQL hosting inside:</p><p><a href="https://console.prisma.io/">Prisma Data Platform</a></p><p>From the dashboard you can:</p><ul><li>Create a database</li><li>Generate an Accelerate API key</li><li>Copy your accelerateURL</li></ul><p>This is what you need to pass to PrismaClient.</p><p>The catch here is that now you won’t be able to use neon.tech as your database because after setting up the accelerate you are literally forced by the prisma to use their database because the link provided by the neon.tech starts with:</p><pre>&quot; postgresql:// &quot;</pre><p>Whereas after using the accelerateURL, it expects the connection string to start from:</p><pre>&quot; prisma:// &quot; or &quot; prisma+postgres:// &quot;</pre><p>Otherwise it will give a long error, but the main message it tries to give is:</p><pre>InvalidDatasourceError: Error validating `accelerateUrl`: the URL must <br>start with the protocol `prisma://` or `prisma+postgres://`</pre><h3>7. Final Working PrismaClient Setup (Prisma 7)</h3><p>Here’s the correct configuration:</p><pre>import { withAccelerate } from &quot;@prisma/extension-accelerate&quot;;<br>import { PrismaClient } from &quot;../src/generated/prisma/client.js&quot;;<br>import { DATABASE_URL } from &quot;../config/index.js&quot;;<br><br>export const prisma = new PrismaClient({<br>  accelerateUrl: DATABASE_URL as string<br>}).$extends(withAccelerate());</pre><h3>What is $extends?</h3><p>Prisma uses $extends() to enable additional features like Accelerate.<br>This is documented here:</p><p><a href="https://www.prisma.io/docs/accelerate/getting-started">Getting started with Prisma Accelerate | Prisma Documentation</a></p><h3>8. Important Note: Two Environment Variables Needed</h3><p>In Prisma 7, you must define:</p><h4>DATABASE_URL → Your Accelerate URL</h4><h4>DIRECT_DATABASE_URL → Your actual PostgreSQL connection string</h4><p>Your prisma.config.ts should use DIRECT_DATABASE_URL like this:</p><pre>export default defineConfig({<br>  schema: &quot;prisma/schema.prisma&quot;,<br>  migrations: {<br>    path: &quot;prisma/migrations&quot;,<br>  },<br>  datasource: {<br>    url: env(&quot;DIRECT_DATABASE_URL&quot;),<br>  },<br>});</pre><p>Then run migrations again:</p><pre>npx prisma migrate dev<br>npx prisma generate</pre><p>Now everything works smoothly.</p><h3>Conclusion</h3><p>This was my full experience setting up Prisma 7.<br>Because this version is so new, there are almost no tutorials or videos covering these changes — especially around accelerateURL, $extends, and the new prisma.config.ts file.</p><p>If you are switching from Prisma 6 or learning Prisma for the first time like me, these changes can be confusing. But once you understand how Accelerate integrates with PrismaClient, the setup becomes much clearer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5ca728c5b9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>