Git Product home page Git Product logo

hamed-hasan / quiz-management-frontend Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 411 KB

๐Ÿš€ Dive into the world of quizzes with our interactive Quiz Management App! ๐Ÿง โœจ Built with Next.JS, Typescript, Redux, Express, PostgreSQL, and Prisma. Admins can effortlessly create, edit, and delete quizzes, while performers enjoy a dynamic quiz-taking experience with random questions and instant feedback. ๐ŸŒ๐Ÿ’ก Join us on this learning adventure!

JavaScript 1.36% CSS 0.87% TypeScript 97.77%
authentication express nextjs postgresql prisma quiz-management redux role-based-access typescript quiz-creation

quiz-management-frontend's Introduction

๐Ÿš€ Quiz Management App

Overview

Quiz Management App is a robust application designed to facilitate the creation, management, and tracking of quizzes. Developed using Next.js, Typescript, Redux, Express, PostgreSQL, and Prisma, this app provides a seamless and engaging experience for both admins and performers.

Features

๐ŸŽญ User Authentication:

  • Roles: Admin, Performer.
  • Effortless sign-up, log-in, and account management.

๐Ÿ“ Quiz Management:

  • Admins can create, edit, and delete quizzes.
  • Intuitive categorization (e.g., frontend, fullstack).
  • Support for both single and multiple-choice questions.

๐ŸŽฏ Quiz Taking:

  • Performers select a category and answer 10 random questions.
  • Instant feedback and real-time score calculation.
  • Leaderboard showcasing top performers.

๐Ÿ“Š Score Tracking:

  • Efficient storage and display of user scores.

๐Ÿ› ๏ธ Database:

  • Utilizes PostgreSQL with Prisma ORM for optimal data handling.

๐Ÿšจ Error Handling:

  • Robust mechanisms ensure a smooth user experience.

๐ŸŒ User-Friendly Interface:

  • Next.js and Redux contribute to a clean and intuitive UI.

Entity-Relationship Diagram (ERD)


+---------------------+      +------------------------+      +----------------------+
|        User         |      |        Profile         |      |         Quiz         |
+---------------------+      +------------------------+      +----------------------+
| id                  |      | id                     |      | id                   |
| email               |      | userId          -----> |      | title                |
| password            |      | username        <---- |      | category             |
| needsPasswordChange |      | firstName              |      | creatorId            |
| role                |      | lastName               |      | createdAt            |
| createdAt           |      | dateOfBirth            |      | updatedAt            |
| updatedAt           |      | phoneNumber            |      |                      |
|                     |      | address                |      |                      |
|                     |      | bio                    |      |                      |
|                     |      | profileImage           |      |                      |
|                     |      | createdAt              |      |                      |
|                     |      | updatedAt              |      |                      |
|                     |      |                        |      |                      |
|                     |      |                        |      |                      |
|                     |      |                        |      |                      |
|                     |      |                        |      |                      |
+---------------------+      +------------------------+      +----------------------+
        |                       |
        |                       |
        V                       V
+---------------------+      +---------------------+      +---------------------+
|       Question      |      |        Answer       |      |        Score        |
+---------------------+      +---------------------+      +---------------------+
| id                  |      | id                  |      | id                  |
| content             |      | content             |      | score               |
| correctOptionId     |      | isCorrect           |      | userId              |
| quizId        -----> |      | questionId   -----> |      | quizId        -----> |
|                     |      |                     |      | createdAt           |
|                     |      |                     |      | updatedAt           |
|                     |      |                     |      |                     |
|                     |      |                     |      |                     |
|                     |      |                     |      |                     |
|                     |      |                     |      |                     |
+---------------------+      +---------------------+      +---------------------+


Main Routes

  • POST /api/v1/: Root route to include all sub-routes.

Auth Routes

  • POST /api/v1/auth/register: Register a new user.
  • POST /api/v1/auth/login: Log in a user.
  • POST /api/v1/auth/refresh-token: Refresh the authentication token.
  • POST /api/v1/auth/change-password: Change the password of a user.

Profile Routes

  • GET /api/v1/profiles/all-profile: Get all profiles.
  • GET /api/v1/profiles/specific-profile/:userId: Get a specific profile by userId.
  • PATCH /api/v1/profiles/update-profile/:userId: Update a profile by userId.
  • DELETE /api/v1/profiles/delete-profile/:userId: Delete a profile by userId.

Quiz Management Routes

  • POST /api/v1/quizzes/: Create a new quiz.
  • PUT /api/v1/quizzes/:id: Edit a quiz by ID.
  • DELETE /api/v1/quizzes/:id: Delete a quiz by ID.

