Simple and quick-to-set-up project for self-hosted quizzes, with users answers saved in browser storage
This project is open for contributions, whether it's through raising issues, submitting pull requests, or suggesting improvements.
To deploy it for free, you can utilize Vercel and leverage their free database option.
- Quizzes are accessed via their slug, defined in the "quizz" parameter of the URL.
- Currently, all quiz, question, and answer creation is done directly in the database; there's no interface for that yet.
- Utilizes Dexie for storing user answers in browser storage.
- Usage of SCSS for the app's style.
- Prerender is disabled to allow
$page.url.searchParams.get('quizz')
- The project was built using ``@vercel/postgres`, Vercel's PostgreSQL package for serverless functions
Table qe_quizz
, columns :
id
: integer, primary keytitle
: varchar, supports HTMLdescription
: varchar, nullable, supports HTMLslug
: varchar, used to access the quiz in url, should not contain special characters except "-", or spacesopen
: boolean, allows users to start the quizz or not (hides the "start" button)retry
: boolean, allows users to re-start the quizz or not (hides the "restart" button)lang
: varchar, defines the interface language (like buttons text), supports "en" (default) or "fr"
Table qe_questions
, columns :
id
: integer, primary keyquizz_id
: integer, foreign key referencingqe_quizz
tabletitle
: varchar, supports HTMLdescription
: varchar, nullable, used to add more informations or hints to the question, supports HTMLtype
: varchar, supported types are "text", "url", "checkbox" and "radio"regex_check
: varchar, nullable, used to check answers when type is "text" or "url"
Table qe_answers
, columns :
id
: integer, primary keyquestion_id
: integer, foreign key referencingqe_questions
tablelabel
: varchar, label of the answeris_correct
: boolean, defines if the answer is correct of notexplanation
: varchar, nullable, provides indication to help the user understand why the answer is correct or not
To launch the project for the first time, remember to run npm install
and create the database with its tables. Additionally, create an .env
file and set up your paths for database information.
To start coding for the project, use npm run dev.
To create a production version : npm run build
.
You can preview the production build with npm run preview
.