See Tailwind-css version (https://github.com/Sinamics/typegraphql-jwt-typeorm-auth/tree/tailwind)
- Boiler plate project for
- apollo-server-express
- type-graphql
- graphql-codegen
- typescript
- typeorm
- mongodb
- JWT
- Semantic-Ui React (https://react.semantic-ui.com/)
- React Lazy Loading with Suspense
- Express Server (port 4000)
- type-Graphql Entry Point (/graphql)
- Graphql Playground Page (http://localhost:4000/graphql)
- 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
- username Sign In
- 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
- Install dependencies
npm i
- Create
.env
file with the following variables in the project root folder:
SERVER_PORT=4000
ACCESS_TOKEN_SECRET=somerandomkey
REFRESH_TOKEN_SECRET=anotherrandomkey
REFRESH_TOKEN_LIFE="7 days"
ACCESS_TOKEN_LIFE="10s"
PROD_MONGO_CONNECTION=""
DEV_MONGO_CONNECTION="mongodb://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