node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


NPM version Build Status Coverage Status npm


A simple quizzes API server and Single Page Application powered by Nodejs, Expressjs, Vuejs and Redis.


Install NodeJS


$ npm install quizzy


$ yarn add quizzy


Prerequisite : Populate the used redis db with some quizzes (alternative : use POST /quizzes API)

  1. Create a configured quizzy instance with Quizzy factory
  2. start() : starts the server
  3. stop() : closes the server
const Quizzy = require('quizzy')
const quizzy = Quizzy(/*myCustomConfig*/)
  .then(() => {

Features :

  • Play a quiz session with the SPA
  • Sign in with your Google, Twitter, or Facebook account
  • Create and manage quizzes and sessions via APIs
  • i18n compliant

Anatomy of the project

Help about the project structure


Static assets (css, images, ...)


This directory contains all the Single Page Application code powered by Vuejs.

The client part is based on VueJS with vue-i18n, vue-router, and vuex (it can also be used as a boilerplate project for VueJS)


Vuejs used components

  • style.css : styles applied to the single page app

Vuejs views

  • home.vue : welcome view displayed for default routes and when not logged in
  • quiz.vue : main vue that shows quiz questions and post answers to API server
  • quiz-result.vue : shows the quiz result with score and evaluation if enabled in config


This directory contains all the server code powered by Nodejs.


Contains all the routes exposed by the express app, including APIs and OAuth2 endpoints


Contains all the JSON schemas of entities, in YAML format.

  • store : Used to store the data model (quizzes and sessions) into memory or redis (feel free to code another implementation)
    • index.js : Generic store interface
    • memory-store.js : Simple store implementation in-memory
    • redis-store.js : Store implementation for a Redis database server
  • body-parser.js : Extended body parser compatible with JSON or YAML payload
  • errors.js : Custom error classes used in the project
  • json-validator.js : JSON schema validator used by the store to validate entities before persist them
  • redis-cli.js : A simple Redis client
  • view-renderer.js : Custom HTML view renderer powered by lodash template

Configuration loader


Util functions


Main module of the app. It exports a server component with a factory, init, start and stop methods if required by another module else it runs the server.


Unit tests in the form of mocha specs


Expressjs views used to render HTML pages

More information

The best way to understand how quizzy works is to have a look at unit tests

Build the project

Install dependencies :

$ npm install


$ yarn

Build the cli bundle :

$ npm run build

Note :

  • The bundle file is created into assets/app directory
  • if NODE_ENV is set to production, the bundle is uglyfied/minified without sourcemaps.

Start the server :

$ npm start

Note : if NODE_ENV is set to development, the server is started with nodemon and webpack middleware is used to hot reload the cli.


Enjoy !