https://github.com/majiinb/deck_ai_api_service
The Deck API Gateway serves as a bridge between your "Deck" application and both the OpenAI API and Gemini AI, facilitating the processing and connection of data. It provides endpoints for interacting with the Deck application and leveraging the power of these AI services for generating flashcards and enhancing productivity.
https://github.com/majiinb/deck_ai_api_service
api api-rest firebase gemini gemini-ai javascript nodejs service
Last synced: about 2 months ago
JSON representation
The Deck API Gateway serves as a bridge between your "Deck" application and both the OpenAI API and Gemini AI, facilitating the processing and connection of data. It provides endpoints for interacting with the Deck application and leveraging the power of these AI services for generating flashcards and enhancing productivity.
- Host: GitHub
- URL: https://github.com/majiinb/deck_ai_api_service
- Owner: majiinB
- License: mit
- Created: 2024-06-10T15:20:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-25T21:27:32.000Z (about 1 year ago)
- Last Synced: 2025-05-25T22:28:20.496Z (about 1 year ago)
- Topics: api, api-rest, firebase, gemini, gemini-ai, javascript, nodejs, service
- Language: JavaScript
- Homepage:
- Size: 592 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
# 🚪 Deck AI API Service
**Deck AI API Service** is a microservice within the _Deck_ ecosystem that handles all AI-related functionalities. It integrates Gemini AI to process user input, generate flashcards, generate quizzes, help moderate deck of flashcards and enhance productivity. This service provides dedicated endpoints for AI-driven content generation, ensuring seamless interaction between the _Deck_ application and AI models.
---
## 🌟 Features
### Gemini Integration
- **⚡ Flashcard Generation**: Utilize Gemini to automatically generate flashcards from study materials (pdf files) and text inputs.
- **📝 Quiz Generation**: Generate interactive multiple-choice quizzes using AI, based on your deck of flashcards.
- **🛡️ Content Moderation**: Ensure appropriate and high-quality content by using AI to filter and analyze user-generated inputs, preventing harmful or irrelevant material.
---
## 🚀 Getting Started
### Prerequisites
- Node.js installed
- Gemini API key
- Firebase admin SDK
### Installation
1. 🛠️ Clone this repository to your local machine.
2. 📦 Install dependencies using `npm install`.
3. ⚙️ Set up environment variables:
- `GEMINI_API_KEY`: Your Google Generative AI API key.
- `ASSISTANT_ID`: Your OpenAI assistant ID.
- `FIREBASE_API_KEY`: Found in Firebase admin.
- `AUTH_DOMAIN`: Found in Firebase admin.
- `PROJECT_ID`: Found in Firebase admin.
- `STORAGE_BUCKET`: Found in Firebase admin.
- `MESSAGING_SENDER_ID`: Found in Firebase admin.
- `APP_ID`: Found in Firebase admin.
- `KEY_FILE`: Found in Firebase Service Providers.
4. 📃 generate your firebase private key json file and place it in your project's root folder
5. 🚀 Run the server using `npm start` or `nodemon`.
---
### 📡 API Endpoints
#### 🚀 API Health Check
- **GET** `/v2/deck/hi`
- **Description:** Checks if the API is online.
- **Response:**
```json
{ "message": "Hi! the server is active" }
```
#### ⚡ Flashcard Generation
- **POST** `/v2/deck/generate/flashcards/:id`
- **Description:** Generates flashcards using Gemini AI based on provided input.
- **Path Parameter:**
- `id` (string) – The user's unique ID.
- **Request Body:**
```json
{
"deckTitle": "WEBDEV - Frameworks",
"subject": "Web development",
"topic": "frameworks",
"addDescription": "The various frameworks used for web development and their design patterns", // Optional
"numberOfFlashcards": 10
}
```
- **Response:**
```json
{
"status": 200,
"request_owner_id": "",
"message": "Prompt was sent successfully",
"data": {
"deckId": ""
}
}
```
#### 🛡️ Content Moderation
- **POST** `/v2/deck/moderate/:id`
- **Description:** Uses Gemini AI to analyze user-generated content and determine its appropriateness.
- **Path Parameter:**
- `id` (string) – The user's unique ID.
- **Request Body:**
```json
{
"deckId": ""
}
```
- **Response:**
```json
{
"status": 200,
"request_owner_id": "",
"message": "Moderation review successful",
"data": {
"quiz_data": {
"overall_verdict": {
"is_appropriate": false,
"moderation_decision": "content is inappropriate",
"flagged_cards": [
{
"description": "Activates a configured interface.",
"term": "Tangina mo",
"reason": "Profanity and offensive language"
}
]
}
}
}
}
```
or
```json
{
"status": 200,
"request_owner_id": "",
"message": "Moderation review successful",
"data": {
"quiz_data": {
"overall_verdict": {
"is_appropriate": true,
"moderation_decision": "content is appropriate",
"flagged_cards": []
}
}
}
}
```
#### 📝 Quiz Generation
- **POST** `/v2/deck/generate/quiz/:id`
- **Description:** Generates quiz questions based on provided deck id using Gemini AI.
- **Path Parameter:**
- `id` (string) – The user's unique ID.
- **Request Body:**
```json
{
"deckId": ""
}
```
- **Response:**
```json
{
"status": 200,
"request_owner_id": "",
"message": "Quiz creation for deck with id: is successful",
"data": {
"quizId": ""
}
}
```
or
```json
{
"status": 200,
"request_owner_id": "",
"message": "There is already a quiz made for this deck in the 'quiz' collection",
"data": {
"quiz_id": ""
}
}
```
or
```json
{
"status": 200,
"request_owner_id": "",
"message": "Quiz creation for new flashcards in deck ekZBroavEBX76mAXVG9Z is successful",
"data": {
"no_of_new_flashcards":
}
}
```
---
## 🤝 Contributing
We welcome contributions from the community! To contribute:
1. 🍴 Fork the repository.
2. 🌿 Create a new branch (`git checkout -b feature/YourFeature`).
3. 💻 Commit your changes (`git commit -m 'Add some feature'`).
4. 📤 Push to the branch (`git push origin feature/YourFeature`).
5. 🔄 Open a pull request.
---
## 📜 License
This project is licensed under the [MIT License](LICENSE).
---
## 📧 Contact
If you have any questions or suggestions, feel free to [open an issue](#).
---
Thank you for using Deck API Gateway! We hope it helps streamline your productivity workflows and enhances your "Deck" application experience. 🎉