<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vincent Gitonga</title>
    <description>The latest articles on DEV Community by Vincent Gitonga (@vingitonga).</description>
    <link>https://dev.to/vingitonga</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F912120%2F03f2db18-2032-406e-b8cd-e18aa21f3c07.jpeg</url>
      <title>DEV Community: Vincent Gitonga</title>
      <link>https://dev.to/vingitonga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vingitonga"/>
    <language>en</language>
    <item>
      <title>Quiz app in Next JS and Redis</title>
      <dc:creator>Vincent Gitonga</dc:creator>
      <pubDate>Sat, 27 Aug 2022 21:12:37 +0000</pubDate>
      <link>https://dev.to/vingitonga/quiz-app-in-next-js-and-redis-4a63</link>
      <guid>https://dev.to/vingitonga/quiz-app-in-next-js-and-redis-4a63</guid>
      <description>&lt;h2&gt;
  
  
  Quiza
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://quiza-redis.vercel.app/" rel="noopener noreferrer"&gt;Quiza&lt;/a&gt; is an online platform whereby organizers, administrator or even tutors can setup and schedule quizzes for their students. The students can in turn signin and take the quizes scheduled and get results right away.&lt;/p&gt;

&lt;p&gt;Quiz organizers can set the quiz to be private, such that only students who have the unique quiz code can be able to enroll and take the quiz.&lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots 📸
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;HomePage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://iili.io/4CF6Is.md.jpg" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fiili.io%2F4CF6Is.md.jpg" alt="4CF6Is.md.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Login&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://iili.io/4ISrqG.md.jpg" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fiili.io%2F4ISrqG.md.jpg" alt="4ISrqG.md.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Join a private quiz using a Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://iili.io/4CKHhb.md.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fiili.io%2F4CKHhb.md.png" alt="4CKHhb.md.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Taking a quiz&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://iili.io/4CKJQj.md.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fiili.io%2F4CKJQj.md.png" alt="4CKJQj.md.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview Video 🎥
&lt;/h2&gt;

&lt;p&gt;Here a short video that explains how the quiz app works&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iYcgkOwa09Q"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works 🤔
&lt;/h2&gt;

&lt;p&gt;An organizer or a tutor first registers with our app. There after he/she can login. An organizer can create a new quiz, schedule when the quiz will allow students to take and also if they the quiz is private or public.&lt;/p&gt;

&lt;p&gt;A public quiz allows any student to enroll and take the quiz.&lt;br&gt;
For a private quiz, a student can only enroll to quiz if they have a unique quiz code.&lt;/p&gt;

&lt;p&gt;After a quiz is created, an organizer adds new questions to the quiz and options with correct answer.&lt;br&gt;
Then after submission, the questions are saved on Redis Database.&lt;/p&gt;

&lt;p&gt;A student can also create an account with quiza and login. A student can enroll to new quiz and also unenroll to existing quiz.&lt;br&gt;
A student can view all public quizzes and enroll and also enroll to a private quiz using a unique quiz code.&lt;/p&gt;

&lt;p&gt;Once a student is enrolled, now can be able to take the quiz. Student clicks the start button, the backend confirms if the quiz is open, the backend retrieves all the questions for a quiz and stores in Redis Cache. Then UI redirects student to take quiz page.&lt;/p&gt;

&lt;p&gt;The student starts attempting the questions with a time set.&lt;br&gt;
Once the student submits the questions, the backend creates a score for the student.&lt;/p&gt;

&lt;p&gt;The backend also saves all the responses in Redis Database.&lt;/p&gt;

&lt;p&gt;Thereafter the student can view quiz attempt results.&lt;br&gt;
Also the student can attempt a quiz multiple times and results stored separately.&lt;/p&gt;

&lt;p&gt;The app has a private leaderboard for each quiz inregardless of quiz attempts by each student.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it was built ⚙
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://quiza-redis.vercel.app/" rel="noopener noreferrer"&gt;Quiza&lt;/a&gt; is built using &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next JS&lt;/a&gt;, which is the framework for React JS library. &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next JS&lt;/a&gt; is used to manage the frontend and also the server side via its awesome server-side rendering features.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next JS&lt;/a&gt; we take advantage of dynamic routing for routing various pages in the frontend UI and also in the server side when managing api routes.&lt;/p&gt;

&lt;p&gt;In the project, we utilized a number of third party libraries for faster development and improved auth security.&lt;/p&gt;

