Skip to content

A full fledged πŸ‘Œ node.js server with graphql modules 🌿 using graphql-express with typescript and other required server toolings πŸ“ for developing and bundling

License

Notifications You must be signed in to change notification settings

ahmadalibaloch/graphql-modules-typescript-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

About

A full fledged πŸ‘Œ node.js server with graphql modules 🌿 using graphql-express with typescript and other required server toolings πŸ“ for developing and bundling

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published