Welcome to the Quiz Builder Backend! This application allows users to create, manage, and distribute quizzes with various question types. The backend is built using Ruby on Rails and Grape API library, with email functionalities powered by Brevo.
- User Registration and Authentication: Users can register and sign in to the platform.
- Create Quizzes: Users can create quizzes with a maximum of 10 questions.
- Question Types: Supports three types of questions:
- Yes or No
- Multiple Choice
- Multiple Right Answers (Select all that apply)
- Options for Questions: Each question can have 1 to 5 options.
- Quiz Titles: Each quiz has a title for easy identification.
- Automated Link Generation: Upon publishing a quiz, a unique alphanumeric link is generated.
- Time Settings: Users can set a time limit for taking the quiz.
- Link Distribution: Hosts can choose to send the quiz link via email.
- Email-based Access: Recipients use their email to access and take the quiz.
- Single Attempt: Each recipient can take the quiz only once.
- Quiz Submission: Recipients submit their answers for evaluation or they are submitted automatically if their time expires.
- Quiz Completion Notification: Admins receive notifications when a quiz is completed.
- User Quiz Tracking: Admins can see who has taken the quiz, including their email and the time taken.
- Draft Mode: Quizzes can be saved as drafts and edited until published. Note: Once published, quizzes cannot be edited.
- Email Sending Cap: Each user is limited to sending a maximum of 5 emails to ensure efficient email usage.
- Ruby (version 2.6.5 or higher)
- Rails (version 6.0 or higher)
- PostgreSQL (or another preferred database)
-
Clone the Repository:
git clone https://github.com/t-ega/quiz-builder-backend.git cd quiz-builder
-
Install Dependencies:
bundle install
-
Database Setup:
rails db:create rails db:migrate
-
Environment Configuration:
- Create a
.env
file in the root directory and add the following:
PRODUCTION_HOST="https://yourfrontend.com" MAX_EMAILS=5 SENDINBLUE_PASSWORD= SENDINBLUE_EMAIL=
- Create a
-
Start the Server:
rails server
- Register:
POST /api/v1/users/register
- Sign In:
POST /api/v1/users/login
- Create Quiz:
POST /api/v1/admin/quizzes
- Update Quiz:
PUT /api/v1/admin/quizzes/:id
- Access Quiz:
GET /api/v1/quizzes/:link
- Access Quiz Questions:
GET /api/v1/quizzes/:id/[email protected]
- Submit Quiz:
POST /api/v1/quizzes/:id/submit
- Send Quiz Link: The Brevo email service is used to send quiz links to recipients.
- Register a new user by sending a
POST
request to/api/v1/users/register
with the required parameters (e.g., email, password). - Sign in using the credentials to receive an authentication token.
- Create a new quiz by sending a
POST
request to/api/v1/quizzes
with the quiz details. - Add questions and options to the quiz.
- Set the quiz to draft mode or publish it to generate a unique link.
- Use the unique link to distribute the quiz to recipients.
- Recipients receive the quiz link via email.
- Recipients use their email to access the quiz and submit their answers.
- Admins can view completed quizzes and recipient details through the admin endpoints.
The Quiz Builder Backend provides a robust and flexible platform for creating and managing quizzes.
I hope you love it!
You are always free to contribute to this project. Who knows it might be the next best open source headless library for tests management! Feel free to open a PR