Video details

Prisma 2.0 Demo


Nikolas Burk

Get your ticket to our online workshops here
Follow him on twitter
Talk topic: Prisma 2.0 Demo by its Core-Team member
Nikolas Burk aka @nikolasburk


All right. So you can see my screen already, I think. And that is the cover slide of my presentation today. And it says making front end developers full stack, because you are the risk developers. You are the people that are building applications that are building the front end of these applications. But sometimes that can be helpful to also be able to to have a backend for the applications that you want to build. And when it comes to that, there are basically two main options for you. On the one hand, you could go and choose kind of a backend as a service where you can click together your entire backend, including a database, and you don't have to worry about anything. Or if you want to be a little bit more flexible in the API and in the entire backend that you're building, then you would probably go and implement it yourself. And most front end developers I know actually know how to cobble together API roads with Express or have some experience implementing a graphical schema, maybe with a pollo server. So this is typically not the problem of backend development. But the problem of Dechert of of of backend development, especially for front end developers, from what I've seen, is often the database people are not sure about the best practices and proper patterns to work with their database on the backend, with no JSM, with TypeScript. And that's exactly what this talk about, what this talk is about and what what Prisma two is here to help you with. So a quick introduction about myself. My name is Nicholas Burke. I'm talking to you from Berlin and I work in the developer success team at Prisma. So we are really making sure that people were using Prisma can reach their goals with our tools. Let's take a quick look at the agenda today. So first, I want to start with a quick introduction for everybody to get a good understanding of the problem space that we're dealing with. Then I'll talk about Prisma, too. And then finally go into a life demo. I'm going to show how you can get started with Prisma with an existing database, and then I'll show you how you can build a rest API and a graphical API just within a matter of minutes. So I have 30 minutes for this talk. Let's get started. Let's start with the introduction and the big problem that I want to talk about here. That already alluded to in the introduction is working with databases. And no, G.S. is actually really difficult. And the kind of options you have when you do that, no G.S. or TypeScript, for that matter, is that you can either go and send raw sequel's strings to your database. That's kind of at the lowest level of abstraction that you can get. You have full control over all the database operations. But on the other hand, it also comes with a lot of responsibility to actually ensure that your database queries are properly formed, that you don't have any typos in the sequel strings. So it comes with its own pitfalls. And it's certainly not the most productive way for developers to to work with a database. Then the next kind of category of tool is a sequel, CareerBuilder and examples for that. In the no day, a space would be a two like next deists or or massive Jarius. Objection, dayas. So these tools, they fall into that category. And the idea of a query builder is basically that you removed the string parred where you send raw strings to the database, but instead you can build up these sequel queries with a programmatic API. So you will have functions that are provided by this. These Krieble, the libraries that allow you to compose your own siecle statements, but you are still ultimately writing sequel. So you again have to be very, very aware of what you're doing because you're operating on a very low level and then you have object relational, my purse that you can use to work on a much higher level where you typically define your object as classes. And these kinds of tools are a lot closer to the mental model that developers half of their data because they already do define the models as classes. And that's what you're kind of used to as a developer. But they suffer from a big, big problem. That's called the object relational impedance mismatch. There is a great article about that that's called The Vietnam of Computer Science by Ted Nugent. So if you if you want to look it up and learn what that is about, I recommend that article. But this talk is not really about these different kind of categories. I just wanted to give you an overview of what the current state of the tooling is and what kind of tools you can use if you want to learn more about these. Actually, I would recommend you to go to the Prisma blog up. There is a link Priestley slash B, slash DBI access tools. And then we have a great article by my colleague talking about the different levels of abstractions that these different kettle categories of tools provide. So the solution to all of that is that Prisma makes working with databases easy. So we want to really enable Front-End developers to be able to be productive on the back end as they implement their own API eyes and be confident and productive about their database workflows. So let's talk a little bit about Prisma, too, and what it is and what it does. And a short Priefer face. Actually, I want you if if you already heard about PRISM in the past and you kind of associated with graphic. Well, at this point, I really want you to forget everything that you knew about Prisma one before. So we'll do that now. All right. Thanks. So, please, when you hear Prisma from now on. Don't think about graphics. Well, think about databases and that's exactly what Prisma is. It's an open source database tool kit that enables different database workflows and simplifies them. So they're more approachable for any kind of developer. Prisma at the moment consists of three different tools or three main tools, so to say one is Prisma Klein. And that's really going to be the focus of this talk and also of my demo later on. That's the library that allows you to talk to your database programmatically. That's Crillon in Beta. But we are very close to the general availability launch come in the next couple of weeks. And then there are two two more tools. One is called PRISM Migrate Grade and one is called Prisma Studio because I migrate. You can use to change your database schema. So you have a declarative way to define your database schema. And then with Prisma migrate, you can map this declarative schema to your database. And Prisma Studios basically agree that you can use to explore other data in your database. And that also lets you do other kind of database workflows. And the core goals of Prisma really are to boost productivity of application developers and also increase their confidence when it comes to database workflows. So how is Prisma doing that? How can it boost productivity and increase confidence? At the same time, let's take a look at a couple of benefits that Prisma provides. So first, it allows developers to think in objects instead of sequel. And for those of you who haven't worked with sequel yet, sequel has a very different way of representing data, which is called the relational model, whereas programming languages like JavaScript followed the object oriented model and the way how data is represented in these two different models is very different. So with Prisma, one big benefit is that you don't have to leave your mental model space and you can just remain in that thinking. Think of then objects and let Prisma do the heavy lifting and the translation to the sequel or for you. It also lets you work very intuitively with relations, so relations are a common issue in relational databases. When you access them from an object oriented programming language, just because the way how relations are represented in both in both models are very different and relational databases, you denote relations with foreign keys and an object oriented languages. You can just have nested objects, basically. So the structure there is very different. And then like another big benefit of prison is that it provides auto completion and type safety for database queries. And we'll actually see in the life demo how that's going to help me to to build the applications and to explore the API. So in that sense, the auto completion here can really be seen also as a replacement for reference documentation, because instead of having to looking, instead of having to look up these reference docs, I can just explore the API right inside there and my editor. And then we have this declarative and human readable database schema that is easy to parse and to understand, rather than having to read these like fairly noisy sequel's table definitions. And Prisma also provides a single source of truth for database and application models. So typically you have to take care of keeping your database layer in sync with your application code manually. And with Prisma, that happens automatically and you'll see how in just a bit. And because you're a real reac developers, you might have heard already of these two frameworks. Read what JSM Blitz today. There are two very upcoming frameworks in the community. Both are based on react. So read what is built by GetUps co-founder Tom Preston. And Werner really tries to bring the full stack to the jam stack seeks to become the new ruby on rails for no G.S. and has a baked and serverless deployment model and the data layer of choice for red. What is indeed prisma to. So if you're using Redwood, you'll also be using Prisma the same for Blitz. It's also based on Prisma to it's built on access. It allows for client side and set aside rendering and static pages all in the same app. You have full typescript of support and a flexible deployment model. That's pretty much everything I want to say until now, until this point. And when I go into the life demo where I'm going to show you what Prisma actually looks like. So let me move over here to my code and quickly show you the database that I want to get started with. In fact, I think I forgot showing you that slide. So what is going to happen in the life demo? I'm going to introspect an existing database with V. Prisma Selye that now generate my press, my client library. That allows me to access the database and I'll explore the put my client queries in a demo script with TypeScript. Then I'll implement the simple rest API. And a simple graphical API with Nexus. So let's get started. You can see the simple database here. I have three tables at the moment, post profile and user. This might be a little bit too small for you to read, but just know that I have three tables in my Posterous database at the moment. And now I'm going ahead in my project that I have open right here. This is just a very barebones typescript project with just a few dependencies which really allow me to to use typescript in a very simple way. So the first thing when using Prisma is you should be installing the Prisma SEAL. I am installing it as a development dependency. And once that's installed, I can call the prisoner in net command to create the first skeleton of my Prisma schema. So this is where I'll have the declarative version of my database schema. And in this dot and file, I can set the connection Eurail to my database, which I'll do right now. So I'm just using my local database here. And the database that I'm using is called React EU one. And once that's been properly configured, I can go back and run the Young Prisma Introspect Command, which is going to read my database schema and translated into this declarative version of the database schema right here. I wanna make a couple of adjustments to the schema because these fields that you see here, they will determine the names of things in the press. My client API. So I want to make sure that they feel feel idiomatic. So ensuring that the fields are lower cased and pluralize probably when we're talking about our list of things. Cool. With these adjustments, I'm going to now add the prismatic client and I need dependancy. And now that this is installed, there's actually read also that the schema from here and generated a custom API for me so I can now go ahead and start you using this and start sending queries to my database using this Prisma client right here. I'll instantiate it. And in fact, because I don't want to type all of that, I prepared a snippet that has the rough boilerplate for me. So here is a main function where I can send database queries and that main function is called here. So let's just go ahead and explore. That is my client API a little bit. So I'm just retrieving all the posts that are currently stored in the database. I you're going to use console, dear, and make sure that we can print nested data. So if I run this now or we'll actually see the data that is currently stored in the database. And I just quickly want to show you. Prisma studio that I can also use as a database GWE to to check for the data that I have currently stored. And we can see that the same posts that I see here in Prisma studio are also the ones that we print here. And I told you before about the auto completion of prison, my client. And that's exactly what we'll explore now. So in these five, find many calls. I can pagination through the data, I can sort the data where I can filter data, which I want to do right now. I get these filters for all the fields and I can see, for example, just print the ones that have Twitter in their title. And run this again. Let's see. Did I? Mess up here. This is very frustrating, but the good thing is that I prepared. Or actually, maybe it was. Wait. That have to do. No. OK, I'll just it open. The final one. This is the script demo. So this is pretty much the same and should work in the same way. Except that it already shows you what you're not supposed to see, it will come to that in a bit. So we are like pretty much back in the same project. Now we have this fight, many with the same filter, and here we go. And we can now also include related. And so this is what we call nested reads at Prisma, where I can include relations in the same database query. And this will be printed to the console as well. If I go back to the same statement. So now I'm running it and we see that we have a nested object called ortho right here, and authoress also can have profiles. So let's also go ahead and include the profile. And again, we see that we have another nested object right here. So I can work with these relations fairly, intuitively. And the cool thing about this is also that this is all statically typed. So what I can do now, for example, I can grab the first post from this array. And what I can do is I can just let. So let's log, for example, the bio, which is part of the profile. So Post not author DOT. Profile the bio. I can go ahead. Let me remove this one. And we just see the bio being printed here. And the cool thing is that all of that is fully type safe. So if I decided to not include the bio anymore and just retrieve the I.D. field from the profile record. It wouldn't even let me do this already here in the editor. It says that bio doesn't exist because I'm not including it. But once I include it again, the arrows going to go away. So that level of type safety. You really don't get with any other database tool. All right. So now that we went through the first part, I want to show you how you can implement API express routes with or like rest API with Express using my client. And for that, what I need to do is I need to add the express and body parser dependencies. And then I also want to make sure because I'm using typescript, I also want to add the respective types. And again, I prepared a boilerplate. That has the main setup already here. So this is just a very traditional express app and I can now start and implement my API routs. And the first one that I'm going to implement is abduct get for the post throat. This is gonna be an async function that takes the request and response objects. And here I am going to just retrieve with the same query that we saw in the script before post start find many. And send that back. Why are Jason? And just started to see if we can use the rest API already. So for that, I'm going to use the advanced rest client, which lets me send HGP requests. You can see from my dry runs here that I still have the request prepared. So let's go ahead and send the request. And we see as a table even formatted the data that we get back. And here is a Jason format. And I can also go ahead and use a create operation for a post post route, for example. So let's go ahead and create this. I'm going to copy the boilerplate from here. And the first thing I need to do is I need to get access to my arguments. So let's assume that people send over the title, the content and the author email in the body of the post request. And here I can now go ahead and use the create method instead of the find many. So like this post property exposes a number of CRUD operations that I can just use. So in this case, I now provide the title, the content and for the author email, I need to do a nested right and connect LEPs. And connected via via the author email right here. And let's call this the new post to be a little bit more accurate. What this is. And they go. I. I'll go and run the same. The up again here is a post request. Let's look at the body. Let's make sure that we have some other data right here. Let's send it seems like it was successful. And we can go into the database and we see that this new by world was now created. So this is how you can implement API routes with Express. And the next thing that I want to show is if you don't want to build a rest API, but instead you want to build a graphical API. You can do that with Nexus. And to be a good citizen, I'm going to remove all the prior dependencies. And for using Nexus, which is a fully fledged graphical backend application framework that I only need the Nexus dependencies for, I'll actually use the Nexus. Next for this one. And start already with the implementation here. So import schema from Nexus, this scheme object is my main object that I'll work with two to find my graphical schema and implement the respective resolvers. So the first thing that I have to do is start defining an object type. And this object type is going to mirror. The tight definition of the user in my Prisma schema, and just to put it side by side so that we can see what the user looks like. So I? D name email. Are the scalars that I want to be exposed for now. And here's how I do it. And then let's do the same for post. Just have to adjust a few things. And. A published field of the post as well. That's all that I'm going to expose for now. And in fact, one thing that I should do is I should adjust my def script right here, because now it's just the DEF command from Nexus that I want to run. And at this point, we already have a running graphical API that I can start exploring. But the only problem is that we don't have a clue yet. But we do have these type definitions of post and user that are defined with the object type function of nexus. One thing is not quite right yet. And that's the knowledgeability of all these fields. Right now they're all nullable. But if we actually look at the Prisma schema, we'll see that most of them, the ones that don't have a question mark in the end, are actually required. So the way how we can fix that in Nexus is by configuring the null ability for these fields as now as false. And that's the email field. That's the idea. Feel the title feel and the published feel here that are all not nullable. And if I reload the schema right here, we now see that these are indeed the fields that are now required. With all that, we are equipped to implement our first query. And next, as you do that with the query type function that's exposed by your schema. And in this case, I want to implement the same function that we just saw in the in the rest API as well, just a way to retrieve all the posts. So it's gonna be called posts. It's going to return post. And please notice at this point that I'm getting auto completion for pretty much everything and also type safety for everything. So if I do this or if I have another type of here, then these titles are going to be caused by TypeScript because everything is just completely typed safe. This doesn't take any arguments. And the resolvers, fairly simple. Pretty much a one liner to just, again, use my Prisma client instance. I guess I need to instantiate it again. Conn's Prisma new as my client. Of course, Prisma, the post dot find many. All right, that's great. Let's test of that Peery actually appears in the schema. And then also, of course, let's see if it works. So posts idea title content published. All right. We get the same data that we saw before in the script in the advance risk Klein and the database. That seems to work. That's awesome. Let's go ahead and define a mutation with the same approach. Schemata mutation type. We define what that actually looks like. The type. Teed up field first have to provide the name. I'm going to call it create post teed up field. What am I doing type? It's going to return a post and this time it takes arguments. So one should be called title. This is not nullable. And then we have content and author e-mail. So the same arguments as before. Remove the prison scheme at this point. And now the last thing that's missing here is the resolver. And in the resolver, again, we're taking the same approach. We are just using the Prisma client crat query for create. We have to provide some data. So this should look fairly familiar by now. And again, please notice that Arkes at this point is also fully typed. So that development server that's running here from Nexus in the background is actually updating all the generated types as I type. And this makes it so that even the arguments that I just provided here are actually completely type safe and we'll do the same with content. And for the author, we again have to go through that little dance here where we are connecting it like this. Cool. Let's go back to the playground and test that mutation. So first of all, let's make sure that it appears type mutation create post. That looks great. I can't. I'll leave that empty for now and just provide the author e-mail with an author that already exists. Let's retrieve these two fields feels we added another post and we also see it in the Post Courier. So that was successful. That's awesome. But there is one thing actually at the moment that's a little bit annoying. One cool thing about graphical in general is that you should be able to retrieve relations. You're right. But at the moment, that's not possible because it's not yet implemented in in in my code. So I want to go back. This is, I think from before. This is it. And I want to show you how you can do that. So the the straightforward way for doing this would actually be to do this. You just declare another field right here to dot field. And you take the same approach as before. You specify what the typos in this case, it's a user. And now the graphical playground will not complain anymore. But this is always going to be now because you need to also provide the resolver right here in order to fetch the right. User for this post, but I have another approach. That's a lot easier and that saves me a lot of boilerplate. And that's by using the integration that Nexus has with Prisma at the Nexus Prisma plugin. And I'm going to add a new dependancy for this Nexus plugin PRISMA. And will adjust a little bit. My entire setup. So what I don't need anymore is this Prisma client instance. And also not this import. In fact, once this is installed, I can then remove the Prisma dependencies because the Prisma client and Prisma SEAL dependencies are both bundled inside of the new Nexus Prisma plugin. And what I can already do is I can start typing what I need. So this is gonna be prisma from Nix's Prisma plugin. I think it's the work. REIT typescript, or they go now, of course, we'll get type errors in our results first, so let's actually just delete them because we'll also re implement those. I just quickly want to go through that, removing this route when this. Why the working? Nexus, plug in Prisma. Thank you. And I'm going to integrate this with Nexus Youth function right here. And turning migrations because there are still experimental. I'm disabling them. Cool. So now that I have added this, I actually get a new property that I can use on my on my model types. Let me go and start the developments over again. My client initialised. I have to remove the Prisma dependencies, as I said before, I think that should fix that error. All right, so my graphical server is running again, and I can now use this t dot model thing that, again, fully type safe actually automatically exposes all the fields from my Prisma schema. So in this case, I want to expose the Post's relations on. Author on an user and also the author on post. And if I go back now to the schemer, actually, because I deleted the the amputations from here, we don't see that right now. But I also want to show you how you can now within a matter of basically minutes, implement a full graft, your crud API for these database tables that have been translated into Prisma models because Nexuses able to leverage the information from Prisma through the Nexus Prisma plug in. And you can just go ahead and define your graft, your crews and mutations like this now. And the same here for mutations. I can access tittered crud and say, okay, I want to be able to create users. And I actually want to sort of create posts and caldas create posts. So that's the name that'll show up in the API. So let's just take a look at what already happened to the graphical API right here. And you'll see that we now have a create post method or like mutation. And the crew type was also expanded with. Where are you? Posts and post. So you should still be able to send that query and get the same data back. And because I also used t dot dot model dot posts, I get I cannot also retrieve these relations. So that's basically how I can very quickly expose data from my database using Prisma and Nexus, the like biographical. And if I wanted to, I could even remove all of these extra configuration than jus just use that model everywhere. And then I also don't need that extra configuration with Nullable false anymore because through the Nexus prism I plug in. Second, through the Nexus Prisma plug in, like Nexus knows that these are going to be optional or not optional. And that's the reason why I can expose them so easily. So if we want to check that this is still correct, I'm going back to the playground. Refreshing opening the schema. If we find the user type, we still see that all that information from the prison Ruski most directly being like handed through up to the graphical API. That's it for the demo. So now I'm pretty much done with the presentation and I'm looking forward to your questions. Thanks, Nicholas. It's very interesting. So, um, I have a question. And can you show us the code, uh, object type? Yasser. This goes. Yeah. So how does it know when you do to model that idea? How does it know that it's, uh, the user model? Is it the name attribute? Ah. So, in fact, let's actually see. Yeah. So it is indeed like looking at this name and it's it's it's matching that name against the name inside your Prisma schema. And because it finds this user model here that can suggest you all of the fields are put it side by side again. It can suggest to you exactly all of these fields. I could, for example, also expose the profile relation we have. Look at that. And the problem at the moment with this is that I didn't define profile yet. In my in my schema. So I would actually have to go and do this real quick. And, uh, I can expose the bio. And now having the server run in the background. This should be resolved. Don't model that user so that it's bi directional. And now it's it's also added that profile here. So indeed, it leverages the information from the Prisma schema. And the the the reason it can do that is because I'm using this Nexus Prisma plugin right here. And is there a way to just use T model and have all the attributes included already to specify one by one? You're touching on a very interesting point. So we had a long internal discussions about this. At the moment, there is no way to just expose all of the fields. And the reason for that is basically security reasons. We don't want anyone to accidentally expose anything from the database that I didn't kind of explicitly acknowledged. Right. So with that model, with that API that we have at the moment, you explicitly have to expose everything. And that was kind of a conscious decision. We might kind of introduce something like a prototype mode or something like this where you can just easily expose everything. But we don't think that this is the best approach for building production apps. But if you have a different opinion there or like if any of the listeners do, then please chime into the conversation on GitHub in the next US repoll and share your thoughts and kind of like what you think that API should look like to critically expose everything. But at the moment, that's indeed not possible. And that's intended. Yeah. I remember many us getting hacked because of this. That's exactly the point. Right. We will we try to learn from all the predecessors. So. Yeah. Okay. So we had a few questions from the audience. Sue um, uh, someone's asking my yes. Man. He's asking, uh, what about Microsoft's ask your secretary. Do you plan on, uh, supporting, I guess, proprietary database? Will it be like a paid option or. Yes. Yes. Yes, absolutely. So at the moment, we are supporting three databases, bases, my sequel, Pascrell and sequel. Right. But we have a lot more database's planned. So we are already working on support for like to be. We also want to bring support for other databases and like any sequels or could could be part of that. If if you want to have a specific database that you would like to be supported, then please go to our GitHub repo and create an issue. And then like based on the some like under thumbs up that you see in a certain like you see in a certain GitHub issue would just activate search like you can subscribe to these different databases which are supported and lead and a sequel support has already been asked. So if you're interested in that, make sure that you leave your thumbs up here. Ideally, you also leave a comment with the reason why you want to see support for it. So that's the best way how you can bring these on our radar just by creating GitHub issues. And do you plan on supporting these proprietary database as an open source, as open source, or will it be a paid option or. There's no. So the we will be supporting them in the open source version. So the tool that I've just shown you, like my client, that open source, like data access library, that will remain open source, we actually get the question quite a bit about like, OK, how does Prisma make money? Eventually the way how we want to do this is by building commercial services around the open source, tools that will especially help larger teams and organizations to collaborate in Prisma projects. But the open source tools that we just talked about and that we saw, they will always be free. Like I think I remember seeing that database tool that was almost like a CMF. I think Your Highness showed me once. I don't remember that. Do you know something about it? Mm hmm. Do you mean Prisma Studio, what I showed in the book? I think right. Right. I, uh, glossed over that actually in the end. I kind of suspected that this was like, uh, the the the fact that I started it could have been the reason why after that, I didn't. Yeah, I think, um, like because Prisma Studio are still experimental, um, it's not always working perfect. But if you want to try that out, you actually have, um, a demo site up that you can see here and you can explore some of our demo databases. For example, this Chino database with, I think employees and companies, uh, like we can explore the capabilities, um, and, uh, like view the data. And what's also really nice about Prisma studio is that you get this preview in addition to the table view, which which, um, lets you expand the relations in a much, much better way than it's possible in the table view. Right. And the table view. I can also somewhat follow relations, but only one level deep. And in the preview, I can go ahead and look into the nested objects as much as I want. Okay. That's pretty nice. Um, I have another question from, uh, Marcel. He's asking the person a client code is generated two note modules and not to the absolute directory. Why not a separate directory? How can I access more than one existing database in a single lab? Right. So, like, first taking the first part of the question. So by default, it's then degenerated into node modules. You'll find the at Prisma folder somewhere in here. What are the top? The at sign here is at Prisma. But it's at Prisma Photo right here. Or like rather the reports my client foder actually has no code inside of it. You'll see that it just imports everything from the DOD Prisma Directory, which is here, where the actual code for your query API is being generated. And the reason for that is that sometimes some package managers are pruning the folders that are inside node modules. And with that approach of using the Dot Prisma folder, the photos that are prefix with a dot, they don't get pruned by package managers. So it'll stay in there and it may go for a more robust overall experience. But if you don't want it to be imported into into prison, my client. So like 11 or like internal modules. One thing that you're losing is the nice import. So at the moment, you can just like imported from. And then like from at Prisma Slash client. If you work to specify a custom output right here, which you can do. Then you have to imported from there. And you don't get like a similarly nice import. I think that was the first part of the question. So that's like certainly possible. You can also, like, generate at other locations. The second part of the question had something to do with multiple databases. Could you maybe repeat that? Yes. So how can I access more than one existing database in a single. More than one existing database and a single ad is you would have to create two Prisma schema or like several Prisma schemas. If you wanted to talk to more than one database at the moment and then also kind of generate your your own prison, my clients per prisma schema, like there you could use these different output locations. We are working on support for multiple databases where eventually it might be possible to, like, even define a model that has data in one database and data in another database. And then the joining of the data will also be performed by Prisma and the query engine that powers Prisma. But that's way down in the future. So at the moment, we're just focusing on kind of the baseline off of features that everybody expects from this kind of from this kind of database toolkit. And if you want to use multiple databases, you need multiple Prisma schemas. Someone ask he asked his question before you show the Nexus plug for a but I'm going to read it anyway. So it's a. Everything you're showing your demo should be automated, seamlessly provided by your tools. Mainly the schema, introspection and resolver co-generation. The Nix's Wavves schema and resolver definition create another layer between data and pure graph. Well, um. Please, uh, focus on automation. So, like, that was like pretty much the argument that, like, you shouldn't even have to write this, right? Like, that's what this person is saying. And I like this person really only wants to have this and this be like auto generated from that. And I agree for prototyping like that would be amazing. And in fact, we have a community member that I want to give a quick shout out to at this point. He's called Azmat and he has built a tool that actually does exactly that. It takes a look at your Prisma schema and it's generating all of these object type definitions for you and the same for all the CRUD operations. So if you indeed want to have that and you don't want to, like, type all of that out yourself, then I would recommend you go check out this like this repository. And I think it's something that you earlier. Yes, of course. Like, send it in an hour. Resume its call. Yeah, I'll send it in. How do I get access to them? I got. It. No, I can. I can't wait. I can sew so that it's better readable. I can just like. That's the. I grew up screaming. But. And yeah, I agree. I mean, like, it would be nice to have that, but it's not something that we want to build into kind of the main path of using these tools. It's rather something that you can explicitly and able to be aware that you're in in a somewhat unsafe mode. Right. Because you're exposing everything. And like that example you mentioned with with rails, we don't want to get into the same trouble as dated. So we want to make sure that people are aware of what they're exposing from their database. Yeah, I agree. So it's like great scaffolding. I mean, it's great for prototyping. And then, one, you need to work on a serious app. You usually don't use scaffolding rails. I don't know if you're familiar with it. What about Rails? But I used to. I used to be. A user of four wheelers. So, yeah, I think, um. It's nice to prototype, but not not for production. Um, okay. Let me see if you have any other questions. On the his court. No, there no other question on this. I have another question. Do you have, uh. I think I saw migration tools, uh, with, uh, Redwood is that and they said this was coming from Prisma. Could you show us a bit about, uh, how can you migrate in Menasha database from the CIA? Oh, sure. So I think the best way to show that is actually quickly taking a peek at the Ducks page for Prisma Migrate. And like showing this kind of illustration that explains that the workflow with Prisma migrate. So what I showed you in the demo was that we didn't have to write the data model ourselves. Right. If we go back to the code. Here and we. And if we look at the Prisma schema, I didn't have to write that initially, right. We just introspected the schema. And this was generated. I made a few adjustments to to make the generator API nicer. But in general, like, I didn't type that. The other approach that you will be able to to use with Prisma Migrate is that you actually do write these models by hand. So instead of like running CECO Migration's yourself, what you'll do is you define your own models using the my schema language right here. And then you can run the Prisma Migrate commands. See. And prisoner migrate. And that is telling you now you can have like prisoner migrate up, down and safe, like safe creates the new migration. It's not yet running it against the database. I'm actually not 100 percent sure what would happen if I just ran it. Now, let's just see. Maybe we don't have to provide a name yet. So what it does that creates this new migration with a timestamp and in that migration you get a read me that shows you the generated sequel statements. And it also shows you a deaf off the data model to the previous one so that you have an understanding of what's going to happen to the database. And then you can execute this with the up command. But I'm not gonna do that now. I think that's just going to break. If I introspected before I. I don't know. I don't want to jinx it here. But with that workflow, it's basically like this approach. You start here, you change your Prisma schema manually. So, for example, you add a new model. So you update the prison Moschino file manually. Then you run the Prisma Migrate. Self-command. This updates the migration's directory that I just showed. Then you run an prisma, migrate up this, then actually updates your database. And once you're done with all of that, you actually have to run Prisma generate again to make sure that you're Prisma client. Inside node modules also is being updated. And then you you can use the new updated API and and and send the new queries in your application. And so if I want to modify the database, I just have to modify the model, I don't have to to create a new column. I feel like this this is exactly what is out by itself. Exactly. So once we have my grade ready. And if you're using it, you don't have to write sequel at all anymore, like at the moment. We don't have, like, my grade completely ready yet, so we don't recommended for production. So you will still have to find your own way of doing Database Migration's beard with plain sequel or kind of next day as Migration's type or a migration's third party. Libraries like fly away. There are a lot of options at the moment that you can use to to migrate your database, but then yours. You always need to introspected and in order to be able to generate the Prisma Cloud. What do you use to optimize your risk coverage, because when you use an Aurora or I'm like Prisma, it's always a bit worrying to know what's happening behind the thing. So the way how Prisma actually works under the hood is that it has a courier engine that is implemented actually in Rust and that courier engine runs as a side process on the same machine as your application. So here is kind of the architecture for what's happening, and that is what we just saw in in my demo. Right. The code that you saw, that was my application code. That was kind of the main process on my application server. But my client doesn't actually talk directly to the database, but it's talking to that Curreri engine binary that's implemented in Rust. And this is where we are generating these sequel's statements that are sent to the database. And we have a team of, like I think by now five or six, like very experienced rust engineers who are implementing the create engine and who are optimizing it. So at the moment, we are still in beta and the performance of Prisma client in general is already up to par with kind of the the other tools than the space like type or sequels connects to us. But we have a lot of performance optimization potential. So, of course, because we are still in beta, it's still kind of early. We didn't focus on the performance like on the on the performance aspect too much yet. But if you start using my client today, it will basically just get faster and faster with every release. You don't have to do anything, but we have this team of very capable engineers that will be able to squeeze out these last bits of performance for you. Like you don't have to do anything for it. Do you publish benchmark with each new version? So we can check the progress on this? Not yet. It's not yet public. We do internal benchmarking already. And I think we we like might eventually publish this. But at the moment, it's only an internal benchmarking. But I can also take that back to the team to. Yeah. To like maybe learn more about when we we can start publishing results. I mean, you could have a website like it's pretty smart fast yet dot com or something. Yeah, well that's a good point. Like as you speak of it, we have this like website that's called Is Prisma to Ready where you find all the information about Prisma. It's current state. So like as I said, it's Kernohan beat out. We are very, very close to the products already released. In fact, like we see already, a lot of people using my client and production. The main reason why we don't want to launch for general availability yet is because we also want to make sure that we do a little bit of last mile below testing for introspection. And also, we want to make sure that we provide very thorough upgrade guides and extra tooling that will help Prisma one users upgrade. So it's actually not so much the concern that my client is not stable. It's rather that we want to make sure that introspection is battle tested and that we want to provide upgrade guides. So if you're still hesitant to try out for try out Prisma, too, because you think it's not stable, like my client is already very, very stable. So you say a couple of weeks for there is. It's it's going to come in the next, uh. Like, I'm going to say a month now. But, um, you can, uh, you can just follow us on Twitter and you'll see the exact date when it's going to happen. Okay. Well, uh, thanks so much. That that was very, very cool. Um. Yeah. Thank you for having me. That was really exciting. Okay. And thanks everyone for watching. Don't forget to subscribe to the channel, which you want to see more content like this in so we can have more visibility. All right. Thanks, everyone, and see you next time. Right away.