Quiz Master PWA is a modular, progressive web application built with Vue 3, TypeScript, and Vite. It functions as an interactive quiz platform featuring session persistence, comprehensive statistics tracking, a gamified badge system, and a responsive, mobile-first design.
- Frontend Framework: Vue 3 (Composition API) with
<script setup>. - Build Tool: Vite 7.x.
- Language: TypeScript 5.x (Strict Mode).
- State Management: Pinia (3 stores:
useDataStore,useQuizStore,useStatsStore). - Styling: Tailwind CSS v4 with
@tailwindcss/postcss. - Routing: Vue Router 4.x (8 named routes).
- Persistence: Native IndexedDB implementation (wrapper in
src/db/) storing questions, sessions, categories, and metadata. - Icons: Phosphor Icons (via CDN).
- Visualization: Chart.js for statistics.
The project uses npm for dependency management and script execution.
- Install Dependencies:
npm install
- Development Server:
Starts the local development server at
npm run dev
http://localhost:5174with Hot Module Replacement (HMR). - Production Build:
Performs a full type-check (
npm run build
vue-tsc) and builds the optimized production assets todist/. - Preview Build:
Preview the production build locally.
npm run preview
- Unit Tests (Vitest):
npm run test:unit
- End-to-End Tests (Playwright):
(Requires
npm run test:e2e
npx playwright installfor first run). - Linting:
Runs Oxlint and ESLint with auto-fix capabilities.
npm run lint
- Formatting:
Formats code using Prettier.
npm run format
src/components/: UI components organized by domain (common,layout,quiz,stats,settings).src/views/: Page-level components mapping to routes.src/stores/: Pinia stores for global state logic.src/db/: IndexedDB configuration and repository pattern implementation.src/types/: Shared TypeScript interfaces (models.ts) and constants (constants.ts).
- Vue Components: Use the Composition API with
<script setup lang="ts">. - Typing: Strict TypeScript usage. All data models (Question, QuizSession, Badge) are defined in
src/types/models.ts. - Styling: Use Tailwind CSS utility classes. Custom styles are minimal and defined in
src/style.cssor via Tailwind configuration. - State Management: Logic for data manipulation (CRUD, game logic) resides in Pinia stores, not components. Components should trigger store actions.
- Asynchronous Operations: Use
async/awaitfor all DB interactions and data loading.
- Session Management: Quiz sessions are deeply copied before saving to DB to ensure immutability of historical data.
- Resume Capability: The app checks for incomplete sessions on mount and prompts the user via
BaseModal. - Repositories: Database operations are abstracted in
src/db/repositories.tsrather than accessingindexedDBdirectly in components.