Skip to content

kenulh3rath/global-voices

Repository files navigation

Description

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

Requirements Met

  • 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

Tech Stack


User Types

  • ADMIN
  • CREATOR
  • VIEWER

User Permissions

  • Admin

    • Create, Read and Delete To-Do Items
    • Read All Users
    • Update User Role
    • Delete a User
  • Creator

    • Create and Read To-Do Items
  • Viewer

    • Read To-Do Items

Users

First Name Last Name Role Email 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


File Structure

  • global-voices/server.js - GraphQL Server
  • global-voices/lib/apolloClient.ts - Apollo Client
  • global-voices/lib/prisma.ts - Prisma Client
  • global-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

Install Dependencies

Run the following command to install dependencies

  npm install

Generate Prisma Client

Run the following command to generate the Prisma Client:

  npx prisma generate

Apollo Server

Run the following command to start the Apollo Server:

  npm run graphql

Start the Development Server

Run the following command to start the development server:

  npm run dev

About

assessment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published