Question

GraphQL API server for a Postgres database?

I’m building a single-page app that loads data via a graphql API.

What are my options for setting up a simple graphql API in front of a Postgres database?

I’m already running a digitalocean postgres database cluster. Ideally, I’d like to have the graphql API service running in a Docker container so I can automate deployment.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
August 5, 2019
Accepted Answer

Hi aha,

I’ll try and provide you with the best options I’ve seen so far:

Digital Ocean’s own tutorial

If you are a looking for a quick integration of GraphQL with PostgreSQL while utilizing Docker, you can take a look at the following DO tutorial : https://www.digitalocean.com/community/tutorials/how-to-manually-set-up-a-prisma-server-on-ubuntu-18-04

The tutorial guides you trough the setup of a Prisma Server on your droplet. It will act as a proxy for your database.

Having said that, before you can actually follow the tutorial and do setup the Prisma server, you’ll need to get ready for it. There are a couple of initial requirements :

An Ubuntu 18.04 server.

Docker installed -

Docker Compose installed

Node.js installed

Now, all this is added to the tutorial however we as people tend to skip some important information, so I believe it’s better to point it out.

The process itself is very well explained in the tutorial itself so it should be no trouble actually following it up.

Another good way to get what you need

If you wish to see a second setup, I’ll suggest checking postgraphile and the github page .

It’s using PostGraphile. PostGraphile pairs PostgreSQL with GraphQL all while providing a simple way to use Docker with it. Again, you have some requirements before actually getting to work but then again it’s inevitable :

  • Node v8.6+
  • PostgreSQL 9.6+ (officially; but currently works with 9.4+)
  • Linux, macOS or Windows

Once you do have them, you can configure PostGraphile with a few quick steps explained in the documentation

Before making a decision, I’ll suggest checking both examples and choosing the one that’s suited for your needs.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.