What's new in Prisma (v2.7.0)

– And we are live Welcome to another episode of “What’s New in Prisma?” My name is Nikolas, and I’m here with my colleague, Ryan – Hey, how’s it going today, Nikolas? You’re looking very orange, right now – (laughs) Yes, well, I am in a new room today The room is called Bacon We’ll talk about this in a second, and hopefully you’ll also notice that the audio quality today is a little bit better than the last couple of times that we spoke here That’s just because I’m actually speaking right into the microphone this time So, I think this already increases the quality, of course, but we also actually turned this room that I’m in right now into a sort of studio So, in the future, hopefully, the quality, the video and audio quality, hopefully is going to improve here – Mm hmm, it’s sounding good, man I think it’s already a big improvement, so that’s awesome – Cool, yeah, and speaking of rooms, you haven’t visited us here yet in the office in Berlin, but we actually have a naming scheme for all of our rooms here And that naming scheme is basically that we pick names according to emojis that can be eaten So, we have a room called Coconut, a room called Avocado, and the room that I’m in here right now, it’s called Bacon – Yeah, man, you got something special in that room, hey? Something very appetizing? – Exactly, so, to identify each of the rooms, we actually have small hints in the rooms that show you which room you’re in at the moment And, in this room room, we actually have three hints, although it’s kind of the smallest one, it’s actually just a one-person room, but here is a little pig that’s kind of the pre-bacon stage Then we have an actual cut of bacon made out of cloth And, finally, we also have a bacon candle, and that’s probably the– (laughs) – Have you lit that candle? I can’t imagine it smells good at all. (laughs) – Nobody dared litting it yet – No one has dared – (laughs) Well, I smelled it once I actually smell it right now just from opening it, and it’s, yeah, yeah, I don’t wanna lit it, we’ll just leave it at this, I think – Not good, eh? Oh, man – Alright, cool Ryan, you’re in Canada You’re not in the office here, and, on Tuesday, you missed a really nice barbecue we had – Yeah, I’m jealous of the barbecue you had – Yeah, we actually have a couple of remotees here in the company, and we did dial a few of them in So, we had a Zoom meeting, we had a laptop that we just put across the table, so that everybody could join and kind of watch us have the barbecue And one thing that I wanted to point out, and that makes me jump straight into sharing my screen today So, let’s start with this I’m going to share my screen up here So, one thing that I wanna show regarding the barbecue is that we actually have a chef here at the company, and you might already know him from a couple of live streams that he did, where he showed you a few delicious recipes with Prisma and Happy.js I’m speaking, of course, about my colleague, Daniel, and we have a couple of pictures from his work during the barbecue So, this is Daniel when he’s not live streaming and explaining to you how to build and deploy applications with Prisma, but that’s him when he’s cooking really, really good meat at the barbecue And here is even a close up of the same pic All right, I think that’s enough talking about food for today, and I think we can transition to speaking about the latest Prisma release – Mm hmm, 2.7 – Yes, that was the 2.7 release that we released on Tuesday this week So, again, we were on time And this one, the biggest, and, I think, most exciting new thing is that we were finally able to release Prisma Studio out of its experimental state So, it is now stable, and that also means that when you want to use Studio, that you can just start it with npx Prisma Studio, and sparing the experimental flag that was required before Have you used Studio a lot, Ryan,

