Song Quest Backend details
/gameplay
/create
: Create a new game./question
: Upload new questions and fetch questions category-wise./check
: Check the correct answer for the question./highscore
: Fetch the leaderboard category-wise./history
: Fetch the user's game history./save
: Save the game.
/users
/register
: Register new users./login
: Login users./profile
: Get and update profile details./resetPassword
: Reset password and send OTP via email.
- Game Model
{
"game": {
"player": "String (required)",
"score": "Number (default: 0.0)",
"accurate": "Number (default: 0)",
"questionsId": "Array of ObjectId (ref: 'Question')",
"category": "String (required)",
"isGameSaved": "Boolean (default: false)",
"createdAt": "Date (default: Current timestamp)",
"expireAt": "Date (default: Current timestamp)"
}
}
Note: This project utilizes a TTL (Time-to-Live) index to automatically delete unsaved games after 300 seconds
. The index is based on the expireAt
field and is configured to delete games where isGameSaved
is false. This ensures efficient cleanup of temporary data.
- Question Model
{
"question": {
"title": "String (required)",
"songUrl": "String",
"options": [
{
"optionid": "Number (required)",
"value": "String (required)"
}
],
"correctOptionId": "Number (required)",
"category": "String (required)",
"totalAttempts": "Number (default: 0)",
"difficulty": "Number (default: 0.5)",
"altText": "String (default: '')",
"createdAt": "Date (default: Current timestamp)"
}
}
- User Model
{
"user": {
"username": "String (required, unique, trim)",
"email": "String (required, unique, trim)",
"imageUrl": "String",
"password": "String (required, 'Password is required')",
"gamesPlayed": "Number (default: 0)",
"forgotPasswordToken": "String",
"forgotPasswordTokenExpiry": "Date",
"refreshToken": "String",
"createdAt": "Date (default: Current timestamp)"
}
}
The score for each question is determined using the formula below.
To begin using Song Quest, clone the repository from here and open the project in Android Studio. Clone the backend server from here and fill up the required environment variables mentioned in the sample.env
file to set up your own server.
Feel free to contribute to this project by submitting issues, pull requests, or providing valuable feedback. Your contributions are always welcome! 🙌
Song Quest is released under the MIT License. Feel free to modify or add to this list based on the specific features of your app.