Powering next gen AI apps with Postgres 🚀 Learn More

Use Exograph with Neon

Build GraphQL backends in minutes with Exograph and Neon

This guide was contributed by the Exograph team

Exograph is a new approach to building GraphQL backends. With it, you can effortlessly create flexible, secure, high-performing GraphQL backends in minutes. Powered by a Rust-based runtime, Exograph ensures fast startup times, efficient execution, and minimal memory consumption. Exograph comes equipped with a comprehensive set of tools designed to support every stage of the development lifecycle: from initial development to deployment to ongoing maintenance.

Exograph supports Postgres for data persistence, which makes it a great fit to use with Neon.


Create a backend with Exograph

Let's create a starter project with Exograph. Run the following commands:

You can check the code it created by examining the src/index.exo file (which has a definition for the Todo type). If you would like, you can try the yolo mode by trying the exo yolo command.

Next, let's set up the Neon database.

Create the schema in Neon

  1. Navigate to the Neon Console, select your project, and copy the connection string (which will look something like postgres://...neon.tech/todo-db).
  2. Create schema in Neon using Exograph CLI:

Launch the backend

It will print the necessary information for connecting to the backend.

That's it! You can now open http://localhost:9876/playground in your browser to see the GraphQL Playground.

You can create a todo by running the following mutation:

To get all todos, try the following query:

And you should see the todo you just added. Please follow Exograph's guide to creating a simple application for more details.

Learn more

In this guide, we have created a basic todo backend using Exograph and Neon. You can extend this further by establishing relationships between types, implementing access control rules, and integrating custom business logic. Check out Exograph's application tutorial for more details.

To deploy Exograph in the cloud and connect it to Neon, follow the guide below (select the "External Database" tab for Neon-specific instructions in each case):

  1. Deploying on Fly.io (these instructions can be adapted to other cloud providers)
  2. Deploying on AWS Lambda
Edit this page
Was this page helpful?