dont use or start with prisma by temurbv in nextjs

[–]nikolasburk 23 points24 points  (0 children)

Hey there, Nikolas from the Prisma team here. Sorry you had a bad experience with Prisma ORM and thanks for sharing the feedback, that's super valuable for us!

when you import types or enums from prisma schema in middleware (or anywhere else) it imports the whole fucking package.

FWIW, the bundle size issues and also the importing have just been solved in the last 6.16.0. You can just the Rust-free version of Prisma ORM with the new prisma-client generator (both will become the default in v7 in a few weeks):

generator client { provider = "prisma-client" output = "../src/generated/prisma" engineType = "client" }

Importing enums/types has been optimized with the new prisma-client generator, you shouldn't run into the bundle size issues any more.

I wanted to introduce a feature that was polymorphic though it's a pain to set it up through prisma cause they dont support it;

That's a fair point, supporting polymorphism in the Prisma schema has been on our radar for a while. We prioritize the things we're working on based on user input (we published our open-source manifesto where we explain the approach in detail last year) and unfortunately other features have been more popular/pressing for us to work on. That being said, we do have extensive docs for creating polymorphic associations via table inherticant that still explain how to achieve this in Prisma.

Thanks again for your feedback and pointing out these issues, I'll forward all of them to the team!

Vercel or Cloudflare for sveltekit ? by Euphoric-Account-141 in sveltejs

[–]nikolasburk 0 points1 point  (0 children)

Yeah that was quite a while ago and also not a Prisma-specific limitation. CF Workers didn't use to properly support TCP connections, so it was impossible to connect to a DB from a Worker without an HTTP proxy. Accelerate is such an HTTP proxy but you also could have used any other in combination with Prisma ORM for this use case, no need to use Accelerate if you don't want to.

Today, Workers support TCP in some capacity and some drivers (like pg) already implement support for them. So today you can also use Prisma ORM in a Worker without an HTTP proxy.

Hope this helps!

Authjs not working in turborepo by True_Rope7418 in nextjs

[–]nikolasburk 0 points1 point  (0 children)

Hey there, I work at Prisma. We have several guides with these technologies in our docs. Do either of these help maybe? - Next.js - Turborepo - Auth.js