or is that something where, you’re still fairly new at the company, so, I bet you haven’t explored all of the different parts of Prisma yet even, right? – That is right I am continually uncovering new parts of Prisma that are awesome and exciting to use With Studio, I’ve kicked the tires with it, as it were, but I have not given it like a really good spin, but as opposed to using something like TablePlus, which I use as my, just, general database table editor, viewer, et cetera I think I’m gonna start to really default to Prisma Studio in the demos that I’m doing as I’m working on Prisma data models and I am wanting to see the data live I’m gonna spin up Studio instead, and give that a proper go Especially now that it’s out of experimental, I think it’s a good choice over the conventional table viewer And I think you’ve mentioned that it gives you some nice features that you wouldn’t maybe get in a table viewer, that are particular to Prisma Maybe, do you wanna chat about some of those? I think it’s something about relations, right? – Yes, absolutely And, so, as a quick side note, if you currently don’t have a Prisma project on your computer, but you still want to explore how Studio works, you can just go to the domain prisma.studio, where we have a couple of read-only demos prepared for you And, here, I’m going to use the Chinook database, which is just a database with a couple of different tables, really, album, artists, customer, employee, genre, invoice So, sort of like a music application domain, basically And we’ll now explore a little bit how you can use Prisma Studio to view the data and explore a couple of more features that Prisma Studio gives you So, of course, first and foremost, we have a pretty standard table view that you would expect, that you probably also find in a lot of other database GUIs But what I really like about Studio is that it really is a modern GUI for your database I always feel that these traditional database GUIs, they always feel a little bit clunky, and also the level of abstraction that they provide Of course, they are just like representing the SQL tables directly But what happens when you’re using Studio is that you actually see the Prisma models here So, however you configured your Prisma models, this is what you’ll have access to through the Prisma Studio viewer as well A couple of features You can set filters for your tables here So, if you wanted to only see, for example, an artist where the name contains the letter A, then you can just do this, and let’s see if there is one that has AB So, we indeed have a couple of others that have this, somewhere an AB inside of their name You can also decide which fields you want to display here So, I could now remove the ID field, for example, and it will only show the columns that are relevant for me at this point And you can also paginate So, in this case, we are showing all three results, but I could also say that I just wanted to show one result, for example, or if I want to skip one even, and just show the second one, then this would work as well So, that’s how you use Studio on a very basic level And then, indeed, you hinted at it already I think one really, really cool feature of Studio is actually the way how it lets you work with relations So, here, from artists, we have a relation to the album model, and, apparently, this artist, ACDC, is connected to two albums that we have in the database So, if I click on this, I basically now see the entire table with all the album records, and the ones that belong to ACDC are selected right here So, I could now go and manipulate the data right here in Studio And, of course, this is not going to work in this case, because this is a read-only demo that I’m looking at here, but this is basically how you would manipulate the data inside of your database, that you can change it, I could also do the same here by the way, and then just click the save button to persist the changes in the database – That’s awesome One thing that comes to mind with Studio, and maybe some other people are wondering this, do you know if there’s any upper limit to the number of records you can show? ‘Cause one issue when viewing this kind of stuff in the browser is that you’re going to run up against browser limitations about how many DOM nodes

you can populate into the page, et cetera Have we come up against any sort of upper limits in terms of data that can be displayed at a given time? – That’s a really good question, and I am not aware of any concrete limits there, to be honest But what I know is that Sid, the developer who has been primarily working on Studio, he has especially put a lot of effort recently into improving performance That was one of the last big things that we needed to get right before we could release Studio out of its experimental state So I’m pretty sure that you probably can display probably even to the thousands of records, here in the browser, where you can just scroll, and it shouldn’t be lagging in any way So, I’m fairly confident that this works even with fairly big data sets – Awesome, that’s great Yeah, I’m gonna explore it a lot more, so, thank you for that tour – All right, and then I quickly want to talk about the second big improvement in this release, and that is that you can now configure the location of your Prisma schema file in your package.json So, if you’re a rebel, or if you just want to do something that is just unconventional, you might go and not call your Prisma folder “Prisma”, but instead you might wanna call it “Database”, or whatever else And because the Prisma CLI, when you invoke a command like prisma introspect or prisma generate, the first thing that the CLI typically does is it’s going to look for the location, or it’s going to look for your Prisma schema And, by default, it’s looking in the current directory, or in a directory that’s called Prisma So, let’s actually test this right here This is the script example from the Prisma examples repo, that I cloned from there And if I now want to run the prisma generate command, like this, and the CLI would fail because it cannot find the Prisma schema file, which it expects to be, by default, in the current directory, so, somewhere on that level as all the other files here, or it would expect it to be located in a folder called Prisma, which is the default name for the folder with your Prisma configuration So, if that’s not the case, what you could have done, or what you were able to do in previous versions of Prisma, you could have provided the schema flag to the CLI command, and then just pointed to the actual schema file So, this would indeed work But if you always have to do this, it kind of gets a little bit annoying, and you probably want to have a more convenient way to configure the location of your Prisma schema file So, what we now introduce is that you can provide the location by default via your package.json, you just add a property that’s called prisma And, in there, you add another property that’s called schema And then you just provide the path to the schema.prisma file And now, with this change in my package.json, I can go ahead and just invoke the prisma generate command without the schema flag, and it’s still going to work So, that’s also new in the latest Prisma 2.7 version that we released on Tuesday – Very cool Is there anything else that we support in that prisma property in the package.json, aside from schema? Is there any other utility that can go in there? – Not yet, I believe I’m not aware of anything else But I think this is now a great start to see where else we can provide convenience for developers that want to spare some sort of manual configuration every time they invoke the CLI, and just provide that kind of configuration directly in the package.json, which is a file that every Node.js project will have by default, right? So, it’s really a good place to put that kind of configuration – Yeah, and it’s a nice thing too, because with tools like Prettier, for example, it’s nice to have that configuration right in your package.json file, so that when you are working with other developers, they get the same config right out of the box, right? So that you don’t have to have them worry about configuring some config files in their workspace or whatever It’s all just, everyone has the same config if you put it in the package.json So that’s interesting I’m curious to see where else we can go with that config option, there

