Skip to content
This repository was archived by the owner on Mar 21, 2021. It is now read-only.
/ nap Public archive

[Deprecated] NextJS + Apollo + PassportJS

License

Notifications You must be signed in to change notification settings

rabbotio/nap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ece9e66 · Jul 12, 2017
Jun 19, 2017
Feb 2, 2017
Jul 8, 2017
Mar 27, 2017
May 3, 2017
Jun 7, 2017
Jun 7, 2017
Mar 15, 2017
Feb 12, 2017
Mar 23, 2017
Jul 12, 2017
Apr 25, 2017
Mar 19, 2017
Jul 11, 2017
Jul 7, 2017
Feb 22, 2017
Mar 22, 2017
May 2, 2017
Jul 7, 2017
Jan 29, 2017
Jul 5, 2017
Jul 8, 2017
Jul 7, 2017
Jul 5, 2017
Jul 5, 2017
May 3, 2017
Jul 8, 2017
Jul 12, 2017
Jul 11, 2017

Repository files navigation

Commitizen friendly

nap

[WIP] NextJS/ApolloJS/PassportJS Build in Next JS for SSR, Apollo Client for GraphQL, Passport JS for authentication, Docker for development and production.

Overview

○ Docker
├─ ○ NodeJS
│  ├─ ○ NextJS
│  │  ├─ ./pages      : /usr/app/pages
│  │  ├─ ./components : /usr/app/components
│  │  ├─ ./lib        : /usr/app/lib
│  │  ├─ ./routes     : /usr/app/routes
│  │  └─ ./server     : /usr/app/server
│  │
│  ├─ ○ Apollo
│  │  └─ ./graphql    : /usr/app/graphql
│  │
│  └─ ○ PassportJS
│     └─ ./providers  : /usr/app/providers
│
├─ ○ Redis            : redis://redis
│  └─ data            : /data
│
└─ ○ MongoDB          : mongodb://mongo/graphql
   └─ data            : /data/db

Stacks

Extras


Configurations

Copy from .env.example template and .env as you wish

cp .env.example .env

Develop

# Will build and run then attach with docker compose (it take sometime for first build)
npm run up-dev

# Try modify files and see the HMR result
open http://localhost:3000

# Try modify file in ./graphql and see the result via GraphiQL
open http://localhost:3000/graphql

Debug

  • Server side : Use VSCode and press F5 to attach with nodejs
  • Client side : Use Chrome Dev Tool

Addition

# Will kill all and tear down
npm run down

# Will dive into container
npm run in

Production

# Will pull image and run with docker compose (won't build)
npm run up

Test

# Will need to run server for integration test (WIP)
npm run up-dev

# To test all with Jest
npm run test

# To see coverage
npm run cover

Passport (cookie)

Passport (token via GraphQL)


Client example

DOING

  • Optional asking for user from facebook graph query.
  • Link facebook-token with auth/facebook user.
  • Link facebook-token with auth/email user.
  • Unlink Facebook via React web.
  • Handle cookies via React Native

TODO

TOTEST

  • Redis fail test.
  • MongoDB fail test.
  • HTTP fail test.
  • HTTPS fail test.
  • Unit test graphql-compose.
  • Basic signin test.
  • Passport test.
  • Sessions expire test.
  • Chaos testing with pumba

TOCUSTOM

TOHAVE