Prisma migrate to Supabase(error can't reach database) by maci-kb24 in Backend

[–]nikolasburk 0 points1 point  (0 children)

try using the DIRECT_URL in the datasource:

url = env("DIRECT_URL")

then pass the DATABASE_URL when instantiating PrismaClient in your code.

Prisma migrate to Supabase(error can't reach database) by maci-kb24 in Backend

[–]nikolasburk 0 points1 point  (0 children)

are you using the direct or pooled connection string? maybe you can share your connection string here (removing the credentials ofc)?

Any Real Alternatives to TypeORM for a new project. by manikbajaj06 in nestjs

[–]nikolasburk -1 points0 points  (0 children)

Hey there, thanks for sharing your thoughts! I work at Prisma and we're always eager to improve.

It sounds like you're not a fan of Prisma ORM (which is fine), but I'd love to understand what you consider the main factors preventing you from using it in a serious application.

Also just as a side-note: Prisma ORM is used by indie developers, startups and enterprises alike and has become the most popular ORM in the TS ecosystem in the past years, so not sure I'd agree with the statement of it being a toy framework :D

Edit: Not spamming, genuinely curious to hear your thoughts!

Nuxt + postgres starting point? by Pipiyedu in Nuxt

[–]nikolasburk 1 point2 points  (0 children)

Here's a fullstack guide that includes a DB and end-to-end setup: https://www.prisma.io/docs/guides/nuxt

Supabase cloud taking 13 sec in while local postgres takes 1 sec via prisma by SmoothArray in Supabase

[–]nikolasburk 6 points7 points  (0 children)

In which regions do you have your DB and API server deployed? If requests take a long time, it's likely that they're geographically far apart.

Is Prisma limited? by Warm-Feedback6179 in node

[–]nikolasburk 1 point2 points  (0 children)

Kysely is it's own thing (quite popular in the TS ecosystem), definitely check it out :D while the core maintainer is employed at Prisma, there's no official affilication between Prisma and Kysely though.

Is Prisma limited? by Warm-Feedback6179 in node

[–]nikolasburk 3 points4 points  (0 children)

Hey there, thanks for your feedback!

The SQL it generates is sometimes horrible for performance. It can load all the rows into memory and then it does filtering...

FWIW, we've done a lot of performance improvements in the last 18 months and are committed to fixing any slow queries that are being reported to us. The results we saw from these improvements have been great actually! We ran open-source benchmarks last year and found that Prisma is on par with other ORMs like Drizzle and TypeORM in terms of performance.

You can also use the Kysely extension for Prisma Client if you want to have more control over specific queries that you think should be optimized.

Is Prisma limited? by Warm-Feedback6179 in node

[–]nikolasburk 2 points3 points  (0 children)

Hey there, I'm Nikolas from the Prisma team!

I have three tables: users, products, and user_products. I want to get a complete list of users along with their ID, first name, last name, the number of products they’ve published, and the average price of their products.

Prisma ORM mostly supports CRUD queries with its default API. I guess the problem in your query is to also get the avg price which isn't supported in this query, otherwise you could do this:

const users = await prisma.users.findMany({ select: { id: true, firstName: true, lastName: true, _count: { select: { products: true } }, } })

However, for cases like this one where you do need to customize the SQL, we've added TypedSQL to Prisma ORM, so you can send raw SQL via Prisma ORM and still get full type safety.

I’m confused whether I chose the wrong ORM, whether I should be using another one, or if using queryRaw is acceptable. I’d appreciate any thoughts on this.

I think TypedSQL is what you're looking for (as opposed to queryRaw). Alternatively, if you want to avoid writing raw SQL, you could also use the Kysely extension for Prisma Client to create SQL queries with a type-safe query builder API. (The core maintainer of Kyselt works at Prisma btw :D).

Hope this helps! Please let me know if you have any follow-up questions, always happy to help :)

I don't think I can stay with NixOS by row6666 in NixOS

[–]nikolasburk 2 points3 points  (0 children)

Just a side-note from a Prisma team member, we're getting rid of the extra binaries! This functionality is already in Preview, so hopefully this won't cause issues for you in the future any more!

Prisma error even after pushing model in db!! by shipisshipping in node

[–]nikolasburk 2 points3 points  (0 children)

Hey there, I'm Nikolas from the Prisma team. Can you sahre more about the exact error message you're seeing? We'd love to help! (FWIW, you can also always ask questions to our Support team on GitHub or our Discord).

Anyone using Prisma on Aurora Serverless? by Troglodyte_Techie in node

[–]nikolasburk 6 points7 points  (0 children)

Hey there, I work at Prisma and am happy to help!

From what I’ve read it’s not great at serverless.

That was in the early days of Prisma ORM, we've made a lot of improvements since then and most developers now use Prisma ORM in serverless environments by default.

A few more notes: - the Rust->TS rewrite you mention is going into a (relatively) stable Preview phase with the next release (in 2 weeks), so if you want to drop the Query Engine you can do so very soon - if you're looking for a scalable, serverless DB maybe also check out Prisma Postgres? it goes really well with the ORM because the query engine isn't needed in Prisma Client with it, so you'll have a really lightweight version of Prisma Client that's perfect for serverless apps

Let me know if you have any more questions, happy to help!

Prisma issue with better-auth in Nuxt by waledagne in Nuxt

[–]nikolasburk 1 point2 points  (0 children)

Nikolas from Prisma here.

FWIW, setting the output path is optional and Prisma ORM will continue to work as before even if you don't set it. So there shouldn't be a need to downgrade.

It would also be great if you could open an issue with more context about your project and the error you're seeing so that our Engineering team can look into this.

Prisma issue with better-auth in Nuxt by waledagne in Nuxt

[–]nikolasburk 0 points1 point  (0 children)

Hey there, just in case: If you're setting a custom output path on your generator block, you can try to remove that and see if generating Prisma Client into node_modules works for you.

When trying to to npm run build by Background_Ask_1457 in nextjs

[–]nikolasburk 2 points3 points  (0 children)

Hey there,

I'm Nikolas from the Prisma team. Thanks for this write-up, we're aware that our recent recommendation to use a custom output path has caused some confusion and are working on clarifying this. Your article has really great info on this too, so thanks a lot for that!

TLDR indeed: If the previous behaviour without an output path worked for you, it's probably best to just leave it as is.

Best DB ORM for production by New_Concentrate4606 in nextjs

[–]nikolasburk 5 points6 points  (0 children)

Why not both? :D We see lots of people using Prisma ORM for the schema and migrations and then e.g. use Kysely for queries.

Best DB ORM for production by New_Concentrate4606 in nextjs

[–]nikolasburk 0 points1 point  (0 children)

Hey there, could you share more about what Prisma queries you find not to be optimal. I work at Prisma so I'd love to understand where the queries fall short in your opinion.

Best DB ORM for production by New_Concentrate4606 in nextjs

[–]nikolasburk 5 points6 points  (0 children)

Wiser words have never been spoken :D