Code Monkey home page Code Monkey logo

graphql-modules-typescript-starter's Introduction

GraphQL ๐Ÿ‡ Starter with GraphQL Modules ๐ŸŒฟ

It is a full fledged ๐Ÿ‘Œ setup using Node.js, Express (Typescript, express-graphql), GraphQL Modules with other utilities. Graphql Modules give you enterprise grade tooling ๐Ÿ˜Ž for seperation of concern under an application with DI(dependency injection, services, middlewars and more ๐Ÿš€). The graphql modules application outputs a single schema for the GraphqlHTTP (express-graphql or apollo server).

Following feature is covered in initial commit for User Entity in HelloWorld

  • ๐Ÿ“ Registration
  • ๐Ÿ”“ Login & Authentication
  • ๐Ÿ” Authorization
  • ๐Ÿ“ Additional features like winston logger setup, codegen, tsconfig, API docs generation and HMR with ts-node, nodemon, cors with node.js server setup, and ws inspection for graphql

Technology Stack

  • Node.js 16+ latest ATM(at the moment)
  • Express 4+ latest ATM
  • GraphQL Modules 1.4+ latest ATM
  • TypeScript 4.4+ latest ATM

Requirements

NodeJS

Yarn Yarn is used to manage API server dependencies, so we're going to need that. You can install it using Homebrew (or any of the other methods mentioned in the install docs):

Getting Started

After cloning go to the directory & then install the dependencies

yarn install

Start server

Create your own local .env file in the top-level directory. Make sure it's formatted like sample.env with the right credentials. T

Run in development mode

yarn dev

Run in development mode with node inspect

yarn dev-debug

Run in production mode

yarn prod

Testing

Manual Testing

Goto localhost://http://localhost:4000/graphql after yarn dev

Run a mutation to register user and create JWT token (in HelloWorld it maintains a server side array instead of DB ๐Ÿ˜‚ ),

mutation register($input: Register!) {
  register(input: $input) {
    email,
    name,
    token,
    id
  }
}
// variables
{
  "input": {"name": "Hello", "email": "[email protected]", "password": "123"}
}

Login with this mutation

mutation login($input: Login){
  login(input: $input){
    id,
    name, 
    email
  }
}
// variables
{
  "input": {"email": "[email protected]", "password": "123"}
}

Automated tests

WIP

graphql-modules-typescript-starter's People

Contributors

ahmadalibaloch avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.