Graphql-yoga: Is this project still alive?

Created on 27 Apr 2020  路  17Comments  路  Source: dotansimha/graphql-yoga

There hasn't been a commit in many months. Is this still the recommended way to create a graphql-server, or is there a better recommendation now like nexus or typegraphql?

Most helpful comment

Also, can we update some of the dependencies? apollo-server-express is on a really old version (1.3.6) when latest is at (2.12.0).

All 17 comments

Also, can we update some of the dependencies? apollo-server-express is on a really old version (1.3.6) when latest is at (2.12.0).

The last thing I heard was that it isn't being maintained anymore.

Probably could write a mail or join the slack channel and ask about the status of this project. Would be a shame to see this project die.

This project should be maintained indeed!

For serverless, I've found that Apollo Server Lambda is even simpler than this. I've already migrated an API to it in under an hour and without mayor issues while keeping perfect compatibility.

I also wondered whether this project is still going to be maintained (as it certainly doesn't seem like it is) so I did some searching on the Prisma Slack and saw this from last week:

As for GraphQL Yoga, there won't be any new features added as the team is actively working on the Nexus framework.

I also wondered whether this project is still going to be maintained (as it certainly doesn't seem like it is) so I did some searching on the Prisma Slack and saw this from last week:

As for GraphQL Yoga, there won't be any new features added as the team is actively working on the Nexus framework.

I also settled down to Nexus framework. It's built by Prisma Labs so has great integration with Prisma.

Hi, @Jinsung-L. Thanks for your input. What are your thoughts on Nexus Framework? I was thinking about it around the time I migrated to Prisma 2 but after all the Prisma 2 API changes throughout the beta, I wanted to try and avoid any extra complication so I stuck with the standard Nexus and GraphQL Yoga setup. I should probably check Nexus Framework again now that some time has passed. Thanks again. Have a nice day.

So far I have great impression on the new Nexus framework. There aren't much differences from old Nexus in a way of defining GraphQL schema, but the main difference is that it now serves the api by it self and has neat CLI features.
These are the main factors for me to move from old @nexus/schema to Nexus framework.

  • First, I would definitely recommend to move from Prisma v1 to v2. Prisma 2 with Nexus framework have better integration through nexus-plugin-prisma.
  • graphql-yoga project seems outdated. Currently the best alternative is Apollo Server.
    But since Nexus framework serves its own server and planning to do so in future you can just use it.
  • The CLI feature, dev mode, is amazing. It automatically creates and updates the typescript definitions and SDL schema while you're developing.

If you're already familiar with code-first GraphQL schema definition through Nexus and Prisma 2, then there's almost no barrier to Nexus framework.

Here are some links:
https://www.prisma.io/docs/guides/upgrade-from-prisma-1/upgrading-nexus-prisma-to-nexus
https://www.prisma.io/docs/guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-nexus
https://www.nexusjs.org/#/tutorial/introduction

So far I have great impression on the new Nexus framework. There aren't much differences from old Nexus in a way of defining GraphQL schema, but the main difference is that it now serves the api by it self and has neat CLI features.
These are the main factors for me to move from old @nexus/schema to Nexus framework.

  • First, I would definitely recommend to move from Prisma v1 to v2. Prisma 2 with Nexus framework have better integration through nexus-plugin-prisma.
  • graphql-yoga project seems outdated. Currently the best alternative is Apollo Server.
    But since Nexus framework serves its own server and planning to do so in future you can just use it.
  • The CLI feature, dev mode, is amazing. It automatically creates and updates the typescript definitions and SDL schema while you're developing.

If you're already familiar with code-first GraphQL schema definition through Nexus and Prisma 2, then there's almost no barrier to Nexus framework.

Here are some links:
https://www.prisma.io/docs/guides/upgrade-from-prisma-1/upgrading-nexus-prisma-to-nexus
https://www.prisma.io/docs/guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-nexus
https://www.nexusjs.org/#/tutorial/introduction

@Jinsung-L Hey, I just started looking at Nexus! Quick question as I'm familiar with Prisma and GraphQL but not so much Nexus. Is Nexus a replacement for the possibly deprecated graphql-yoga?

@tedlin182 Yes. Nexus framework can completely replace graphql-yoga.
But keep in mind that Nexus framework only supports code-first development.
If you don't like code-first approach I suggest using Apollo Server.

Code-first vs. schema-first development in GraphQL

To be clear I'm talking about the new Nexus framework. Previous GraphQL Nexus only supports GraphQL schema definition and can work with graphql-yoga or Apollo Server but can't replace either.

@tedlin182 Yes. Nexus framework can completely replace graphql-yoga.
But keep in mind that Nexus framework only supports code-first development.
If you don't like code-first approach I suggest using Apollo Server.

Code-first vs. schema-first development in GraphQL

To be clear I'm talking about the new Nexus framework. Previous GraphQL Nexus only supports GraphQL schema definition and can work with graphql-yoga or Apollo Server but can't replace either.

@Jinsung-L Yup, the new Nexus Framework is what I'm looking at. I remembered the GraphQL Nexus and initially was confused, but I'm following the new framework now. Thanks for the article and info!

Thank you for all of that information, @Jinsung-L. It's very much appreciated.

This project is awsome but very outdated. I think it will be better to migrate from it to apollo-server or Nexus.

If you need subscriptions (like i do), you must use apollo-server untill Nexus 0.27 release

Yeah, I recently migrated to Apollo Server. It didn't take long and I've had no issues. 馃憤

another option that worked for us - just use graphql-js + graphql-tools + express-graphql/fastify.
You get the same experience and no need for extra overhead plus all those libraries are up to date and well maintained, you don't need to wait for Apollo or Prisma to update their dependencies...

We also add to those GraphQL Code Generator, but that's up to you and no need to set up special framework to get that, it's just another library

If someone needs help to migrate from Yoga, here is my migration code. Hope it can help you ;)
I use @nexus/schema, prisma and graphql-shield and subscriptions but you can easily omit it

server.ts

import { ApolloServer } from 'apollo-server'
import { applyMiddleware } from 'graphql-middleware'
import { createContext } from './context'
import { permissions } from './permissions'
import { schema } from './schema'

const port = process.env.PORT || 4000

new ApolloServer({
  schema: applyMiddleware(schema, permissions),
  context: createContext,
  subscriptions: {
    path: '/',
  },
}).listen({ port }, () =>
  console.log(`馃殌 Server ready at: http://localhost:${port}/`),
)

context.ts

import { PrismaClient } from '@prisma/client'
import { PubSub } from 'apollo-server'
import { Request, Response } from 'express'
import { ExecutionParams } from 'subscriptions-transport-ws'

const prisma = new PrismaClient()
const pubSub = new PubSub()

// See [Export 'ExpressContext' out of the main module. #3699](https://github.com/apollographql/apollo-server/issues/3699)
export interface ExpressContext {
  req: Request
  res: Response
  connection?: ExecutionParams
}

export interface Context extends ExpressContext {
  prisma: PrismaClient
  pubSub: PubSub
}

export function createContext(context: ExpressContext): Context {
  return {
    ...context,
    prisma,
    pubSub,
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

asci picture asci  路  3Comments

woss picture woss  路  5Comments

ramonmulia picture ramonmulia  路  3Comments

yesprasad picture yesprasad  路  3Comments

marktani picture marktani  路  5Comments