Is it possible to have multiple Graphql Servers ta...
# prisma-whats-new
a
Is it possible to have multiple Graphql Servers talking to the same prisma database service, without having to define the datamodel on each server?
My idea is that I have multiple applications that have to interact with the same database, and in order to keep the load on the GraphQL server low, I would split the service up into multiple servers.
And in case I have to define the datamodel on each graphql server, which I think would make sense - would there be any conflicts where the types and fields are the same on multiple serves, when trying to write to the database?
a
You can have any number of Yoga servers all using the same
prisma-binding
a
I think I understand your suggestion. Right now I have been using the Advanced node-graphql-server boilerplate for my app, so I am however still unsure about how I would split up the /database and /src folder while still be able to access the generated
prisma.graphql
file that is added to the src/generated folder based on my datamodel.graphql in the /database folder.
a
You can create copies of
src
for every separate service, specify in your .graphqlconfig that the
prisma.graphql
should go into a 'shared' folder, and create additional 'app' projects in your
.graphqlconfig
for each service, each with its own public schema.
So your .graphqlconfig would look something like:
Copy code
projects:
  app:
    schemaPath: "src/schema.graphql"
    extensions:
      endpoints:
        default: "<http://localhost:4000>"
  app2:
    schemaPath: "app2/schema.graphql"
    extensions:
      endpoints:
        default: "<http://localhost:4010>"  
  database:
    schemaPath: "/shared/generated/prisma.graphql"
    extensions:
      prisma: database/prisma.yml
Not a perfect solution, but play around with the paths a bit until it makes sense and is easy to deploy.
If you want to create completely separate projects, you could always 'symlink' the prisma.graphql in from the 'master' project
a
Haven't given that a thought, thanks! With the new Prisma Cloud, I would only need a cluster for the database, and then I would host the servers on Now by Zeit for example?
a
Yes
a
Perfect! Thank you for enlightening me @agartha! 💪