premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
321 stars 19 forks source link

[FEATURE] - Make Next-Admin ORM agnostic #463

Open foyarash opened 1 month ago

foyarash commented 1 month ago

Summary

Currently, Next-Admin is made to work only with Prisma. This is limiting for users that uses other ORMs such as Drizzle, and more largely query libraries like knex, or even more low level libs like pg.

Now that we are able to use the lib without depending on the Prisma DMMF, we should be able to abstract the CRUD queries that are made on the server and extract the Prisma logic in its own adapter.

Basic Example

const adapter = new PrismaAdapter(prismaInstance)

const { run } = createHandler({
  apiBasePath: "/api/admin",
  options,
  adapter,
});

export { run as DELETE, run as GET, run as POST };