Create Prisma Generator Save

Get started developing your own ◭ Prisma generator by running a single command.

Project README

Banner Image



Usage   •   Blog   •   Architecture

⚠️ Note

create-prisma-generator doesn't support Prisma 4 yet, it works with Prisma 3, but that doesn't mean that you can't upgrade on your own quite smoothly.

Any contributions to support Prisma 4 in the create-prisma-generator are highly appreciated and will be part of the authors/contributors section of this tool.

Prisma

Prisma is Database ORM Library for Node.js, Typescript.

Prisma has a concept called "Generator". A generator is an executable program, which takes the parsed Prisma schema as an input and has full freedom to output anything.

The most prominent generator is called prisma-client-js. It's the ORM Client powering the main TypeScript and JavaScript usage of Prisma from Node.js.

Generators will always be called when you run prisma generate. However, only the generators mentioned in the schema.prisma file are being run.

Strongly recommend reading the full article, It's pretty damn good

Motivation

As a community, developing prisma generators is really hard cause that's a very new concept to us so It's like knowing JS but being exposed to do ML with it for the first time and there is nothing documented about @prisma/sdk (this is done intentionally) which has a very great utilities when developing or testing prisma generators and the only way you can get started is by looking at other generators code which might be useful to get you started.

I'm really obsessed with this architecture that Prisma Client is built on and I can see a bright future for Prisma Generators from the community to integrate Prisma nicely with different frameworks or make tools that can beneift from Prisma models.

But unfortunately I didn't have a smooth experience developing my prisma generator.

So I created this CLI to encourage developers to make their own prisma generators to have a smooth experience with all of the annoying repetitive things carried away like: getting started boilerplate, publishing, testing the gen locally by running prisma generate, ..etc

Also Created a blog on dev.to where we're gonna be discussing the hello world prisma generator together that this CLI has setup for you and the different concepts you'll come across when developing prisma generators, Check It out here

Usage

Answer the prompt questions to setup your project, The project setup will be based on your answers.

npx create-prisma-generator

What’s Included?

Your environment will have everything you need to build your prisma generator like an elite open-source maintainer:

  • Hello World Prisma Generator.
  • Typescript Support.
  • JavaScript setup with babel to enable the usage of the latest JS features.
  • Automatic publishing workflow with Github Actions.
  • Workspace setup for testing the generator locally using prisma generate.
  • Scripts for development, building, packaging and testing.
  • Support for most package-managers yarn, pnpm and npm.
  • Automatic semantic release with safety in mind using commitlint & husky to validate your commit messages.
  • Test environment using Jest with an example & fixtures to help you get started.
  • Dependabot for keeping dependencies up to date.

Architecture

Read Architecture.md to understand how everything is working.

Prisma SDK reference

Read Prisma_SDK_Reference.md

Community

The Create Prisma Generator community can be found on GitHub Discussions, where you can ask questions, suggest ideas, and share your projects.

Contributing

We'll be very thankful for all your contributions, whether it's for helping us find issues in our code, highlighting features that're missing, writing tests for uncovered cases, or contributing to the codebase.

Read the Contributing guide to get started.

💚 All Thanks to Prisma's brilliant developers for making such an awesome Node.js ORM that can be easily built on top of it.

Open Source Agenda is not affiliated with "Create Prisma Generator" Project. README Source: YassinEldeeb/create-prisma-generator

Open Source Agenda Badge

Open Source Agenda Rating