That’s really cool So, should we talk about some of the community stuff that has popped up in recent times? – Yes, absolutely – Namely, this UML generator So, Prisma has this concept of generators Prisma has got tools that can allow you to tap into your Prisma model to do various things And so, we see some of these things in action in various ways If you wanna generate a GraphQL CRUD API, for example, there, we’ve seen stuff like this One that we saw this week, a community thing I’m gonna share my screen here, so that we can get a look at it, is called prisma-uml So, here’s my screen Looks like it’s popping up there, that’s good Prisma-uml, this is it here So, this is the author, Yann, and you can find prisma-uml here, at this GitHub link So, what does this do? UML is universal, what is it? Modeling language? Is that UML? Universal modeling language, I believe, right? And so– – Yes, and I just want to quickly interrupt you, sorry, Ryan – Sure – There were actually two tools this week that have been released And the one that you’re now talking about is the one that’s called prisma-uml, that’s a CLI And then, there also was a generator that translates into DBML that can be invoked via a Prisma generator in the Prisma schema So, these are two different tools, and we’ll talk about the other one, the DBML tool, we’ll talk about that in the next screen Today, we’re introducing the prisma-uml package – Yep, prisma-uml, yeah, yeah, good call Prisma-uml is gonna give a universal modeling language diagram of your database model So, it’s something you, I’m sure, have seen before, if you’re working with databases I wonder if there’s even a screenshot of what I’m talking about when I talk about UML Maybe not in here, but there was a link to PlantUML, and I think this is gonna give, basically, an idea of what we’re talking about So, you’ve probably seen UML diagrams before It talks about how your database tables map together, etc And it’s a language, so you can think about markdown Markdown converts to HTML, and renders as HTML You supply some UML here, it’s gonna render a diagram for you, basically So, this is a tool built to generate UML from your Prisma model, which is really cool So, let’s take a look at how this would work, here I’m gonna go into this model that I’ve got This is maybe a more complex model that I was working on Complex in the way that I’ve got a many-to-many relationship here And I was working on this recently for a live stream that I did for Redwood I think this is a good one that we can demo this on So, according to the docs here, the way that you get this going is you can either do npx prisma-uml, if you don’t wanna install this globally, but I’ve installed it globally And so that’s, yeah, just npm, install globally, prisma-uml And then, you can do prisma-uml –help See what commands you get So, you can get a UML from your schema You can get a diagram output to SVG, to PNG, et cetera So, why don’t we see if we can just get the actual UMLs of the markup So, let’s do prisma-uml, and I’m gonna go into where my schema is Right now, it’s under this API directory, and then in the prisma directory So we’ll say that it’s gonna be at api/prisma and schema.prisma I do that, here’s what I get I get an output, basically, of UML So, I can copy this, if I wanted to I can just go like this, go to the start, hit copy, and then come over here to this PlantUML viewer, and I can paste that in, and submit it And when I do, I get (Nikolas whistles) my UML diagram, just like that So, very cool, it shows the relationships between tables, it shows the properties within, etc And then, the other cool thing is that I can actually get that done for me, if I do –output to, say, PNG,

