1.0.8 • Published 4 years ago

express-generator-node-typescript-apollo-graphql-mongo-cli v1.0.8

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

BTC 3B2R9u6dpJyWB4U6iDWC14y9yejnF5hsSN Buy me a coffee Ko-fi

Express Generator CLI for Node with Typescript, Apollo GraphQL Server and MongoDB with Mongoose

This CLI helps to create new implemented API demo for Node with Typescript, Apollo GraphQL Server and MongoDB with Mongoose from a boilerplate.

About the NPM Package

Package Installation

npm install -g express-generator-node-typescript-apollo-graphql-mongo-cli

Package Usage

Go to the directory on terminal where you want to generate the project.

$ cd PATH

and run the generator command with specifying the project name.

$ express-generator-ntagm --name="PROJECT_NAME"

For more information you can check this article: https://www.linkedin.com/pulse/create-graphql-api-2-minutes-using-node-typescript-apollo-t%C3%BCrker/

Documentation for the Boilerplate

When you generate the project, you will have;

Tech Stack

Features

  • Multiple GraphQL Queries with implementations in Typescript
  • Multiple GraphQL Mutations with implementations in Typescript
  • Multiple GraphQL Schemas with implementations in Typescript
  • Multiple Controllers with implementations in Typescript
  • Multiple Mongoose Models with implementations in Typescript
  • MongoDB Connection, Repository Layer implementations in Typescript
  • CRUD operations for Multiple Entities with implementations in Typescript

Architecture

This boilerplate has common graphql api design architecture. Layers:

  • Controllers holds implementation for the business logic, like retrieving data from repositories, returning those data to queries and mutations, saving data etc.
  • Database holds MongoDB connection provider
  • Models holds document interfaces, schema definitions and models for MongoDB & Mongoose
  • Mutations holds basic mutation implementation; create, update, delete
  • Queries holds basic query implementation; retrieve
  • Resolvers holds resolver definitions for Apollo Server
  • Schemas holds schema definitions for Apollo Server

Installation

Install the dependencies and devDependencies:

$ cd <Project Name>
$ npm install

Set environment parameters on .env:

PORT="{{PORT NUMBER WHERE THE APP WILL WORK}}"
MONGO_DB_PATH="{{MONGODB CONNECTION URL STRING}}"

And that's all, start the server

$ npm start

Documentation for the Generator Project

Tech Stack

Plugins

express-generator-ntagm is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

PluginUsage
ejsto render global parameters like Project Name
inquirerto ask questions and parse input
shelljsto eliminate your shell script's dependency on Unix
yargsto build interactive command line tools
shxto wrap around ShellJS Unix commands
ts-nodeto execute TypeScript and REPL for node.js, with source map support

Installation

express-generator-ntagm requires Node.js v10+ to run.

Install the dependencies and devDependencies and start the application.

$ cd express-generator-node-typescript-apollo-graphql-mongo
$ npm install
$ npm start

To install the CLI globally:

$ npm run-script build
$ npm install -g .

And global usage:

$ express-generator-ntagm --name="PROJECT_NAME"

Authors

  • Fatih Türker

Sponsors

No sponsors yet! Will you be the first?

Contributors

No contributers yet! Will you be the first?

License


MIT