Quizmaster stores all quiz data, user accounts, and results in a MySQL database. This page walks you through creating the database, connecting the application, and understanding how the schema and initial admin user are managed automatically on startup.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/geeky-hamster/Quizmaster/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
You need a running MySQL instance version 5.7 or 8.x. Quizmaster uses Sequelize with themysql2 driver, so either version works. Confirm your MySQL version with:
Setup
Create the database
You can create the database manually or use the provided script.Option A — use the npm script:This runs
ts-node scripts/create-mysql-db.ts, which connects using your DB_* environment variables and creates the database if it does not already exist.Option B — create manually in MySQL:Configure environment variables
Create a See Environment variables for the full variable reference.
.env file in the backend directory. You can provide individual connection parameters or a single connection string..env (individual parameters)
Schema auto-sync
Quizmaster calls
sequelize.sync({ alter: true }) every time the server starts. This creates any missing tables and adds or modifies columns to match the current model definitions. Existing rows are preserved. You do not need to run migrations manually during development or after upgrades.alter: true strategy is suitable for development and straightforward deployments. For production databases with strict change-control requirements, consider replacing it with explicit Sequelize migrations before going live.
Admin user seeding
After the schema sync completes, Quizmaster checks whether any admin account exists. If none is found, it creates a default admin automatically:| Field | Value |
|---|---|
| Username | admin@quizmaster.com |
| Password | admin123 |
| Role | admin |
Connection pool settings
When using individualDB_* variables (not a connection string), Sequelize is configured with the following pool:
| Setting | Value | Description |
|---|---|---|
max | 5 | Maximum concurrent connections in the pool. |
min | 0 | Connections kept open when the pool is idle. |
acquire | 30000 | Milliseconds to wait before throwing a timeout. |
idle | 10000 | Milliseconds before an idle connection closes. |
Using a connection string
.env (connection string)
DATABASE_URL is accepted as an alias for MYSQL_URL.