Examplary
Start for free
Developer docs

Question types

Examplary comes with a set of question types that can be used to create interactive tests. An app can add its own question types, to extend the platform with new kinds of questions.

A question type is part of an app: once a workspace installs the app, its question types can be used in that workspace's tests.

Process

Building a question type involves the following steps:

  1. Write its definition and add it to your app
  2. Implement components for various views (assessment, print, etc.)
  3. Optionally configure AI generation and grading
  4. Publish the app to the Examplary platform

Adding a question type to your app

Each question type is a QuestionType capability, usually defined in its own folder:

short-answer/definition.ts
import { QuestionType } from "@examplary/apps";
 
export default new QuestionType({
  id: "com.acme.quiz.short-answer",
  name: { en: "Short answer" },
  description: { en: "A question that requires a short text response." },
  icon: "./short-answer/icon.svg",
  components: {
    assessment: "./short-answer/component-assessment.tsx",
    print: "./short-answer/component-print.tsx",
  },
});

Your app then adds it in app.ts:

app.ts
import { defineApp } from "@examplary/apps";
 
import ShortAnswer from "./short-answer/definition";
 
const app = defineApp({
  id: "com.acme.quiz",
  name: { en: "Acme Quiz" },
  description: { en: "Extra question types for your tests" },
});
 
app.addCapability(ShortAnswer);
 
export default app;

An app can add as many question types as you like. When you publish a new version of the app, its question types are updated with it.

Directory structure

We recommend a folder per question type, with its definition, components, an icon.svg, and optionally a README.md and preview image:

acme-quiz/
├── app.ts
├── package.json
└── short-answer/
    ├── definition.ts
    ├── icon.svg
    ├── README.md
    ├── preview.png
    ├── component-assessment.tsx
    └── component-print.tsx

All paths in a definition are relative to app.ts, like ./short-answer/icon.svg.

Examples

You can find the source code of the default question types in the default-questions-pack repository. It's an app like any other, which comes pre-installed with Examplary.

It serves as a great reference for how to structure your own question types and what components you might need to implement, and is a good starting point for your own question types.