Please Don't Neglect Prisma; Request Jstack Not to Force Drizzle-ORM Binding
I'm a big fan of your work and appreciate the effort you put into jstack. I'm writing to suggest some improvements regarding ORM integration.
While Drizzle-ORM is a solid performer and might offer advantages in certain areas, forcing its use within Jstack is limiting. Many developers rely on Prisma, TypeORM, or other ORMs in their projects. A mandatory Drizzle-ORM integration creates friction for these users.
I propose the following:
-
Decouple: Remove the hard dependency on Drizzle-ORM.
-
Examples: Showcase Drizzle-ORM integration as one example within the official documentation and example repository. Crucially, add examples demonstrating integration with other popular ORMs like Prisma and TypeORM. This would provide a more realistic and inclusive view of how Jstack can be used.
-
Optional: Allow users to configure their preferred ORM. This could be achieved through configuration files or environment variables.
I agree. I didn't like how they added drizzle and but not prisma. But maybe he didn't have the time to add. Anyway 1 is better than None :)
You can implement prisma really easily using the neon adapter for it, the same way that they do the db middleware for drizzle.
Hi @joschan21, Is there any planned integration with Prisma in the near future? Also, is there a way to set it up manually in the meantime?
For anyone wondering how easy it is, just like with drizzle-orm, it isnt built into jstack you add it yourself. It is this easy.
// src/lib/prisma.ts
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
export const getPrisma = (database_url: string) => {
const prisma = new PrismaClient({
datasourceUrl: database_url,
}).$extends(withAccelerate());
return prisma;
};
then you add it to your app like so in a middleware for jstack
// src/server/jstack.ts
// rest of code
const dbMiddleware = j.middleware(async ({ c, next }) => {
const { DATABASE_URL } = env(c);
const db = getPrisma(DATABASE_URL);
return await next({ db });
});
export const publicProcedure = j.procedure.use(dbMiddleware);