Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Warthog Logo

This is a minimal example of using the (Warthog GraphQL API library. Warthog is a Node.js GraphQL Framework for building APIs with strong conventions through auto-generated code. With Warthog, set up your data models and resolvers, and it does the rest.

CircleCI styled with prettier Join the chat at

Play with API

This project is currently running on Heroku at Feel free to play around with it.

Development Setup

To get things set up in development, where everything will run in ts-node,

  1. Ensure postgres is running and update env.yml with the postgres config. If you have a password for the postgres admin user, add DBPASS to env.yml under DBUSER. For example, you could run docker run --detach --publish 5432:5432 -e POSTGRES_PASSWORD=password --name 'warthog-starter' postgres:10.12
  2. run yarn bootstrap.

Running the server

Run yarn build && yarn start to run the server.

Using GraphQL Playground

When you run yarn start, it will run graphql-playground at the printed URL. When in the playground, you can issue queries and mutations against the API.

Running tests

Run yarn test to run tests

Running in Production Mode

In Production mode, you'll need to build and run the compiled code. To do this locally, run:

yarn start

Generating Migrations

When you're ready to check in your feature, you'll need to generate a DB migration. This can automatically be done by running:

yarn db:migrate:generate user-and-post

This will drop a migration in the db folder. To run it and create the schema in your DB, run:

yarn db:migrate

Generating a new resource

To generate a new model, service and resolver, run warthog generate <model-name>. So for example:

warthog generate like

...or if you want to bootstrap with some fields:

warthog generate author name! nickname numLogins:int! verified:bool! registeredAt:date balance:float!

Some notes about this format:

  • First param (author above) is always the resource name (required)
  • Each subsequent item is a separate field/column that will be added to the model
  • The format is fieldName:datatype, with an optional ! at the end to mark the field required and non-nullable (otherwise it's optional)
  • datatype must be one of the following: bool, date, int, float, string
  • If datatype is missing, it's assumed to be string


Warthog GraphQL API minimal sample application







No releases published


No packages published