All Projects → watscho → Express Graphql Mongodb Boilerplate

watscho / Express Graphql Mongodb Boilerplate

Licence: mit
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Express Graphql Mongodb Boilerplate

Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-46.87%)
Mutual labels:  api, scratch, redis, mongodb, express, authentication, authorization, token, boilerplate, verification, docker-compose
Securing Restful Apis With Jwt
How to secure a Nodejs RESTful CRUD API using JSON web tokens?
Stars: ✭ 301 (+4.51%)
Mutual labels:  api, mongoose, mongodb, express, authentication, authorization
Blog Service
blog service @nestjs
Stars: ✭ 188 (-34.72%)
Mutual labels:  api, graphql, mongoose, redis, mongodb, express
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (+109.38%)
Mutual labels:  api, mongoose, redis, mongodb, express, token
Mern Boilerplate
Fullstack boilerplate with React, Redux, Express, Mongoose, Passport Local, JWT, Facebook and Google OAuth out of the box.
Stars: ✭ 112 (-61.11%)
Mutual labels:  mongoose, mongodb, express, authentication, authorization, boilerplate
Nodejs Api Boilerplate
A boilerplate for kickstart your nodejs api project with JWT Auth and some new Techs :)
Stars: ✭ 364 (+26.39%)
Mutual labels:  mongoose, mongodb, express, boilerplate, docker-compose
Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (+633.33%)
Mutual labels:  api, mongoose, redis, mongodb, boilerplate
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (+2.78%)
Mutual labels:  api, mongoose, redis, mongodb, express
Express Mongoose Es6 Rest Api
💥 A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+876.04%)
Mutual labels:  mongoose, mongodb, express, authentication, boilerplate
Wertik Js
💪 A library that powers your app with GraphQL + Rest API
Stars: ✭ 56 (-80.56%)
Mutual labels:  api, graphql, mongoose, mongodb, boilerplate
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-66.67%)
Mutual labels:  api, mongoose, mongodb, authentication, authorization
Express Graphql Boilerplate
Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 201 (-30.21%)
Mutual labels:  graphql, express, authentication, boilerplate
Graphql Mongodb Server
A GraphQL MongoDB server.
Stars: ✭ 242 (-15.97%)
Mutual labels:  graphql, mongodb, express, boilerplate
Intro To Graphql
[Course] Introduction to GraphQL
Stars: ✭ 175 (-39.24%)
Mutual labels:  graphql, mongoose, mongodb, express
Spruce
A social networking platform made using Node.js and MongoDB
Stars: ✭ 399 (+38.54%)
Mutual labels:  api, mongoose, mongodb, express
Frisky
🍿 Open Source GraphQL API for Online Shows
Stars: ✭ 161 (-44.1%)
Mutual labels:  graphql, mongoose, mongodb, express
Rest Api Nodejs Mongodb
A boilerplate for REST API Development with Node.js, Express, and MongoDB
Stars: ✭ 672 (+133.33%)
Mutual labels:  api, mongodb, express, boilerplate
Github Create Token
Create a Github OAuth access token.
Stars: ✭ 6 (-97.92%)
Mutual labels:  api, authentication, authorization, token
Express Es6 Rest Api
🔋 Starter project for an ES6 RESTful Express API.
Stars: ✭ 2,401 (+733.68%)
Mutual labels:  api, mongoose, express, boilerplate
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (-49.65%)
Mutual labels:  graphql, mongoose, mongodb, authentication

express-graphql-mongodb-boilerplate

Also express-mongodb-rest-api-boilerplate - REST-API Boilerplate

GitHub license

Authentication from scratch

Sign In, Sign Up, Reset Password, Change Password, Update User

E-mail verification, Multi language, Redis for token blacklisting

Package list

Package Description
bcryptjs Optimized bcrypt in JavaScript with zero dependencies. Compatible to the C++ bcrypt binding on node.js and also working in the browser.
cors CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
crypto-random-string Generate a cryptographically strong random string
dotenv Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.
ejs Embedded JavaScript templates
email-templates Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more! Made for sending beautiful emails with Lad.
express Fast, unopinionated, minimalist web framework for node.
express-graphql Create a GraphQL HTTP server with any HTTP web framework that supports connect styled middleware, including Connect itself, Express and Restify.
graphql The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.
graphql-compose GraphQL – is a query language for APIs. graphql-js is the reference implementation of GraphQL for nodejs which introduce GraphQL type system for describing schema (definition over configuration) and executes queries on the server side. express-graphql is a HTTP server which gets request data, passes it to graphql-js and returned result passes to response.
graphql-compose-mongoose This is a plugin for graphql-compose, which derives GraphQLType from your mongoose model. Also derives bunch of internal GraphQL Types. Provide all CRUD resolvers, including graphql connection, also provided basic search via operators ($lt, $gt and so on).
i18next i18next is a very popular internationalization framework for browser or any other javascript environment (eg. node.js).
i18next-express-middleware This is a middleware to use i18next in express.js.
ioredis A robust, performance-focused and full-featured Redis client for Node.js.
jsonwebtoken This was developed against draft-ietf-oauth-json-web-token-08. It makes use of node-jws
module-alias Create aliases of directories and register custom module paths in NodeJS like a boss!
moment A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
mongoose Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks.
nodemailer Send e-mails from Node.js – easy as cake!
validator A library of string validators and sanitizers.
winston A logger for just about everything.

