See Semantic-ui React version (https://github.com/Sinamics/typegraphql-jwt-typeorm-auth)
- Boiler plate project for
- apollo-server-express
- type-graphql
- graphql-codegen
- typescript
- typeorm
- mongodb
- JWT
- Tailwindcss (https://tailwindcss.com/docs)
- React Lazy Loading with Suspense
- Express Server (port 4000)
- type-Graphql Entry Point (/graphql)
- Graphql Playground Page (http:https://localhost:4000/graphql)
- Graphql Subscription
- Typeorm Settings For MongoDB
- Typeorm Decorators for hasRole (@hasRole(roles: [user, superuser]))
- Basic User Entity (backend/graphql/entity/Users.ts)
- JasonWebToken (JWT) accessToken / refreshToken cookie for authorization.
- username Sign Up with graphql authorization error display.
- username Sign In with graphql authorization error display
- Install mongodb on your computer
- Install
npm i typescript concurrently ts-node-dev -g
- Clone package:
git clone https://github.com/Sinamics/typegraphql-jwt-typeorm-auth.git --branch tailwind
- Install dependencies
npm i
- Create
.env
file with the following variables on the project root folder:
SERVER_PORT=4000
ACCESS_TOKEN_SECRET=somerandomkey
REFRESH_TOKEN_SECRET=anotherrandomkey
REFRESH_TOKEN_LIFE="7 days"
ACCESS_TOKEN_LIFE="30s"
PROD_MONGO_CONNECTION=""
DEV_MONGO_CONNECTION="mongodb:https://localhost/graphqljwtauth"
- run the project
npm start
- This project uses graphql-codegen, and if you make any changes to the .graphql files you need to generate new hooks
npm run codegen
- If you changes any Tailwind configuration, generate new css file with
npm run build:css