Skip to content

Qzify is a REST API for managing online quizzes, offering endpoints for authentication, role-based user management, quiz creation, and attempt handling

Notifications You must be signed in to change notification settings

e-khalifa/qzify_backend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Qzify Online Examination System

Qzify is a REST API for managing online quizzes, offering endpoints for authentication, role-based user management, quiz creation, and attempt handling. It also includes security features such as JWT authentication, rate limiting, and protection against XSS and NoSQL injections.

📝 Table of Contents

  1. 🚀 Features
  2. 🌐 Deployment
  3. 🛠️ Installation
  4. 📖 Usage
  5. 📚 API Documentation
  6. 📂 Folder Structure
  7. 🌐 Environment Variables

🚀 Features

Authentication

  • User registration with email verification.
  • Login with JWT-based authentication.
  • Password reset via email.
  • Refresh token for session management.
  • Revoke access through JWT token versioning.

User Management

  • Admin-only access to manage users.
  • View, update, and delete user profiles.

Quiz Management

  • CRUD operations for quiz questions (create, update, delete, fetch).
  • Bulk question creation for efficiency.
  • Categorize questions by difficulty and topic.

Quiz Attempts

  • Start, continue, and submit quiz attempts.
  • Auto-submit expired attempts via cron jobs.
  • Scoring and detailed review of quiz results.

Security

  • Rate limiting to prevent abuse.
  • Protection against XSS and NoSQL injections.
  • Helmet for secure HTTP headers.

🌐 Deployment

The project is deployed on Railway. You can access the live version of the application at:

https://qzifybackend-production.up.railway.app

🛠️ Installation

Clone the Repository

git clone <repository-url>
cd qzify_backend

Install Dependencies

npm install

Configure Environment Variables

Create a .env file in the root directory and configure the following:

PORT=3000
DB_USER=<your-db-user>
DB_PASSWORD=<your-db-password>
DB_HOST=<your-db-host>
DB_OPTIONS=<your-db-options>
ACCESS_TOKEN_SECRET=<your-access-token-secret>
ACCESS_TOKEN_EXPIRY=15m
REFRESH_TOKEN_SECRET=<your-refresh-token-secret>
REFRESH_TOKEN_EXPIRY=7d
SEND_GRID_API_KEY=<your-sendgrid-api-key>
USER_EMAIL=<your-email>
FRONTEND_URL=http://localhost:3000

Start the Server

For development:

npm run dev

For production:

npm start

📖 Usage

API Endpoints

Refer to the API Documentation section for detailed information about available endpoints.

Swagger Docs

Access the interactive API documentation at /api/docs.

📚 API Documentation

For detailed information about each endpoint, refer to the API Routes Documentation.

Authentication

Users

Questions

Attempts

📂 Folder Structure

qzify_backend/
├── src/
│   ├── features/
│   │   ├── auth/          # Authentication logic
│   │   ├── users/         # User management
│   │   ├── questions/     # Quiz questions
│   │   └── attempts/      # Quiz attempts
│   ├── shared/
│   │   ├── config/        # Configuration files
│   │   ├── middleware/    # Middleware functions
│   │   ├── swagger/       # Swagger API docs
│   │   └── utils/         # Utility functions
│   └── app.js             # Express app setup
├── .gitignore             # Ignored files for Git
├── package.json           # Project metadata and dependencies
└── README.md              # Project documentation

🌐 Environment Variables

Variable Description
PORT Port number for the server.
DB_USER MongoDB username.
DB_PASSWORD MongoDB password.
DB_HOST MongoDB host.
DB_OPTIONS MongoDB connection options.
ACCESS_TOKEN_SECRET Secret for access tokens.
ACCESS_TOKEN_EXPIRY Expiry time for access tokens.
REFRESH_TOKEN_SECRET Secret for refresh tokens.
REFRESH_TOKEN_EXPIRY Expiry time for refresh tokens.
SEND_GRID_API_KEY API key for SendGrid email service.
USER_EMAIL Sender email address.
FRONTEND_URL URL of the frontend application.

About

Qzify is a REST API for managing online quizzes, offering endpoints for authentication, role-based user management, quiz creation, and attempt handling

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%