and I need to give it a file name I just wanna double-check the command that I, yeah, –file will give this to me right here, test-uml.png I bet this works, let’s see Yeah, it’s successfully created, and should be down here There it is – That’s amazing – Yeah, really cool, you, yeah, it’s output directly for you – And if I’m not mistaken, this also means that Prisma is now enterprise-ready. (laughs) – Exactly, if we’re doing UML diagrams, I mean, that’s what you wanted in enterprise stage, right? So, perfect, ship it So yeah, it’s a cool example, though I think what Nico and I wanted to highlight today is, it’s a cool example of how Prisma gives these extensibility points that you can tap into to do cool stuff like this And I was looking through how this is done, ’cause I wasn’t too familiar with how you would work with a CLI like this And the key to it, the crux of it, is if you go into core, here, and then into prismaToPlantUML, it’s all working on this getDMMF function that comes from the Prisma SDK This is what’s used to, basically, get the information that is then iterated over to generate these diagrams And we can get a sense of that, actually, if we come over here I’ve got this other demo I’ve just pulled up these recent demos that I’ve done that have data models for me And we got this function that allows me to do some async stuff, where I am going to await that getDMMF function, passing in a data model path, which points to my Prisma model I just wanna see what’s in there So, npm run dev, to get a look at that And when I do, we get this, a bunch of stuff So, I don’t know if you would call this an AST, necessarily, but it reminds me of when you would work with ASTs, I’m thinking of in GraphQL, specifically, you would use the info object in your resolvers to get a GraphQL AST, and you can use that to do all sorts of cool stuff It gives you information about your query And, in the same way, we’re given information through the DMMF about our Prisma model, and this is like the raw info about it So you can use this info now to go and do whatever And everything’s collapsed in here, just the way that it’s coming onto the screen But if we do something like this, we can get a sense of how big this thing is – Yeah, that’s a lot of info in there – (indistinct) in all of them too Do that This thing is pretty large There’s a lot going on here You basically get all of the information about your model in an AST form You can run with this and do all sorts of cool stuff So, this is what’s used to generate that UML, essentially, and one thing I was wondering, Nico, maybe, you know, is, what does DMMF stand for? Data model something is what I would anticipate, but what’s the other MF here? – Exactly, that’s the Data Model Meta Format – Meta format – Exactly, you explained it perfectly right, Ryan, that’s basically the internal structure that we’re using internally whenever we need to parse the Prisma schema and do anything with it, really So a lot of the Prisma CLI commands are depending on the DMMF, but also, as we talked about last time, for example, the TypeGraphQL CRUD generator that we talked about, that you can insert into your Prisma schema as well, that also reads the DMMF, and based on that, generates some other code, right? So, the DMMF really is the core of everything else that is falling out of the Prisma schema in the end And that’s the relevant part for library authors So, whoever has an idea for what they wanna do with the Prisma schema, because they think it’s a nice way of modeling data, and they can just kind of pick it up and turn the Prisma models into whatever else, really, that they want, right? A couple of streams ago, we talked about a community project from our colleague, Hashid, actually, who built a tool that would generate you individual API reference documentation for your Prisma project That’s also based on these internals that you can find inside of the Prisma SDK And, also, the generator that we are going to talk about next time, the DBML one, that’s also depending on that So, it’s really that internal structure that people can read in order to kind of transform and generate whatever other thing they want to have from the Prisma schema Very nice demo, Ryan – Yeah, I thought it was really cool And the DBML generator is something

that we’ll also talk about, and we can even, did you wanna show something on it today? We could even pop up the page just to show how it looks when you’re integrating it into your projects Do you think it’s worthwhile to do that now, or should we wait until the next stream? – Yeah, I think we’ll spare that for next time, actually – Cool, that sounds good Yeah, and something that we were talking about is, we were wondering, what are some other possibilities of working with generators? When would these come into play? What kind of cool things could be done, or what are some concrete needs that people might have for generators? And so, if you have any ideas for that, feel free to throw them in the comments But you, have you had any thoughts, Nico, on what makes sense to exist out in the wild that maybe isn’t there yet, that would rely on generators? – So, I have at least one idea that also is basically born out of a feature request that somebody asked on Slack the other day So, we had a person who, basically, didn’t really need the Prisma client API to read and write data in their database So, they didn’t care that much about having find many, find one, create operations, but what they just cared about were to get TypeScript types for their Prisma models This would also be a really good use case for a generator that you could use inside of the Prisma schema, and just include that, and then you could generate the TypeScript types based out of that So, that would be an interesting use case Another interesting one, and I’m pretty excited about this one, actually I’ll share a link to this in the comments real quick It’s from a GitHub discussion, where somebody, just out of the blue, basically, raised the question about the Prisma internals as well And the reason why they were doing that was because they were also writing their own custom generator to generate a deploy-ready code to deploy a graphical API with AWS Amplify So, they basically take the Prisma schema, and they take that as foundation, and then they generate code that they can deploy to AWS Amplify, which, I think, is a fairly exotic use case, but also really interesting one, and it kind of shows the power and the flexibility of the Prisma modeling language that we’ve come up with here – Absolutely, yup, that’s awesome I am excited about the possibilities here I want to explore more – All right We don’t have too many other things to talk about today, so maybe we can pick up a couple of more questions in the end So, people watching this, if you have any questions on mind that you always wanted to ask, then, now is already a good time to drop them into the chat And I’m going to quickly continue with a short promotion here We haven’t talked about it on the stream yet, Ryan, but we have started a big effort, recently, actually, internally, where we want to educate developers about working with databases And that’s not necessarily even related to using Prisma, but really just general database content that’s relevant for developers So, what we came up with is the Prisma Data Guide, and you can just find that on our website At the moment, it’s located at dataguide.prisma.io, and it really starts with all the fundamentals that you would want to know as a developer when you’re getting started with databases And maybe you don’t even know what a database is, or how it actually works So, we really go very, very deep, here, in these articles, and explain all the theoretical foundations, and include a lot of, also, practical knowledge and practical tips for developers who are working with databases So, we have this initial section, which is just basically an introduction, general introduction to databases What they are, comparing different database types This one, I think, is especially interesting So, we are talking about legacy databases, what was there even before relational databases were introduced, and other more database types that were developed really early And then, we talk about relational databases, NoSQL databases, NewSQL, and multi-model databases So, really, a tour through all the different database types in existence, basically I also want to highlight the data modeling chapter that we have online This is written by the Dian Fay

She’s actually the author of MassiveJS, which is a really nice library to also access your database So, you should check that out as well And we’re also talking about a couple more other topics So, here we have a comparison article that just compares the levels of abstractions for different ways to talk to your database, starting from plain SQL, over CRUD builders, to higher level ORMs And then, we have focused a lot on PostgreSQL recently So if you’re a PostgreSQL user, then this is definitely worth a look, where you can just explore a couple of features, or if you want to learn about specific topics, like authentication, authorization, in PostgreSQL, then these articles will be for you – Very cool – All right, all right I don’t think we have too much else to talk about, but one thing I think that I wanna close with is that we want to encourage our community members, so, probably everybody who is watching right now, to maybe go and create content about Prisma And this is really something where I think you have a lot of experience with, Ryan What’s your experience as a content creator? How do you kind of select topics? And one question I think that’s also commonly asked is where people aren’t sure if they’re even the right people to create content, especially if you’re maybe a newcomer to Prisma, or even a programming beginner, is that even a good spot for you to start creating content? Or should you rather maybe wait until you’re really familiar with a specific technology before you write your first tutorial or your first blog article about it? – I think it’s super valuable to not wait until you are well-versed with the technology And it might seem a little bit paradoxical at first, but the reason I think it’s a good idea to write content before you even feel ready to do so is because it will help you learn, that’s one thing When you have to reiterate what you’ve learned in the form of writing and examples, in a way that other people can understand, that’s a very good way to cement your own knowledge So, that has worked very well for me when I’ve been learning new topics, and I go and create a blog post about it, and come up with examples It requires that you really understands what you’re talking about before you can come to the place where you can explain it well And so, that whole process of being able to explain it is gonna cement your knowledge So, it’s very useful that way And the other thing I would say about that is, you’re in a great position, if you are a newcomer, if you are just starting out, to be able to offer real, tangible value to others Because, once you get past a certain point of, call it expertise, or domain knowledge, or whatever, you kinda become blind to the things that are not apparent to other newcomers Whereas if you have a ton of knowledge about a domain, and you go off and create a big technical article about it, in that scenario, you might be missing a whole swath of people that don’t yet have those foundational skills, or foundational pieces of knowledge, to be able to understand what you’re talking about So, when you are just starting out, you’ve got this ability, this unique ability, I think, to be able to craft content in a way that other newcomers can understand it, because you are there yourself So, I think it’s very important, actually, if you’re a newcomer, to do content, if it’s something that you want to do And I think it’s a great way to cement your knowledge, and also to add value to the community So I would say, find a problem that you want to solve, that’s a good way to start, and write about your experience with it So, if you are thinking about doing something with the DMMF, and you are thinking about running some kind of generator, a good place to start there is, if you have to solve your own problem using a generator, and now you’ve gotta go learn about how the DMMF works, document your steps and talk about what you went through And that’s gonna help a lot of people figure the same things out when it comes time for them to do so – Very spot on, I really liked what you said there, Ryan And I think it reminds me a little bit of a quote that I heard at a conference talk, and it actually stuck with me It was a conference talk that I already attended I think 2013 or 2014 It was one of my first developer conferences, actually, where it was somebody, I think, from the iOS community, which is kind of my route as a developer, actually, I started programming as an iOS developer

