This is a simple To-Do List application that demonstrates,
- CRUD operations using GraphQL
- Authentication using NextAuth
- Authorization using a basic RBAC (Role-Based Access Control) system
- Built using Next.js
- Used GraphQL for database communication
- Used Prisma for ORM through GraphQL
- Used SQLite for database
- Used bcrypt for password hashing
- Used NextAuth for authentication
- Implemented password hashing and salting
- Implemented user-friendly interface for registration, login, and logout
- Locked the user out of the account after 5 incorrect login attempts
- Provided loading indicators during API requests
- Next.js - Framework
- Prisma - Database ORM
- GraphQL - Query Language
- Apollo Client - GraphQL Client
- ShadCn - Ready-to-use UI Components
- SQLite - Database
- TypeScript - Primary Language
- TailwindCSS - CSS Framework
- NextAuth - Authentication
- bcrypt - Password (Hashing, Comparing)
- React Icons - Icons
- ADMIN
- CREATOR
- VIEWER
-
Admin
Create
,Read
andDelete
To-Do ItemsRead
All UsersUpdate
User RoleDelete
a User
-
Creator
Create
andRead
To-Do Items
-
Viewer
Read
To-Do Items
First Name | Last Name | Role | Password | |
---|---|---|---|---|
Falito | Lovejoy | ADMIN | [email protected] | ceWP53"@_Os |
Nealy | Rowat | CREATOR | [email protected] | paAB56" |
Krissy | Gooderridge | CREATOR | [email protected] | oaYY07$ |
Lynn | Agates | VIEWER | [email protected] | swFU40, |
Steven | Baiyle | VIEWER | [email protected] | yzVR59~S |
Tammy | Aldis | VIEWER | [email protected] | rqPZ93> |
Generated using Mockaroo
global-voices/server.js
- GraphQL Serverglobal-voices/lib/apolloClient.ts
- Apollo Clientglobal-voices/lib/prisma.ts
- Prisma Clientglobal-voices/lib/authz.ts
- Authorization Policies
Note: For simplicity, I'm running GraphQL (Apollo) server and Next.js server in the same node.js process.
- Next.js - port
3000
- GraphQL - port
4000
Run the following command to install dependencies
npm install
Run the following command to generate the Prisma Client:
npx prisma generate
Run the following command to start the Apollo Server:
npm run graphql
Run the following command to start the development server:
npm run dev