Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks
foyarash opened this issue Oct 3, 2024 · 0 comments
Open
5 tasks

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

foyarash opened this issue Oct 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@foyarash
Copy link
Collaborator

foyarash commented Oct 3, 2024

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.

  • Create a generator for Drizzle
  • Create a helper function for other kind of generators to generate schemas in the right file
  • Create a type generator that would either use Prisma or Drizzle types
  • Create an adapter logic
  • Create Prisma and Drizzle adapters

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 };
@foyarash foyarash added the enhancement New feature or request label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant