Building a type-safe GraphQL server with Nexus and Prisma workshop
summary
Hands-on workshop builds a small blog GraphQL API with Nexus and Prisma: types and resolvers for Post, mutations createDraft and publishDraft, then replaces the in-memory array with a SQLite database via the Prisma plugin so resolvers call the Prisma client in context (findMany, create, update). Tests run as high-level system tests with Jest snapshot assertions and per-test databases. CLI workflow uses nexus dev and nexus build; subscriptions are not yet implemented and some attendees hit Prisma engine install/cache issues, but the demo queries, mutations and tests work end-to-end.
AI-written summary · about
chapters (30)
- 0:00Start
- 16:49I Will Ask You Also before We Start the Workshop To Raise Your Hand if You Have Already Set Up Everything so that We Can Start once Everything Has Done Its if You Haven't Then Please Take Your Time Just Loan and Meanwhile What I'Ll Do Is Quickly Present What We'Ll Build in the End so as Jason Mentioned We Are Going To Build a Blog Application a Simple One Which I Am Going To Present to You Now So Give Me a Few Seconds I Will Present the Blog Application Only from the Consumer Perspective
- 19:47Once this Draft Is Created We Can Make Sure that We Have that Draft in Our List There We Go I Did Too this Is Exactly the Droplet We'Ve Published We Can Try by the Way To Remove the Headers To Make Sure that We Can Know that Says the Data without Being Authenticated if I Run the Query Now It Tells Us Not Authorized but Let's Bring It Back once We Have the Draft We Can Now Publish It So I'Ll Make Sure To Put the Json Web Token Again We Run the Publish Mutation on the Draft That Has an Id-There We Go We'Ve Just Published the Draft
- 28:39And It Is Absolutely Necessary that You Run the Def Command while You Work on this Is What Everyday during the during the Tutorial during the Workshop so that You Get Proper Feedback about around Auto Completion and Typers as You as You Make Changes to Your Schema We Plan To Lift that Limitation Later by Creating a Vs2 Extension That Will Just Do that without You Having To Run a Comment but for Now that's Limitation so Please Please Please if You See that You Have Type Errors and Expected Type Errors
- 32:48And the Reason Is It's Really a Format That Is Human Friendly and Super Easy To Read It and So It Really Gives a Super Nice Overview without Even Going into the Code It Really Gives a Nice Overview of the Changes That Were Applied to the Schema Where You Can at a Glance See whether There Was a Breaking Change What What Fields Were Added and It's Maybe Even like a Better Place To Put Comments about Different Changes That You'Ve Made Your Estimate so that's Why We Generated by Default You Can Disable It if You Don't Like It
- 48:27Creating Our in-Memory Database
- 49:52Add Structural Context
- 53:05Create a Draft
- 57:04Resolver
- 57:22Identify the Draft To Be Published
- 59:45Recap
- 1:02:10Polymorphic Relations
- 1:14:16Dependencies
- 1:14:56System Tests
- 1:16:42Create a Helper Style
- 1:31:12Backing Types
- 1:33:04Root Type
- 1:44:04Install Nexus Plug-In
- 1:45:11Enable Plugins and Mixes
- 1:46:37Define a Data Source
- 1:48:04Model Our Database Schema
- 1:48:36Create the Migration File
- 1:55:38Integration Tests
- 1:59:48Create a Post
- 2:04:44Global Defaults
- 2:10:09Migration Process
- 2:11:38Personal Introspection
- 2:17:58Testing
- 2:18:34Testing with Prisma
- 2:29:58Live Show