And it was, I think, Ash Furrow, back then, who is very prominent in the iOS community, who said that, as a newcomer, or as somebody who is learning something, you’re kind of uniquely qualified to explain the topic, because you still remember what it feels like to not understand the thing, and you can clearly articulate that transition from not understanding to understanding So, that really stuck with me, that idea of being able to find the right words, because you’re still in both mindsets, right? You still remember, ah, this is what it feels like when I don’t understand it, but this is what it feels like when I do understand it, But how do I get from here to there? Well, this is now your task, as the person who just learned it, to put that down and bring that into words So, I can definitely plus one this And one thing that I also want to mention in that context is the #learninpublic that Sean created, swyx on Twitter, a couple of people probably know him already He’s a really big advocate of this idea of learning in public, and just going out, and putting yourself out there, sharing your knowledge and sharing what you learned, so that you benefit from it, but also so that the community benefits from it And if you need a little bit of inspiration for where to start, I have a couple of ideas For example, one question that’s repeatedly brought up on our Slack is that people want to learn how to implement GraphQL subscriptions So, realtime functionality with Prisma Because, as a lot of you are going to know, that, with Prisma 2, we don’t really have a native GraphQL layer in Prisma anymore So, in Prisma 1, we had this native support for realtime and GraphQL subscriptions that we don’t have any more in Prisma 2 So, a lot of people keep asking, how do I now do this with Prisma 2? And, in fact, there are a couple of different ways how you can implement subscriptions with Prisma, and they all have their own kind of use cases and benefits And the first one that I quickly just want to show, I prepared a little example that you can actually also find in the Prisma examples repo, which is just my go to whenever I need some kind of straightforward way to use Prisma in a specific context So, here we have this GraphQL subscriptions example Subscriptions-pubsub, it’s called And I already cloned the repo and have it here on my machine And here, I just quickly want to show you the mechanism that is used to implement subscriptions here So, the way how that works is, actually, that you manually trigger a subscription in your mutation resolvers So, mutations are the operations on GraphQL that cause some kind of side effects on the backend And this is typically also when you want to send out notifications to clients that are interested in these kinds of events So, in this case– – One thing, Nico, are you wanting to share your screen? You’re not right now, if you were wanting to share – Thank you for letting me know, because I thought I was sharing. (laughs) There you go, there’s my screen Sorry you were also missing out on the #learninpublic that I showed on my own screen without anybody else seeing it And the profile of Sean, here, as well So, if you wanna look that up, that’s what #learninpublic is about But I was talking about the subscriptions-pubsub example that you can find in the Prisma examples repo And I have it here locally on my machine And the way how it’s being set up is that you have this PubSub object that you’re getting from Apollo server, but actually Apollo servers’ just bundling it Originally, it comes from the GraphQL subscriptions package So, if you’re not using Apollo server, but another GraphQL server, such as Express GraphQL, for example, then you could just use the GraphQL subscriptions package directly, and import PubSub from there Here, we are using Apollo server, so we can import it from there And here is now how you can use this So, here we have our mutation resolvers, and, basically, just, what you need to do is, well, actually, I should start here I should start where you define the actual subscription yourself, the subscription type So, in this case, we are defining one subscription that’s called latestPost, and it’s also implemented with the PubSub object that is being attached