Redis

Mac (using homebrew):

brew install redis

Linux:

sudo apt-get install redis-server

First, we use yarn - workspaces with lerna

Introducing Yarn Workspaces

cd workspaces/api

COPY .env.example to .env

cp .env.example .env

Note: I highly recommend installing nodemon.

nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected. nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node, to use nodemon replace the word node on the command line when executing your script. yarn global add nodemon.

API Start

yarn start
yarn start:local # with nodemon

Docker compose

docker-compose up -d --build
docker-compose -f docker-compose.dev.yml up --build # with nodemon

ESlint Start

yarn lint
yarn lint:write # with prefix --fix

API Structure

├─ src
│  ├─ graphql
│  │  ├─ index.js
│  │  ├─ schema.js
│  │  └─ types.js
│  ├─ i18next
│  │  ├─ locales
│  │  │  ├─  en.json
│  │  │  └─  ge.json
│  │  └─ index.js
│  ├─ middleware
│  │  ├─ authentication.js
│  │  ├─ authMiddleware.js
│  │  └─  index.js
│  ├─ module
│  │  ├─ auth
│  │  │  ├─ mail
│  │  │  │  ├─ index.js
│  │  │  │  └─ userMail.js
│  │  │  ├─ service
│  │  │  │  ├─ index.js
│  │  │  │  └─ userService.js
│  │  │  ├─ index.js
│  │  │  ├─ resolvers.js
│  │  │  ├─ types.js
│  │  │  └─ user.js
│  │  └─ index.js
│  ├─ service
│  │  ├─ logger.js
│  │  └─ nodemailer.js
│  ├─ validator
│  │  ├─ index.js
│  │  └─ userValidator.js
│  ├─ view
│  │  └─ template
│  │     ├─ reset-password
│  │     │  └─ html.ejs
│  │     ├─ verify
│  │     │  └─ html.ejs
│  │     └─ verify-request
│  │        └─ html.ejs
│  ├─ index.js
│  ├─ mongoose.js
│  └─ redis.js
├─ .dockerignore
├─ .env.example
├─ .eslintignore
├─ .eslint
├─ .gitignore
├─ Dockerfile
├─ Dockerfile.dev
├─ LICENSE
├─ README.md
├─ docker-compose.dev.yml
├─ docker-compose.yml
└─ package.json

Note: To continue development, you should learn about graphql-compose - this is the library that I use to write the API, you can read about it at the link: docs

Queries

query user {
  user {
    _id
    email
    firstName
    lastName
    locale
    account {
      verification {
        verified
      }
    }
    updatedAt
    createdAt
  }
}

Mutations

mutation signIn($email: String!, $password: String!) {
  signIn(email: $email, password: $password) {
    accessToken
  }
}

mutation signUp($email: String!, $password: String!) {
  signUp(email: $email, password: $password) {
    accessToken
  }
}

mutation logout {
  logout {
    succeed
  }
}

mutation verifyRequest {
  verifyRequest {
    succeed
  }
}

mutation verify($token: String!) {
  verify(token: $token) {
    accessToken
  }
}

mutation resetPassword($email: String!) {
  resetPassword(email: $email) {
    succeed
  }
}

mutation newPassword($token: String!, $newPassword: String!) {
  newPassword(token: $token, newPassword: $newPassword) {
    accessToken
  }
}

mutation changePassword($currentPassword: String!, $newPassword: String!) {
  changePassword(currentPassword: $currentPassword, newPassword: $newPassword) {
    succeed
  }
}

mutation updateUser($email: String!, $firstName: String!, $lastName: String!) {
  updateUser(email: $email, firstName: $firstName, lastName: $lastName) {
    _id
    email
    firstName
    lastName
    locale
    account {
      verification {
        verified
      }
    }
    updatedAt
    createdAt
  }
}

mutation switchLocale($locale: Locale!) {
  switchLocale(locale: $locale) {
    _id
    email
    firstName
    lastName
    locale
    account {
      verification {
        verified
      }
    }
    updatedAt
    createdAt
  }
}

Note: For any question issues

License

This project is an open-source with an MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].