Skip to content

This article will teach you how to build a full-stack CRUD App with Next.js, React Query, GraphQL Code Generator, React-Hook-Form, Zod, and graphql-request to perform Create/Update/Get/Delete operations.

Notifications You must be signed in to change notification settings

wpcodevo/nextjs-typegraphql-api

 
 

Repository files navigation

GraphQL API with Next.js & MongoDB: Access & Refresh Tokens

This article will teach you how to build a GraphQL API with Next.js to implement JWT Authentication using apollo-server-micro, TypeGraphQL, MongoDB, Redis, Mongoose, and Typegoose.

GraphQL API with Next.js & MongoDB: Access & Refresh Tokens

Topics Covered

  • Initialize a Typescript Next.js Project
  • Setup MongoDB and Redis Database Servers
  • Setting up Environment Variables
  • Connect the Redis and MongoDB Servers to Next.js
    • Connect to the MongoDB Server
    • Connect to the Redis Server
  • Start the GraphQL Apollo Server
  • Creating TypeGraphQL and Typegoose Schemas
    • Creating the Typegoose Schema
    • Creating the TypeGraphQL Schemas
  • Creating an Error Handler
  • Create Utility Functions to Generate and Verify JWTs
    • How to Generate the Private and Public Keys
  • Create an Authentication Guard
  • Creating the Authentication Services
    • Service to Register the User
    • Service to Sign in the User
    • Service to Get the Authenticated User
    • Service to Refresh the Access Token
    • Service to Logout the User
  • Create the TypeGraphQL Resolvers
  • Update the GraphQL Server
  • Testing the GraphQL API in Postman

Read the entire article here: https://codevoweb.com/graphql-api-next-mongodb-access-and-refresh-tokens

Articles in this series::

  1. GraphQL API with Next.js & MongoDB: Access & Refresh Tokens
  2. Next.js, GraphQL-CodeGen, & React Query: JWT Authentication
  3. GraphQL CRUD API with Next.js, MongoDB, and TypeGraphQL
  4. Next.js Full-Stack App with React Query, and GraphQL-CodeGen

About

This article will teach you how to build a full-stack CRUD App with Next.js, React Query, GraphQL Code Generator, React-Hook-Form, Zod, and graphql-request to perform Create/Update/Get/Delete operations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published