Score Routes

  • GET /api/v1/scores/:userId: View scores for a user.
  • GET /api/v1/scores/leaderboard/:category: Get the leaderboard for a specific category.

Quiz Tracking Routes

  • GET /api/v1/quizzesTack/:id/start: Start a quiz by ID.
  • POST /api/v1/quizzesTack/:id/submit: Submit answers for a quiz by ID.

User Routes

  • GET /api/v1/users/all-users: Get all users.
  • GET /api/v1/users/:id: Get a user by ID.
  • PUT /api/v1/users/:id: Update a user by ID.
  • DELETE /api/v1/users/:id: Delete a user by ID.

API ENDPOINTS & DATA

Auth Routes

POST /api/v1/auth/register

  • Register a new user.

Request Body:

{
  "email": "[email protected]",
  "password": "securepassword"
}

POST /api/v1/auth/login

  • Log in a user.

Request Body:

{
  "email": "[email protected]",
  "password": "securepassword"
}

POST /api/v1/auth/refresh-token

  • Refresh the authentication token.

Request Body:

{
  "refreshToken": "your_refresh_token"
}

POST /api/v1/auth/change-password

  • Change the password of a user.

Request Body:

{
  "oldPassword": "old_securepassword",
  "newPassword": "new_securepassword"
}

Profile Routes

GET /api/v1/profiles/all-profile

  • Get all profiles.

GET /api/v1/profiles/specific-profile/:userId

  • Get a specific profile by userId.

PATCH /api/v1/profiles/update-profile/:userId

  • Update a profile by userId.

Request Body:

{
  "username": "new_username",
  "firstName": "new_firstname",
  "lastName": "new_lastname",
  "dateOfBirth": "new_dateOfBirth",
  "phoneNumber": "new_phoneNumber",
  "address": "new_address",
  "bio": "new_bio",
  "profileImage": "new_profileImage"
}

DELETE /api/v1/profiles/delete-profile/:userId

  • Delete a profile by userId.

Quiz Management Routes

POST /api/v1/quizzes/

  • Create a new quiz.

Request Body:

{
  "title": "New Quiz",
  "category": "Science",
  "questions": [
    {
      "content": "Question 1",
      "options": [
        {"content": "Option A", "isCorrect": true},
        {"content": "Option B", "isCorrect": false}
      ],
      "correctOptionId": 1
    }
  ]
}

PUT /api/v1/quizzes/:id

  • Edit a quiz by ID.

Request Body:

{
  "title": "Updated Quiz Title",
  "category": "Updated Science",
  "questions": [
    {
      "content": "Updated Question 1",
      "options": [
        {"content": "Updated Option A", "isCorrect": true},
        {"content": "Updated Option B", "isCorrect": false}
      ],
      "correctOptionId": 1
    }
  ]
}

DELETE /api/v1/quizzes/:id

  • Delete a quiz by ID.

Score Routes

GET /api/v1/scores/:userId

  • View scores for a user.

GET /api/v1/scores/leaderboard/:category

  • Get the leaderboard for a specific category.

Quiz Tracking Routes

GET /api/v1/quizzesTack/:id/start

  • Start a quiz by ID.

POST /api/v1/quizzesTack/:id/submit

  • Submit answers for a quiz by ID.

Request Body:

{
  "answers": [
    {"questionId": "question_id_1", "selectedOptionId": 1},
    {"questionId": "question_id_2", "selectedOptionId": 2}
  ]
}

User Routes

GET /api/v1/users/all-users

  • Get all users.

GET /api/v1/users/:id

  • Get a user by ID.

PUT /api/v1/users/:id

  • Update a user by ID.

Request Body:

{
  "email": "[email protected]",
  "password": "new_securepassword",
  "role": "admin"
}

View the API documentation on Postman here.

Setup

  1. Clone the repo:

    git clone https://github.com/Hamed-Hasan/Quiz-management-frontend.git
  2. Install dependencies:

    npm install
  3. Configure PostgreSQL and Prisma:

    • Set up a PostgreSQL database.
    • Configure the connection details in the Prisma configuration file (prisma/schema.prisma).
  4. Run the app seamlessly:

    npm start

Usage

  • Admins log in to effortlessly manage quizzes.
  • Performers sign up or log in for a seamless quiz-taking experience.
  • Create, manage, and partake in quizzes with ease.

Contributing

  1. Fork the repository.
  2. Develop your feature in a dedicated branch.
  3. Submit a pull request for seamless integration.

License

MIT License - Details

Feel free to open issues for feedback or contribute to enhancing the quiz experience. Happy quizzing! ๐Ÿง โœจ

quiz-management-frontend's People

Contributors

hamed-hasan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.