Giter Club home page Giter Club logo

graphql-boilerplate's Introduction

Graphql Boilerplate

This is a boilerplate for using Graphql with an orm and authentication.

A quick documenation about folder structures and some pitfalls I have entcountered can be found Documentation

Roadmap

This boilerplate is in heavy development. More features will be added over time:

  • Basic Express functionality (Routes for graphql, graphiql)
  • Basic orm support (TypeOrm)
  • RootQuery plus example queries
  • Resolvers
  • Mutations
  • Authentication
  • Tests

Usage

To use this boilerplate following steps have to be done:

  • Clone this project
  • Install dependecies npm install or yarn
  • Create and configure app. Configuration
  • Start dev mode npm run dev or yarn run dev

Dependencies

  • ts-node (to run typescript code easy) npm install -g ts-node
  • database (to store data) My suggestion for development is sqlite
  • node (should I really mention this :D)

Configuration

To configure a few aspects like the database or the port this boilerplate uses the .env file. There is a .env.example file in the root folder of the project. Copy it or rename it to .env and add the right values. Remember this file is meant to hold local configuration and will not be pushed to your repo.

Database

To persist data a database is needed. For development I suggest sqlite3. It is easy to use and install:

npm install sqlite3 or yarn add sqlite3.

The database is installed as default database in this project. If you don't want to use it, uninstall and remove it.

Example Config

This example config can be pasted straight into the .env file to test. For more information about the configuring databases have a look at the docs of typeorm

TYPEORM_DRIVER_TYPE=sqlite
TYPEORM_STORAGE=database.db
TYPEORM_ENTITIES=src/entities/*.ts
TYPEORM_AUTO_SCHEMA_SYNC=true
TYPEORM_LOGGING_QUERIES=true
TYPEORM_LOGGING_FAILED_QUERIES=true

graphql-boilerplate's People

Stargazers

 avatar

Watchers

 avatar  avatar

graphql-boilerplate's Issues

Add example resolvers

Add a few example resolvers.

  • Add resolver with args
  • Add resolver to fetch a list
  • Add entity with relation and a resolver for that

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.