Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Latest commit

 

History

History
176 lines (149 loc) · 7.43 KB

README.md

File metadata and controls

176 lines (149 loc) · 7.43 KB

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