to the context right here And for those of you who have no idea what subscriptions actually are, and what they look like, I can give a very quick demo of that So, empty start Here, increase the font a bit So, that subscriptions type that is being defined here, and that has one field that’s called latestPost that you can also see here So, the fact that we are defining this, I want it, where was it? No, that’s still the old one, sorry This So, this latestPost field, here, is defined right here, and it’s of type post, and that’s what we see in the GraphQL schema right here If we now wanted to use that subscription, and listen for the latest post event, we can just write a subscription, in the same syntax that we’re already used to from CRUDs and mutations We can also ask for the fields that should be provided upon each event And then I can click the Play button in the playground, but unlike for CRUDs and mutations, this is not going to resolve immediately, but it’s just going to start, and start listening for events that are happening And these events can now be triggered with this ctx.pubsub.publish function that you can invoke You have to pass the name of the event, so, of the subscription field, in order to associate it with that And the data that’s being returned from here will also be the data, or actually the data, yeah, I guess that’s the one that’s the payLoad here, and that’s also the post right here So, if I now were to send this mutation, then we see that we receive an event here, and it still keeps listening So, if I wanted to have a new event with another random title, I can just go ahead, and these are going to pop up here So, subscriptions are a mechanism that allows developers to just listen for events, with GraphQL And a lot of people are wondering how do they implement that on the server side with Prisma? Well, here is how This is one way of doing this, but you can also trigger this pubsub.publish thing You can trigger that also, basically, in other contexts So, you could also use the recently introduced use function, the middleware function of Prisma client, to trigger these kinds of events And instead of triggering it inside of a mutation resolver, you could configure the prisma.use function Let’s see, where do I have my Prisma client? You could do something like this Use, and, here, basically, you would provide a function that had called upon specific Prisma client queries, and that’s where you would then invoke or push to the PubSub object, basically And the third option is that you could also just implement this based on native database triggers So, if you don’t want to trigger the subscriptions based on the events that are happening in your application code, but rather, based on events that are happening in your database, you can also configure native database triggers with SQL, and catch those in your application code, and then, again, push to this PubSub object right here That’s one thing that’s very commonly requested by our community, and other ideas would be, or things that are commonly requested, are, how to build a Relay front-end with a Prisma backend Again, that’s kind of, these two things, they don’t directly interface with each other, because you have the GraphQL layer in between, and Relay really just cares about talking to GraphQL, and doesn’t really care about what’s behind GraphQL In this case, that’s Prisma, but it could be any other database access mechanism, basically So, yeah, you have these three ways, and you could also write a tutorial about Relay with GraphQL If you wanna do that, we are happy to help you promote your content So, feel free to reach out to us, and we can see if we can maybe help you promote it, on Twitter, with a retweet, or something like this I think we are fairly flexible in that regard – For sure, and if anyone is wanting to do content, and wants feedback on your drafts,

or what you’ve put out there, please feel free to hit any of us up on that, and we’d be happy to help you with some of the more, I guess, just, meta things about content The way that it’s written, or the way it’s recorded, etc We’d be happy to help with that as well – Cool, alright – I think that’s all we got here – Yeah, I think we’re coming to the end Were there any questions in the chat? It seems like people were eager to comment, but not a lot of questions, as of today – Yeah, I guess the only concrete one is, did we phase out Prisma Cloud? And– – Yes – Maybe you could just even touch on the heart of this question, coming from Prisma 1, and I’m not super familiar with what the offering was at Prisma 1, but maybe you could just, maybe, for those who don’t know, kind of touch on that – Yes, yes Very happy about this question, actually, and about the opportunity to clarify here So, what Prisma Cloud actually is, was a web API, or just like web GUI, basically, that would help you host and manage your Prisma 1 server So, really, what Prisma Cloud was all about was about helping you with the monitoring, setup, configuration, of your Prisma 1 server As you know, Ryan, once we released Prisma 2, we got rid of this extra standalone Prisma server component that people have to host themselves, even So, there is no Prisma server anymore that people could be hosting with Prisma Cloud So, in that sense, the entire purpose of what Prisma Cloud used to be is now obsolete, because the Prisma server doesn’t exist anymore So, in that sense, we also don’t have a current offering for Prisma Cloud that would relate to Prisma 2 in any way So, Prisma Cloud, as it stands now, is just a way to help you with your Prisma 1 server, and therefore, it’s really only related to Prisma 1 In Prisma 2, we don’t have an equivalent for that yet, and there also is no need for an equivalent, because there is no Prisma server anymore – Yep, good call Yeah, I think that’s the only question that we’ve got, really – Yes – Yeah, so, if you have more questions next time, feel free to put ’em in, and yeah, next one will be in two weeks, at the same time, on the same day, two weeks from now – Yes, exactly Looking forward to see you then again, Ryan – Absolutely, all right – Have a nice one, bye – Bye bye