&lt;p&gt;During the development of UI, used &lt;a href="https://chakra-ui.com/" rel="noopener noreferrer"&gt;Chakra-UI&lt;/a&gt; to build the frontend UI, &lt;a href="https://swr.vercel.app/docs/with-nextjs" rel="noopener noreferrer"&gt;SWR&lt;/a&gt; a library for client side data fetching. SWR was used mostly in fetching data from the api (backend) which in turn retrieved data from Redis Database.&lt;/p&gt;

&lt;p&gt;For the app authentication, used &lt;a href="https://next-auth.js.org/" rel="noopener noreferrer"&gt;Next-Auth&lt;/a&gt;, an authentication solution for Next JS. Next-Auth was utilized in managing user logged sessions both in frontend and backend thus only allowing authenticated users can perform some actions in the web app.&lt;/p&gt;

&lt;p&gt;For the database, our app used Redis Database as the primary database for storage of information of users and quizzes. In order to interact with the redis database, we utilized &lt;a href="https://github.com/redis/redis-om-node" rel="noopener noreferrer"&gt;Redis-OM&lt;/a&gt;, a Node JS library for redis that enables storage of JSON objects in Redis database. It also gives access to native redis-cli commands such as saving cache in redis directly which was pretty handy when storing questions in Redis cache whenever a student is taking a quiz and marking correct responses from a student.&lt;/p&gt;
&lt;h2&gt;
  
  
  Submission Category : MERN Mavericks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use Redis in the api(backend) to add caching and advanced searching capabilities using JSON and Search modules.&lt;/li&gt;
&lt;li&gt;Use Redis as a primary database instead of MongoDB&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Languages Used
&lt;/h2&gt;

&lt;p&gt;JavaScript (Next JS)&lt;/p&gt;
&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/VinGitonga" rel="noopener noreferrer"&gt;
        VinGitonga
      &lt;/a&gt; / &lt;a href="https://github.com/VinGitonga/quiza_redis" rel="noopener noreferrer"&gt;
        quiza_redis
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Quiza is online quiz platform where you can setup and practise quizzes. Runners Up Redis and Dev Hackathon 2022 🎉
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;&lt;em&gt;Quiza&lt;/em&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Quiza is an online platform whereby organizers, administrator or even tutors can setup and schedule quizzes for their students. The students can in turn signin and take the quizes scheduled.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Screenshots 📸&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;HomePage&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://iili.io/4CF6Is.md.jpg" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/05f012dad46cde53f93bba8e30a26312aba4deb408e4a2d2efc6084831c81c09/68747470733a2f2f69696c692e696f2f3443463649732e6d642e6a7067" alt="4CF6Is.md.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Join a private quiz using a Code&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://iili.io/4CKHhb.md.png" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/4563bead7724a40f74c5e9524c537c0654666ab0aa9662e955033cf67ace0ca7/68747470733a2f2f69696c692e696f2f34434b4868622e6d642e706e67" alt="4CKHhb.md.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Taking a quiz&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://iili.io/4CKJQj.md.png" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/d7bfac149d4b3834e65edcc29fcd6bd96932cea758b3d26e603f6946853c7950/68747470733a2f2f69696c692e696f2f34434b4a516a2e6d642e706e67" alt="4CKJQj.md.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Overview Video 🎥&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Here a short video that explains how the quiz app works&lt;/p&gt;
&lt;p&gt;&lt;a href="https://youtu.be/iYcgkOwa09Q" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/05f012dad46cde53f93bba8e30a26312aba4deb408e4a2d2efc6084831c81c09/68747470733a2f2f69696c692e696f2f3443463649732e6d642e6a7067" alt="Embed your YouTube video"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How it works&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;An organizer or a tutor first registers with our app.
There after he/she can login. An organizer can create a new quiz,
schedule when the quiz will allow students to take and also if they the quiz is private or public.&lt;/p&gt;
&lt;p&gt;A public quiz allows any student to enroll and take the quiz.
For a private quiz,
a student can only enroll to quiz if they have a unique quiz code.&lt;/p&gt;
&lt;p&gt;After a quiz is created, an organizer adds new questions to the quiz and options with correctAnswer
Then…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/VinGitonga/quiza_redis" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries" rel="noopener noreferrer"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight" rel="noopener noreferrer"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to" rel="noopener noreferrer"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
      <category>javascript</category>
      <category>nextjs</category>
      <category>redis</category>
    </item>
  </channel>
</rss>
