Skip to content
Permalink
Browse files

Update README.md (#83)

  • Loading branch information...
goldcaddy77 committed Apr 22, 2019
1 parent 7bb3039 commit 6def8b906de66a6f985925359b3670f3a9c45546
Showing with 51 additions and 16 deletions.
  1. +51 −16 README.md
  2. BIN img/github.png
  3. BIN img/warthog-logo.png
@@ -1,14 +1,28 @@
![img](./img/github.png?raw=true)
<p align="center">
<a href="http://warthog.dev/"><img src="./img/warthog-logo.png" width="400" alt="Warthog Logo"></a>
</p>

# Warthog - GraphQL API Framework
<p align="center">
Node.js <a href="https://graphql.org" target="_blank">GraphQL</a> 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.
</p>
[![npm version](https://img.shields.io/npm/v/warthog.svg)](https://www.npmjs.org/package/warthog)
[![CircleCI](https://circleci.com/gh/goldcaddy77/warthog/tree/master.svg?style=shield)](https://circleci.com/gh/goldcaddy77/warthog/tree/master)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Join the chat at https://gitter.im/warthog-graphql/community](https://badges.gitter.im/warthog-graphql/community.svg)](https://gitter.im/warthog-graphql/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<p align="center">
<a href="https://www.npmjs.org/package/warthog"><img src="https://img.shields.io/npm/v/warthog.svg" alt="npm version"></a>
<a href="https://circleci.com/gh/goldcaddy77/warthog/tree/master"><img src="https://circleci.com/gh/goldcaddy77/warthog/tree/master.svg?style=shield" alt="CircleCI"></a>
<a href="#badge"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier"></a>
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release"></a>
<a href="https://gitter.im/warthog-graphql/community?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://badges.gitter.im/warthog-graphql/community.svg" alt="Join the chat at https://gitter.im/warthog-graphql/community"></a>
</p>
Opinionated framework for building GraphQL APIs with strong conventions. With Warthog, set up your data models and the following are automatically generated:
## Summary
Warthog is a [Node.js](http://nodejs.org) GraphQL API framework for quickly building consistent GraphQL APIs that have sorting, filtering and pagination out of the box. It is written in [TypeScript](http://www.typescriptlang.org) and makes heavy use of decorators for concise, declaritive code.
## Philosophy
This library is intentionally opinionated and generates as much code as possible. When teams build products quickly, even if they have strong conventions and good linters, the GraphQL can quickly become inconsistent, making it difficult for clients to consume the APIs in a reusable way.
To do this, Warthog automatically generates the following:
- Database schema - generated by [TypeORM](https://github.com/typeorm/typeorm)
- Your entire GraphQL Schema including:
@@ -18,20 +32,33 @@ Opinionated framework for building GraphQL APIs with strong conventions. With W
- A [graphql-binding](https://github.com/graphql-binding/graphql-binding) for
type-safe programmatic access to your APIs.
- TypeScript classes for the generated GraphQL schema for type-safety while developing.
- Automatic validation before data is saved using any of the decorators available in the [class-validator](https://github.com/typestack/class-validator#validation-decorators) library.
Further, it covers the following concerns by hooking into best-in-class open source libraries:
- Validation: Automatic validation before data is saved using any of the decorators available in the [class-validator](https://github.com/typestack/class-validator#validation-decorators) library.
## Warning
The API for this library is still subject to change. It will likely shift until version 2, at which time it will become stable. I'd love early adopters, but please know that there might be some breaking changes for a few more weeks.
The API for this library is still subject to change. It will likely shift until version 2, at which time it will become stable. I'd love early adopters, but please know that there might be some breaking changes until v2.
## Prerequisites
You must have Postgresql installed to use Warthog. If you're on OSX and have [Homebrew](https://brew.sh/) installed, you can simply run:
You must have Postgresql installed to use Warthog. If you already have it installed, you can skip this step, otherwise there are 3 options:
### Docker
See the [warthog-starter](https://github.com/goldcaddy77/warthog-starter/pull/6/files) project for how to use Docker to run Postgres.
### Homebrew
If you're on OSX and have [Homebrew](https://brew.sh/) installed, you can simply run:
```bash
brew install postgresql
```
### Postgres.app
Otherwise, you can install [Postgres.app](https://postgresapp.com/) or use the Google machine to figure out how to install on your OS.
## Usage
@@ -212,6 +239,14 @@ All config is driven by environment variables. Most options can also be set by
| TYPEORM_USERNAME | DB username | _none_ | _none_ |
| TYPEORM_PASSWORD | DB password | _none_ | _none_ |

## Field/Column Decorators

All of the auto-generation magic comes from the decorators added to the attributes on your models. Warthog decorators are convenient wrappers around TypeORM decorators (to create DB schema) and TypeGraphQL (to create GraphQL schema). You can find a list of decorators available in the [src/decorators](./src/decorators) folder. Most of these are also used in the [examples](./examples) folder in this project.

If you need to add a column to the DB that does not need to be exposed via the API, you should just use [the TypeORM decorators](https://github.com/typeorm/typeorm/blob/master/docs/decorator-reference.md)

If you need to add a field that is only exposed via the API that is not DB-backed, you should just use [the TypeGraphQL Field Decorator](https://github.com/19majkel94/type-graphql/blob/master/src/decorators/Field.ts)

## Intentionally Opinionated

Warthog is intentionally opinionated to accelerate development and make use of technology-specific features:
@@ -222,12 +257,12 @@ Warthog is intentionally opinionated to accelerate development and make use of t

## Thanks

Special thanks to the authors of:
Special thanks to:

- [TypeORM](https://github.com/typeorm/typeorm)
- [TypeGraphQL](https://github.com/19majkel94/type-graphql)
- [Prisma](https://github.com/prisma/prisma)
- [Logo design Richardbmx](https://github.com/richardbmx)
- [TypeORM](https://github.com/typeorm/typeorm) - DB generation
- [TypeGraphQL](https://github.com/19majkel94/type-graphql) - GraphQL generation
- [Prisma](https://github.com/prisma/prisma) - [OpenCrud](https://github.com/opencrud/opencrud) conventions
- [richardbmx](https://github.com/richardbmx) - Logo design

Warthog is essentially a really opinionated composition of TypeORM and TypeGraphQL that uses similar GraphQL conventions to the Prisma project.

BIN -43.1 KB img/github.png
Binary file not shown.
BIN +36.3 KB img/warthog-logo.png
Binary file not shown.

0 comments on commit 6def8b9

Please sign in to comment.
You can’t perform that action at this time.