{"id":17930976,"url":"https://github.com/hoangsonww/docuthinker-ai-app","last_synced_at":"2025-07-19T10:39:05.476Z","repository":{"id":257832685,"uuid":"868281846","full_name":"hoangsonww/DocuThinker-AI-App","owner":"hoangsonww","description":"📝 DocuThinker: A FERN-Stack, AI-powered app for document analysis, summarization, and real-time chat based on document content. Currently deployed live with Vercel \u0026 Render. Say goodbye to long reads - get the insights you need in seconds!","archived":false,"fork":false,"pushed_at":"2025-07-05T16:00:10.000Z","size":18950,"stargazers_count":39,"open_issues_count":0,"forks_count":24,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-07-05T17:05:04.814Z","etag":null,"topics":["ai-ml","artificial-intelligence","chatbot","document","express","expressjs","firebase","firebase-auth","firebase-database","firebase-firestore","graphql","jenkins","kubernetes","machine-learning","mongodb","nginx","node-js","nodejs","react","reactjs"],"latest_commit_sha":null,"homepage":"https://docuthinker.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoangsonww.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-06T00:38:27.000Z","updated_at":"2025-07-05T16:00:14.000Z","dependencies_parsed_at":"2025-05-17T20:19:14.766Z","dependency_job_id":"24d0da29-8f42-4088-8523-abd91d81f075","html_url":"https://github.com/hoangsonww/DocuThinker-AI-App","commit_stats":null,"previous_names":["hoangsonww/docuthinker-ai-app"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hoangsonww/DocuThinker-AI-App","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangsonww%2FDocuThinker-AI-App","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangsonww%2FDocuThinker-AI-App/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangsonww%2FDocuThinker-AI-App/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangsonww%2FDocuThinker-AI-App/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoangsonww","download_url":"https://codeload.github.com/hoangsonww/DocuThinker-AI-App/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangsonww%2FDocuThinker-AI-App/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265919581,"owners_count":23849420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-ml","artificial-intelligence","chatbot","document","express","expressjs","firebase","firebase-auth","firebase-database","firebase-firestore","graphql","jenkins","kubernetes","machine-learning","mongodb","nginx","node-js","nodejs","react","reactjs"],"created_at":"2024-10-28T21:18:53.162Z","updated_at":"2025-07-19T10:39:05.464Z","avatar_url":"https://github.com/hoangsonww.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **DocuThinker - AI-Powered Document Analysis and Summarization App**\n\nWelcome to **DocuThinker**! This is a full-stack **(FERN-Stack)** application that integrates an AI-powered document processing backend with a React-based frontend. The app allows users to upload documents for summarization, generate key insights, and chat with an AI based on the document's content.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docuthinker.vercel.app\" style=\"cursor: pointer\"\u003e\n    \u003cimg src=\"images/logo.png\" alt=\"DocuThinker Logo\" width=\"45%\" style=\"border-radius: 8px\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## **📚 Table of Contents**\n\n- [**📖 Overview**](#-overview)\n- [**🚀 Live Deployments**](#live-deployments)\n  - [**Live Statuses**](#live-statuses)\n- [**✨ Features**](#features)\n- [**⚙️ Technologies**](#technologies)\n- [**🖼️ User Interface**](#user-interface)\n- [**📂 Complete File Structure**](#complete-file-structure)\n- [**🛠️ Getting Started**](#getting-started)\n  - [**Prerequisites**](#prerequisites)\n  - [**Frontend Installation**](#frontend-installation)\n  - [**Backend Installation**](#backend-installation)\n  - [**Running the Mobile App**](#running-the-mobile-app)\n- [**📋 API Endpoints**](#api-endpoints)\n  - [**API Documentation**](#api-documentation)\n  - [**Using the `openapi.yaml` File**](#using-the-openapiyaml-file)\n  - [**API Architecture**](#api-architecture)\n  - [**API Testing**](#api-testing)\n  - [**Error Handling**](#error-handling)\n- [**🧰 GraphQL Integration**](#graphql-integration)\n- [**📱 Mobile App**](#mobile-app)\n- [**📦 Containerization**](#containerization)\n- [**🚧 Deployment**](#deployment)\n  - [**Frontend Deployment (Vercel)**](#frontend-deployment-vercel)\n  - [**Backend Deployment (Render)**](#backend-deployment-render)\n  - [**Important Note about Backend Deployment (Please Read)**](#important-note-about-backend-deployment)\n- [**⚖️ Load Balancing \u0026 Caching**](#load-balancing)\n- [**🔗 Jenkins Integration**](#jenkins)\n- [**🧪 Testing**](#testing)\n  - [**Backend Unit \u0026 Integration Testing**](#backend-unit--integration-testing)\n  - [**Frontend Unit \u0026 E2E Testing**](#frontend-unit--e2e-testing)\n- [**🚢 Kubernetes Integration**](#kubernetes)\n- [**🔧 Contributing**](#contributing)\n- [**📝 License**](#license)\n- [**📚 Additional Documentation**](#alternative-docs)\n- [**👨‍💻 Author**](#author)\n\n\u003ch2 id=\"-overview\"\u003e📖 Overview\u003c/h2\u003e\n\nThe **DocuThinker** app is designed to provide users with a simple, AI-powered document management tool. Users can upload PDFs or Word documents and receive summaries, key insights, and discussion points. Additionally, users can chat with an AI using the document's content for further clarification.\n\n**DocuThinker** is created using the **FERN-Stack** architecture, which stands for **Firebase, Express, React, and Node.js**. The backend is built with Node.js and Express, integrating Firebase for user authentication and MongoDB for data storage. The frontend is built with React and Material-UI, providing a responsive and user-friendly interface.\n\n\u003e [!IMPORTANT]\n\u003e It is currently deployed live on **Vercel** and **Render**. You can access the live app **[here](https://docuthinker-fullstack-app.vercel.app/)**.\n\n\u003ch2 id=\"live-deployments\"\u003e🚀 Live Deployments\u003c/h2\u003e\n\n\u003e [!TIP]\n\u003e Access the live app at **[https://docuthinker.vercel.app/](https://docuthinker.vercel.app/) by clicking on the link or copying it into your browser! 🚀**\n\nWe have deployed the entire app on **Vercel** and **Render**. You can access the live app **[here](https://docuthinker.vercel.app)**.\n\n- **Frontend**: Deployed on **Vercel**. Access the live frontend **[here](https://docuthinker.vercel.app/)**.\n  - **Backup Frontend**: We have a backup of the frontend on **Netlify**. You can access the backup app **[here](https://docuthinker-ai-app.netlify.app/)**.\n- **Backend**: Deployed on **Vercel**. You can access the live backend **[here](https://docuthinker-app-backend-api.vercel.app/)**.\n  - **Backup Backend API**: Deployed on **Render**. You can access the backup backend **[here](https://docuthinker-ai-app.onrender.com/)**.\n\n\u003e [!IMPORTANT]\n\u003e The backend server may take a few seconds to wake up if it has been inactive for a while. The first API call may take a bit longer to respond. Subsequent calls should be faster as the server warms up.\n\n\u003e [!NOTE]\n\u003e Additionally, the Render-deployed backend is currently on the **Free Tier** of **Render**, so it may take longer to process your request since we are only allocated **512MB and 0.1 CPU**.\n\n### Live Statuses\n\nThese badges indicate the current deployment status of the app, updating automatically based on the latest deployment status:\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docuthinker-fullstack-app.vercel.app\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Deployed_with-Vercel-000000?style=for-the-badge\u0026logo=vercel\u0026logoColor=white\" alt=\"Vercel Deployment\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docuthinker-ai-app.onrender.com/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Render-Success-46E3B7?style=for-the-badge\u0026logo=render\u0026logoColor=black\" alt=\"Render Success\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docuthinker-ai-app.netlify.app\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Netlify-Backup_Deployed-00C7B7?style=for-the-badge\u0026logo=netlify\u0026logoColor=white\" alt=\"Netlify Backup\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://firebase.google.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Firebase-Functional-FFCA28?style=for-the-badge\u0026logo=firebase\u0026logoColor=white\" alt=\"Firebase Functional\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.mongodb.com/cloud/atlas\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/MongoDB_Atlas-Connected-47A248?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white\" alt=\"MongoDB Atlas\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://redis.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Redis-Cache_Enabled-DC382D?style=for-the-badge\u0026logo=redis\u0026logoColor=white\" alt=\"Redis Cache\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.rabbitmq.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/RabbitMQ-Enabled-FF6600?style=for-the-badge\u0026logo=rabbitmq\u0026logoColor=white\" alt=\"RabbitMQ Enabled\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://graphql.org\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/GraphQL-API-E10098?style=for-the-badge\u0026logo=graphql\u0026logoColor=white\" alt=\"GraphQL API\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.docker.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Dockerized-Yes-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white\" alt=\"Dockerized\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://kubernetes.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Kubernetes-Yes-326CE5?style=for-the-badge\u0026logo=kubernetes\u0026logoColor=white\" alt=\"Kubernetes\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.jenkins.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Jenkins-CI/CD-D24939?style=for-the-badge\u0026logo=jenkins\u0026logoColor=white\" alt=\"Jenkins CI/CD\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://swagger.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swagger_\u0026_OpenAPI-Documented-85EA2D?style=for-the-badge\u0026logo=swagger\u0026logoColor=black\" alt=\"Swagger \u0026 OpenAPI\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch2 id=\"features\"\u003e✨ Features\u003c/h2\u003e\n\n**DocuThinker** offers a wide range of features to help users manage and analyze their documents effectively. Here are some of the key features of the app:\n\n- **Document Upload \u0026 Summarization**: Upload PDFs or Word documents for AI-generated summaries.\n- **Key Insights \u0026 Discussion Points**: Generate important ideas and topics for discussion from your documents.\n- **AI Chat Integration**: Chat with an AI using your document’s original context.\n- **Voice Chat with AI**: Chat with an AI using voice commands for a more interactive experience.\n- **Sentiment Analysis**: Analyze the sentiment of your document text for emotional insights.\n- **Multiple Language Support**: Summarize documents in different languages for global users.\n- **Content Rewriting**: Rewrite or rephrase document text based on a specific style or tone.\n- **Actionable Recommendations**: Get actionable recommendations based on your document content.\n- **Bullet Point Summaries**: Generate bullet point summaries for quick insights and understanding.\n- **Document Categorization**: Categorize documents based on their content for easy organization.\n- **Profile Management**: Update your profile information, social media links, and theme settings.\n- **User Authentication**: Secure registration, login, and password reset functionality.\n- **Document History**: View all uploaded documents and their details.\n- **Mobile App Integration**: React Native mobile app for on-the-go document management.\n- **API Documentation**: Swagger (OpenAPI) documentation for all API endpoints.\n- **Authentication Middleware**: Secure routes with JWT and Firebase authentication middleware.\n- **Containerization**: Dockerized the app with Docker \u0026 K8s for easy deployment and scaling.\n- **Continuous Integration**: Automated testing and deployment with GitHub Actions \u0026 Jenkins.\n\n\u003ch2 id=\"technologies\"\u003e⚙️ Technologies\u003c/h2\u003e\n\n- **Frontend**:\n  - **React**: JavaScript library for building user interfaces.\n  - **Material-UI**: React components for faster and easier web development.\n  - **Axios**: Promise-based HTTP client for making API requests.\n  - **React Router**: Declarative routing for React applications.\n  - **Context API**: State management for React applications.\n  - **TailwindCSS**: Utility-first CSS framework for styling.\n  - **Craco**: Create React App Configuration Override for customizing Webpack.\n  - **Webpack**: Module bundler for JavaScript applications.\n  - **Jest**: JavaScript testing framework for unit and integration tests.\n  - **React Testing Library**: Testing utilities for React components.\n- **Backend**:\n  - **Express**: Web application framework for Node.js.\n  - **Redis**: In-memory data structure store for caching.\n  - **Firebase Admin SDK**: Firebase services for server-side applications.\n  - **Node.js**: JavaScript runtime for building scalable network applications.\n  - **Firebase Authentication**: Secure user authentication with Firebase.\n  - **Firebase Auth JWT**: Generate custom tokens for Firebase authentication.\n  - **Middlewares**: Firebase authentication middleware for securing routes and JWT middleware for token verification.\n  - **REST APIs**: Representational State Transfer for building APIs.\n  - **GraphQL**: Query language for APIs and runtime for executing queries.\n  - **RabbitMQ**: Message broker for handling asynchronous tasks and background jobs.\n  - **Swagger/OpenAPI**: API documentation for all endpoints.\n- **AI/ML Services**:\n  - **Google Cloud Natural Language API**: Machine learning models for text analysis.\n  - **Google Speech-to-Text API**: Speech recognition for voice chat integration \u0026 text extraction from audio.\n  - **Google AI Studio**: Tools for building and deploying machine learning models.\n  - **NLP**: Natural Language Processing for customized chat/text analysis and summarization models.\n  - **NER**: Named Entity Recognition for identifying entities in text.\n  - **POS Tagging**: Part-of-Speech Tagging for analyzing word types in text.\n  - **RAG**: Retrieval-Augmented Generation for generating responses in chat.\n  - **LangChain**: Handles document ingestion, text chunking, embedding storage, retrieval, summarization, and API chaining for generating insights from uploaded documents.\n- **Database**:\n  - **MongoDB**: NoSQL database for storing user data and documents.\n  - **Firestore**: Cloud Firestore for storing user data and documents.\n  - **Redis**: In-memory data structure store for caching.\n- **Mobile App**:\n  - **React Native**: JavaScript framework for building mobile applications.\n  - **Expo**: Framework and platform for universal React applications.\n  - **Firebase SDK**: Firebase services for mobile applications.\n  - **React Navigation**: Routing and navigation for React Native apps.\n- **API Documentation**:\n  - **Swagger**: OpenAPI documentation for all API endpoints.\n  - **OpenAPI**: Specification for building APIs with RESTful architecture.\n- **Containerization**:\n  - **Docker**: Containerization platform for building, shipping, and running applications.\n  - **Kubernetes**: Container orchestration for automating deployment, scaling, and management.\n- **Load Balancing \u0026 Caching**:\n  - **NGINX**: Web server for load balancing, reverse proxying, and caching.\n- **CI/CD \u0026 Deployment**:\n  - **GitHub Actions**: Automated workflows for testing and deployment.\n  - **Jenkins**: Automation server for continuous integration and deployment.\n  - **Render**: Cloud platform for hosting and scaling web applications. (Used to deploy the backend)\n  - **Vercel**: Cloud platform for hosting and deploying web applications. (Used to deploy the frontend)\n  - **Netlify**: Cloud platform for hosting and deploying web applications. (Used as a backup)\n- _and more!_\n\n\u003cp align=\"center\"\u003e\n  \u003c!-- Frontend --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React-20232A?style=for-the-badge\u0026logo=react\u0026logoColor=61DAFB\" alt=\"React\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Material--UI-0081CB?style=for-the-badge\u0026logo=mui\u0026logoColor=white\" alt=\"Material UI\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/TailwindCSS-38B2AC?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white\" alt=\"Tailwind CSS\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Craco-61DAFB?style=for-the-badge\u0026logo=webpack\u0026logoColor=white\" alt=\"Craco\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Webpack-8DD6F9?style=for-the-badge\u0026logo=webpack\u0026logoColor=white\" alt=\"Webpack\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React_Native-61DAFB?style=for-the-badge\u0026logo=react\u0026logoColor=white\" alt=\"React Native\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Expo-000020?style=for-the-badge\u0026logo=expo\u0026logoColor=white\" alt=\"Expo\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React_Navigation-123456?style=for-the-badge\u0026logo=react-router\u0026logoColor=white\" alt=\"React Navigation\" /\u003e\n\n  \u003c!-- Backend --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Node.js-339933?style=for-the-badge\u0026logo=node.js\u0026logoColor=white\" alt=\"Node.js\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Express-000000?style=for-the-badge\u0026logo=express\u0026logoColor=white\" alt=\"Express\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Firebase-FFCA28?style=for-the-badge\u0026logo=firebase\u0026logoColor=white\" alt=\"Firebase\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Firebase_Auth-FFCA28?style=for-the-badge\u0026logo=firebase\u0026logoColor=white\" alt=\"Firebase Auth\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Redis-DC382D?style=for-the-badge\u0026logo=redis\u0026logoColor=white\" alt=\"Redis\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/MongoDB-47A248?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white\" alt=\"MongoDB\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Firestore-FFCA28?style=for-the-badge\u0026logo=firebase\u0026logoColor=white\" alt=\"Firestore\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/RabbitMQ-FF6600?style=for-the-badge\u0026logo=rabbitmq\u0026logoColor=white\" alt=\"RabbitMQ\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/GraphQL-E10098?style=for-the-badge\u0026logo=graphql\u0026logoColor=white\" alt=\"GraphQL\" /\u003e\n\n  \u003c!-- AI/ML --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Google_Cloud_NLP-4285F4?style=for-the-badge\u0026logo=googlecloud\u0026logoColor=white\" alt=\"Google Cloud NLP\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Google_Speech--to--Text-4285F4?style=for-the-badge\u0026logo=googlecloud\u0026logoColor=white\" alt=\"Google Speech-to-Text\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Google_AI_Studio-4285F4?style=for-the-badge\u0026logo=google\u0026logoColor=white\" alt=\"Google AI Studio\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/NLP_\u0026amp;_NLTK-00599C?style=for-the-badge\u0026logo=apachedolphinscheduler\u0026logoColor=white\" alt=\"Natural Language Processing\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/NER-007ACC?style=for-the-badge\u0026logo=apachenetbeanside\u0026logoColor=white\" alt=\"Named Entity Recognition\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/POS_Tagging-123456?style=for-the-badge\u0026logo=posit\u0026logoColor=white\" alt=\"POS Tagging\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Retrieval%20Augmented%20Generation%20(RAG)-6495ED?style=for-the-badge\u0026logo=chatbot\u0026logoColor=white\" alt=\"Retrieval-Augmented Generation\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/LangChain-999999?style=for-the-badge\u0026logo=langchain\u0026logoColor=white\" alt=\"LangChain\" /\u003e\n\n  \u003c!-- Containerization, Deployment, CI/CD --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white\" alt=\"Docker\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Kubernetes-326CE5?style=for-the-badge\u0026logo=kubernetes\u0026logoColor=white\" alt=\"Kubernetes\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/NGINX-269539?style=for-the-badge\u0026logo=nginx\u0026logoColor=white\" alt=\"NGINX\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/GitHub_Actions-2088FF?style=for-the-badge\u0026logo=github-actions\u0026logoColor=white\" alt=\"GitHub Actions\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Jenkins-D24939?style=for-the-badge\u0026logo=jenkins\u0026logoColor=white\" alt=\"Jenkins\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Render-FF6B6B?style=for-the-badge\u0026logo=render\u0026logoColor=white\" alt=\"Render\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Vercel-000000?style=for-the-badge\u0026logo=vercel\u0026logoColor=white\" alt=\"Vercel\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Netlify-00C7B7?style=for-the-badge\u0026logo=netlify\u0026logoColor=white\" alt=\"Netlify\" /\u003e\n\n  \u003c!-- API Documentation --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge\u0026logo=swagger\u0026logoColor=black\" alt=\"Swagger\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/OpenAPI-6BA539?style=for-the-badge\u0026logo=openapiinitiative\u0026logoColor=white\" alt=\"OpenAPI\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/JSON-000000?style=for-the-badge\u0026logo=json\u0026logoColor=white\" alt=\"JSON\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/YAML-FFCA28?style=for-the-badge\u0026logo=yaml\u0026logoColor=black\" alt=\"YAML\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/REST_API-00599C?style=for-the-badge\u0026logo=fastapi\u0026logoColor=white\" alt=\"REST API\" /\u003e\n\n  \u003c!-- Testing \u0026 Tools --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Jest-C21325?style=for-the-badge\u0026logo=jest\u0026logoColor=white\" alt=\"Jest\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React_Testing_Library-FFCA28?style=for-the-badge\u0026logo=testing-library\u0026logoColor=black\" alt=\"React Testing Library\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Supertest-FFCA28?style=for-the-badge\u0026logo=testrail\u0026logoColor=black\" alt=\"Supertest\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Postman-FF6C37?style=for-the-badge\u0026logo=postman\u0026logoColor=white\" alt=\"Postman\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/ESLint-4B3263?style=for-the-badge\u0026logo=eslint\u0026logoColor=white\" alt=\"ESLint\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Prettier-F7B93E?style=for-the-badge\u0026logo=prettier\u0026logoColor=black\" alt=\"Prettier\" /\u003e\n\u003c/p\u003e\n\n\u003ch2 id=\"user-interface\"\u003e🖼️ User Interface\u003c/h2\u003e\n\n**DocuThinker** features a clean and intuitive user interface designed to provide a seamless experience for users. The app supports both light and dark themes, responsive design, and easy navigation. Here are some screenshots of the app:\n\n### **Landing Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/landing.png\" alt=\"Landing Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Landing Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/landing-dark.png\" alt=\"Landing Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Document Upload Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/upload.png\" alt=\"Document Upload Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Document Upload Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/upload-dark.png\" alt=\"Document Upload Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Document Upload Page - Document Uploaded**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/file-uploaded.png\" alt=\"Document Upload Page - Document Uploaded\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Google Drive Document Selection**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/drive-upload.png\" alt=\"Google Drive Document Selection\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Home Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/home.png\" alt=\"Home Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Home Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/home-dark.png\" alt=\"Home Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Chat Modal**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/chat.png\" alt=\"Chat Modal\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Chat Modal - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/chat-dark.png\" alt=\"Chat Modal - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Documents Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/documents.png\" alt=\"Documents Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Documents Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/documents-dark.png\" alt=\"Documents Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Document Page - Search Results**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/documents-search.png\" alt=\"Document Page - Search Results\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Profile Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/profile.png\" alt=\"Profile Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Profile Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/profile-dark.png\" alt=\"Profile Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **How To Use Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/how-to-use.png\" alt=\"How To Use Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **How To Use Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/how-to-use-dark.png\" alt=\"How To Use Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Login Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/login.png\" alt=\"Login Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Login Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/login-dark.png\" alt=\"Login Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Registration Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/register.png\" alt=\"Registration Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Registration Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/register-dark.png\" alt=\"Registration Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Forgot Password Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/forgot-password.png\" alt=\"Forgot Password Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Forgot Password Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/forgot-password-dark.png\" alt=\"Forgot Password Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Responsive Design Example**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/responsive.png\" alt=\"Responsive Design\" width=\"50%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Navigation Drawer**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/navigation-drawer.png\" alt=\"Navigation Drawer\" width=\"50%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **404 Not Found Page**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/404.png\" alt=\"404 Not Found Page\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **404 Not Found Page - Dark Mode**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/404-dark.png\" alt=\"404 Not Found Page - Dark Mode\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n### **Footer**\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/footer.png\" alt=\"Footer\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n\u003ch2 id=\"complete-file-structure\"\u003e📂 Complete File Structure\u003c/h2\u003e\n\nThe **DocuThinker** app is organized into separate subdirectories for the frontend, backend, and mobile app. Each directory contains the necessary files and folders for the respective components of the app. Here is the complete file structure of the app:\n\n```\nDocuThinker-AI-App/\n├── backend/\n│   ├── ai_ml/\n│   │   ├── perform_ner_pos.py        # Named Entity Recognition and Part-of-Speech Tagging\n│   │   ├── sen_analysis.py           # Sentiment analysis for document text\n│   │   ├── chat.js                   # Chatbot integration for AI chat functionality\n│   │   ├── analyzer.js               # Document analyzer for generating key ideas and discussion points\n│   │   ├── textStatistics.js         # Text statistics for analyzing document content\n│   │   ├── documentClassifier.js     # Document classifier for categorizing documents\n│   │   ├── summarizer.js             # Document summarizer for generating summaries\n│   │   └── (and many more files...)  # Additional AI/ML services\n│   ├── middleware/\n│   │   └── jwt.js                    # Authentication middleware with JWT for the app's backend\n│   ├── controllers/\n│   │   └── controllers.js            # Controls the flow of data and logic\n│   ├── graphql/\n│   │   ├── resolvers.js              # Resolvers for querying data from the database\n│   │   └── schema.js                 # GraphQL schema for querying data from the database\n│   ├── models/\n│   │   └── models.js                 # Data models for interacting with the database\n│   ├── services/\n│   │   └── services.js               # Models for interacting with database and AI/ML services\n│   ├── views/\n│   │   └── views.js                  # Output formatting for success and error responses\n│   ├── redis/\n│   │   └── redisClient.js            # Redis client for caching data in-memory\n│   ├── swagger/\n│   │   └── swagger.js                # Swagger documentation for API endpoints\n│   ├── .env                          # Environment variables (git-ignored)\n│   ├── firebase-admin-sdk.json       # Firebase Admin SDK credentials (git-ignored)\n│   ├── index.js                      # Main entry point for the server\n│   ├── Dockerfile                    # Docker configuration file\n│   ├── manage_server.sh              # Shell script to manage and start the backend server\n│   └── README.md                     # Backend README file\n│\n├── frontend/\n│   ├── public/\n│   │   ├── index.html                # Main HTML template\n│   │   └── manifest.json             # Manifest for PWA settings\n│   ├── src/\n│   │   ├── assets/                   # Static assets like images and fonts\n│   │   │   └── logo.png              # App logo or images\n│   │   ├── components/\n│   │   │   ├── ChatModal.js          # Chat modal component\n│   │   │   ├── Spinner.js            # Loading spinner component\n│   │   │   ├── UploadModal.js        # Document upload modal component\n│   │   │   ├── Navbar.js             # Navigation bar component\n│   │   │   ├── Footer.js             # Footer component\n│   │   │   └── GoogleAnalytics.js    # Google Analytics integration component\n│   │   ├── pages/\n│   │   │   ├── Home.js               # Home page where documents are uploaded\n│   │   │   ├── LandingPage.js        # Welcome and information page\n│   │   │   ├── Login.js              # Login page\n│   │   │   ├── Register.js           # Registration page\n│   │   │   ├── ForgotPassword.js     # Forgot password page\n│   │   │   └── HowToUse.js           # Page explaining how to use the app\n│   │   ├── App.js                    # Main App component\n│   │   ├── index.js                  # Entry point for the React app\n│   │   ├── App.css                   # Global CSS 1\n│   │   ├── index.css                 # Global CSS 2\n│   │   ├── reportWebVitals.js        # Web Vitals reporting\n│   │   ├── styles.css                # Custom styles for different components\n│   │   └── config.js                 # Configuration file for environment variables\n│   ├── .env                          # Environment variables file (e.g., REACT_APP_BACKEND_URL)\n│   ├── package.json                  # Project dependencies and scripts\n│   ├── craco.config.js               # Craco configuration file\n│   ├── Dockerfile                    # Docker configuration file\n│   ├── manage_frontend.sh            # Shell script for managing and starting the frontend\n│   ├── README.md                     # Frontend README file\n│   └── package.lock                  # Lock file for dependencies\n│\n├── mobile-app/                       # Mobile app directory\n│   ├── app/                          # React Native app directory\n│   ├── .env                          # Environment variables file for the mobile app\n│   ├── app.json                      # Expo configuration file\n│   ├── components/                   # Reusable components for the mobile app\n│   ├── assets/                       # Static assets for the mobile app\n│   ├── constants/                    # Constants for the mobile app\n│   ├── hooks/                        # Custom hooks for the mobile app\n│   ├── scripts/                      # Scripts for the mobile app\n│   ├── babel.config.js               # Babel configuration file\n│   ├── package.json                  # Project dependencies and scripts\n│   └── tsconfig.json                 # TypeScript configuration file\n│\n├── kubernetes/                       # Kubernetes configuration files\n│   ├── manifests/                    # Kubernetes manifests for deployment, service, and ingress\n│   ├── backend-deployment.yaml       # Deployment configuration for the backend\n│   ├── backend-service.yaml          # Service configuration for the backend\n│   ├── frontend-deployment.yaml      # Deployment configuration for the frontend\n│   ├── frontend-service.yaml         # Service configuration for the frontend\n│   ├── firebase-deployment.yaml      # Deployment configuration for Firebase\n│   ├── firebase-service.yaml         # Service configuration for Firebase\n│   └── configmap.yaml                # ConfigMap configuration for environment variables\n│\n├── nginx/\n│   ├── nginx.conf                    # NGINX configuration file for load balancing and caching\n│   └── Dockerfile                    # Docker configuration file for NGINX\n│\n├── images/                           # Images for the README\n├── .env                              # Environment variables file for the whole app\n├── docker-compose.yml                # Docker Compose file for containerization\n├── jsconfig.json                     # JavaScript configuration file\n├── package.json                      # Project dependencies and scripts\n├── package-lock.json                 # Lock file for dependencies\n├── postcss.config.js                 # PostCSS configuration file\n├── tailwind.config.js                # Tailwind CSS configuration file\n├── render.yaml                       # Render configuration file\n├── vercel.json                       # Vercel configuration file\n├── openapi.yaml                      # OpenAPI specification for API documentation\n├── manage_docuthinker.sh             # Shell script for managing and starting the app (both frontend \u0026 backend)\n├── jenkins_cicd.sh                   # Shell script for managing the Jenkins CI/CD pipeline\n├── .gitignore                        # Git ignore file\n├── LICENSE.md                        # License file for the project\n├── README.md                         # Comprehensive README for the whole app\n└── (and many more files...)          # Additional files and directories not listed here\n```\n\n\u003ch2 id=\"getting-started\"\u003e🛠️ Getting Started\u003c/h2\u003e\n\n### **Prerequisites**\n\nEnsure you have the following tools installed:\n\n- **Node.js** (between v14 and v20)\n- **npm** or **yarn**\n- **Firebase Admin SDK** credentials\n- **Redis** for caching\n- **MongoDB** for data storage\n- **RabbitMQ** for handling asynchronous tasks\n- **Docker** for containerization (optional)\n- **Postman** for API testing (optional)\n- **Expo CLI** for running the mobile app\n- **Jenkins** for CI/CD (optional)\n- **Kubernetes** for container orchestration (optional)\n- **React Native CLI** for building the mobile app\n- **Firebase SDK** for mobile app integration\n- **Firebase API Keys and Secrets** for authentication\n- **Expo Go** app for testing the mobile app on a physical device\n- **Tailwind CSS** for styling the frontend\n- **.env** file with necessary API keys (You can contact me to get the `.env` file - but you should obtain your own API keys for production).\n\nAdditionally, **basic fullstack development knowledge and AI/ML concepts** are recommended to understand the app's architecture and functionalities.\n\n### **Frontend Installation**\n\n1. **Clone the repository**:\n\n   ```bash\n   git clone https://github.com/hoangsonww/DocuThinker-AI-App.git\n   cd DocuThinker-AI-App/backend\n   ```\n\n2. **Navigate to the frontend directory**:\n\n   ```bash\n   cd frontend\n   ```\n\n3. **Install dependencies**:\n\n   ```bash\n   npm install\n   ```\n\n   Or `npm install --legacy-peer-deps` if you face any peer dependency issues.\n\n4. **Start the Frontend React app**:\n   ```bash\n   npm start\n   ```\n5. **Build the Frontend React app (for production)**:\n\n   ```bash\n   npm run build\n   ```\n\n6. **Alternatively, you can use `yarn` to install dependencies and run the app**:\n   ```bash\n   yarn install\n   yarn start\n   ```\n7. **Or, for your convenience, if you have already installed the dependencies, you can directly run the app in the root directory using**:\n\n   ```bash\n   npm run frontend\n   ```\n\n   This way, you don't have to navigate to the `frontend` directory every time you want to run the app.\n\n8. **The app's frontend will run on `http://localhost:3000`**. You can now access it in your browser.\n\n### **Backend Installation**\n\n\u003e [!NOTE]\n\u003e Note that this is optional since we are deploying the backend on **Render**. However, you can (and should) run the backend locally for development purposes.\n\n1. **Navigate to the root (not `backend`) directory**:\n   ```bash\n   cd backend\n   ```\n   \n2. **Install dependencies**:\n   ```bash\n   npm install\n   ```\n\n   Or `npm install --legacy-peer-deps` if you face any peer dependency issues.\n\n3. **Start the backend server**:\n   ```bash\n   npm run server\n   ```\n   \n4. **The backend server will run on `http://localhost:3000`**. You can access the API endpoints in your browser or **Postman**.\n5. **Additionally, the backend code is in the `backend` directory**. Feel free to explore the API endpoints and controllers.\n\n\u003e [!CAUTION]\n\u003e **Note:** Be sure to use Node v.20 or earlier to avoid compatibility issues with Firebase Admin SDK.\n\n### **Running the Mobile App**\n\n1. **Navigate to the mobile app directory**:\n   ```bash\n   cd mobile-app\n   ```\n2. **Install dependencies**:\n   ```bash\n    npm install\n   ```\n3. **Start the Expo server**:\n   ```bash\n   npx expo start\n   ```\n4. **Run the app on an emulator or physical device**: Follow the instructions in the terminal to run the app on an emulator or physical device.\n\n\u003ch2 id=\"api-endpoints\"\u003e📋 API Endpoints\u003c/h2\u003e\n\nThe backend of **DocuThinker** provides several API endpoints for user authentication, document management, and AI-powered insights. These endpoints are used by the frontend to interact with the backend server:\n\n| **Method** | **Endpoint**                         | **Description**                                                                                     |\n|------------|--------------------------------------|-----------------------------------------------------------------------------------------------------|\n| POST       | `/register`                          | Register a new user in Firebase Authentication and Firestore, saving their email and creation date. |\n| POST       | `/login`                             | Log in a user and return a custom token along with the user ID.                                     |\n| POST       | `/upload`                            | Upload a document for summarization. If the user is logged in, the document is saved in Firestore.  |\n| POST       | `/generate-key-ideas`                | Generate key ideas from the document text.                                                          |\n| POST       | `/generate-discussion-points`        | Generate discussion points from the document text.                                                  |\n| POST       | `/chat`                              | Chat with AI using the original document text as context.                                           |\n| POST       | `/forgot-password`                   | Reset a user's password in Firebase Authentication.                                                 |\n| POST       | `/verify-email`                      | Verify if a user's email exists in Firestore.                                                       |\n| GET        | `/documents/{userId}`                | Retrieve all documents associated with the given `userId`.                                          |\n| GET        | `/documents/{userId}/{docId}`        | Retrieve a specific document by `userId` and `docId`.                                               |\n| GET        | `/document-details/{userId}/{docId}` | Retrieve document details (title, original text, summary) by `userId` and `docId`.                  |\n| DELETE     | `/delete-document/{userId}/{docId}`  | Delete a specific document by `userId` and `docId`.                                                 |\n| DELETE     | `/delete-all-documents/{userId}`     | Delete all documents associated with the given `userId`.                                            |\n| POST       | `/update-email`                      | Update a user's email in both Firebase Authentication and Firestore.                                |\n| POST       | `/update-password`                   | Update a user's password in Firebase Authentication.                                                |\n| GET        | `/days-since-joined/{userId}`        | Get the number of days since the user associated with `userId` joined the service.                  |\n| GET        | `/document-count/{userId}`           | Retrieve the number of documents associated with the given `userId`.                                |\n| GET        | `/user-email/{userId}`               | Retrieve the email of a user associated with `userId`.                                              |\n| POST       | `/update-document-title`             | Update the title of a document in Firestore.                                                        |\n| PUT        | `/update-theme`                      | Update the theme of the app.                                                                        |\n| GET        | `/user-joined-date/{userId}`         | Get date when the user associated with `userId` joined the service.                                 |\n| GET        | `/social-media/{userId}`             | Get the social media links of the user associated with `userId`.                                    |\n| POST       | `/update-social-media`               | Update the social media links of the user associated with `userId`.                                 |\n| POST       | `/update-profile`                    | Update the user's profile information.                                                              |\n| POST       | `/update-document/{userId}/{docId}`  | Update the document details in Firestore.                                                           |\n| POST       | `/update-document-summary`           | Update the summary of a document in Firestore.                                                      |\n| POST       | `/sentiment-analysis`                | Analyzes the sentiment of the provided document text                                                |\n| POST       | `/bullet-summary`                    | Generates a summary of the document text in bullet points                                           |\n| POST       | `/summary-in-language`               | Generates a summary in the specified language                                                       |\n| POST       | `/content-rewriting`                 | Rewrites or rephrases the provided document text based on a style                                   |\n| POST       | `/actionable-recommendations`        | Generates actionable recommendations based on the document text                                     |\n| GET        | `/graphql`                           | GraphQL endpoint for querying data from the database                                                |\n\nMore API endpoints will be added in the future to enhance the functionality of the app. Feel free to explore the existing endpoints and test them using **Postman** or **Insomnia**.\n\n### API Documentation\n\n- **Swagger Documentation**: You can access the Swagger documentation for all API endpoints by running the backend server and navigating to `http://localhost:5000/api-docs`.\n- **Redoc Documentation**: You can access the Redoc documentation for all API endpoints by running the backend server and navigating to `http://localhost:5000/api-docs/redoc`.\n\nFor example, our API endpoints documentation looks like this:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/swagger.png\" alt=\"Swagger Documentation\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\nAdditionally, we also offer API file generation using **OpenAPI**. You can generate API files using the **OpenAPI** specification. Here is how:\n\n```bash\nnpx openapi-generator-cli generate -i http://localhost:5000/api-docs -g typescript-fetch -o ./api\n```\n\nThis will generate TypeScript files for the API endpoints in the `api` directory. Feel free to replace or modify the command as needed.\n\n### Using the `openapi.yaml` File\n\n1. **View the API Documentation**\n\n- Open [Swagger Editor](https://editor.swagger.io/).\n- Upload the `openapi.yaml` file or paste its content.\n- Visualize and interact with the API documentation.\n\n2. **Test the API**\n\n- Import `openapi.yaml` into [Postman](https://www.postman.com/):\n  - Open Postman → Import → Select `openapi.yaml`.\n  - Test the API endpoints directly from Postman.\n- Or use [Swagger UI](https://swagger.io/tools/swagger-ui/):\n  - Provide the file URL or upload it to view and test endpoints.\n\n3. **Generate Client Libraries**\n\n- Install OpenAPI Generator:\n  ```bash\n  npm install @openapitools/openapi-generator-cli -g\n  ```\n- Generate a client library:\n  ```bash\n  openapi-generator-cli generate -i openapi.yaml -g \u003clanguage\u003e -o ./client\n  ```\n- Replace `\u003clanguage\u003e` with the desired programming language.\n\n4. **Generate Server Stubs**\n\n- Generate a server stub:\n  ```bash\n  openapi-generator-cli generate -i openapi.yaml -g \u003cframework\u003e -o ./server\n  ```\n- Replace `\u003cframework\u003e` with the desired framework.\n\n5. **Run a Mock Server**\n\n- Install Prism:\n  ```bash\n  npm install -g @stoplight/prism-cli\n  ```\n- Start the mock server:\n  ```bash\n  prism mock openapi.yaml\n  ```\n\n6. **Validate the OpenAPI File**\n\n- Use [Swagger Validator](https://validator.swagger.io/):\n  - Upload `openapi.yaml` or paste its content to check for errors.\n\n### **API Architecture**\n\n- We use **Node.js** and **Express** to build the backend server for **DocuThinker**.\n- The backend API is structured using **Express** and **Firebase Admin SDK** for user authentication and data storage.\n- We use the MVC (Model-View-Controller) pattern to separate concerns and improve code organization.\n  - **Models**: Schema definitions for interacting with the database.\n  - **Controllers**: Handle the business logic and interact with the models.\n  - **Views**: Format the output and responses for the API endpoints.\n  - **Services**: Interact with the database and AI/ML services for document analysis and summarization.\n  - **Middlewares**: Secure routes with Firebase authentication and JWT middleware.\n- The API endpoints are designed to be RESTful and follow best practices for error handling and response formatting.\n- The **Microservices Architecture** is also used to handle asynchronous tasks and improve scalability.\n- The API routes are secured using Firebase authentication middleware to ensure that only authenticated users can access the endpoints.\n- The API controllers handle the business logic for each route, interacting with the data models and formatting the responses.\n\n### **API Testing**\n\n- You can test the API endpoints using **Postman** or **Insomnia**. Simply make a POST request to the desired endpoint with the required parameters.\n- For example, you can test the `/upload` endpoint by sending a POST request with the document file as a form-data parameter.\n- Feel free to test all the API endpoints and explore the functionalities of the app.\n\n#### Example Request to Register a User:\n\n```bash\ncurl --location --request POST 'http://localhost:3000/register' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"email\": \"test@example.com\",\n    \"password\": \"password123\"\n}'\n```\n\n#### Example Request to Upload a Document:\n\n```bash\ncurl --location --request POST 'http://localhost:3000/upload' \\\n--header 'Authorization: Bearer \u003cyour-token\u003e' \\\n--form 'File=@\"/path/to/your/file.pdf\"'\n```\n\n### **Error Handling**\n\nThe backend APIs uses centralized error handling to capture and log errors. Responses for failed requests are returned with a proper status code and an error message:\n\n```json\n{\n  \"error\": \"An internal error occurred\",\n  \"details\": \"Error details go here\"\n}\n```\n\n\u003ch2 id=\"graphql-integration\"\u003e🧰 GraphQL Integration\u003c/h2\u003e\n\n### Introduction to GraphQL in Our Application\n\nOur application supports a fully-featured **GraphQL API** that allows clients to interact with the backend using flexible queries and mutations. This API provides powerful features for retrieving and managing data such as users, documents, and related information.\n\n### Key Features of the GraphQL API\n\n- Retrieve user details and associated documents.\n- Query specific documents using their IDs.\n- Perform mutations to create users, update document titles, and delete documents.\n- Flexible query structure allows you to fetch only the data you need.\n\n### Getting Started\n\n1. **GraphQL Endpoint**:  \n   The GraphQL endpoint is available at:\n   ```\n   https://docuthinker-ai-app.onrender.com/graphql\n   ```\n   Or, if you are running the backend locally, the endpoint will be:\n   ```\n   http://localhost:3000/graphql\n   ```\n\n2. **Testing the API**:  \n   You can use the built-in **GraphiQL Interface** to test queries and mutations. Simply visit the endpoint in your browser.\n   You should see the following interface:\n\n   \u003cp align=\"center\"\u003e\n     \u003cimg src=\"images/graphql.png\" alt=\"GraphiQL Interface\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n   \u003c/p\u003e\n\n   Now you can start querying the API using the available fields and mutations. Examples are below for your reference.\n\n### Example Queries and Mutations\n\n#### 1. Fetch a User and Their Documents\n\nThis query retrieves a user's email and their documents, including titles and summaries:\n\n```graphql\nquery GetUser {\n  getUser(id: \"USER_ID\") {\n    id\n    email\n    documents {\n      id\n      title\n      summary\n    }\n  }\n}\n```\n\n#### 2. Fetch a Specific Document\n\nRetrieve details of a document by its ID:\n\n```graphql\nquery GetDocument {\n  getDocument(userId: \"USER_ID\", docId: \"DOCUMENT_ID\") {\n    id\n    title\n    summary\n    originalText\n  }\n}\n```\n\n#### 3. Create a New User\n\nCreate a user with an email and password:\n\n```graphql\nmutation CreateUser {\n  createUser(email: \"example@domain.com\", password: \"password123\") {\n    id\n    email\n  }\n}\n```\n\n#### 4. Update a Document Title\n\nChange the title of a specific document:\n\n```graphql\nmutation UpdateDocumentTitle {\n  updateDocumentTitle(userId: \"USER_ID\", docId: \"DOCUMENT_ID\", title: [\"Updated Title.pdf\"]) {\n    id\n    title\n  }\n}\n```\n\n#### 5. Delete a Document\n\nDelete a document from a user's account:\n\n```graphql\nmutation DeleteDocument {\n  deleteDocument(userId: \"USER_ID\", docId: \"DOCUMENT_ID\")\n}\n```\n\n### Advanced Tips\n\n- **Use Fragments**: To reduce redundancy in queries, you can use GraphQL fragments to fetch reusable fields across multiple queries.\n- **Error Handling**: Properly handle errors in your GraphQL client by inspecting the `errors` field in the response.\n- **GraphQL Client Libraries**: Consider using libraries like [Apollo Client](https://www.apollographql.com/docs/react/) or [Relay](https://relay.dev/) to simplify API integration in your frontend.\n\nFor more information about GraphQL, visit the [official documentation](https://graphql.org/). If you encounter any issues or have questions, feel free to open an issue in our repository.\n\n\u003ch2 id=\"mobile-app\"\u003e📱 Mobile App\u003c/h2\u003e\n\nThe **DocuThinker** mobile app is built using **React Native** and **Expo**. It provides a mobile-friendly interface for users to upload documents, generate summaries, and chat with an AI. The mobile app integrates with the backend API to provide a seamless experience across devices.\n\nCurrently, it is in development and will be released soon on both the **App Store** and **Google Play Store**.\n\nStay tuned for the release of the **DocuThinker** mobile app!\n\nBelow is a screenshot of the mobile app (in development):\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/responsive.png\" alt=\"Mobile App\" width=\"50%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n\u003ch2 id=\"containerization\"\u003e📦 Containerization\u003c/h2\u003e\n\nThe **DocuThinker** app can be containerized using **Docker** for easy deployment and scaling. Follow these steps to containerize the app:\n\n1. Run the following command to build the Docker image:\n   ```bash\n   docker compose up --build\n   ```\n\n2. The app will be containerized and ready to run on port 3000.\n\nYou can also view the image in the **Docker Hub** repository **[here](https://hub.docker.com/repository/docker/hoangsonw/docuthinker-ai-app/)**.\n\n\u003ch2 id=\"deployment\"\u003e🚧 Deployment\u003c/h2\u003e\n\n### **Frontend Deployment (Vercel)**\n\n1. **Install the Vercel CLI**:\n\n   ```bash\n   npm install -g vercel\n   ```\n\n2. **Deploy the frontend**:\n\n   ```bash\n   vercel\n   ```\n\n3. **Follow the instructions in your terminal to complete the deployment**.\n\n### **Backend Deployment (Render)**\n\n- The backend can be deployed on platforms like **Heroku**, **Render**, or **Vercel**.\n\n- Currently, we are using **Render** to host the backend. You can access the live backend **[here](https://docuthinker-ai-app.onrender.com/)**.\n\n### **Important Note about Backend Deployment**\n\n\u003e [!IMPORTANT]\n\u003e - Please note that we are currently on the **Free Tier** of **Render**. This means that the backend server may take a few seconds to wake up if it has been inactive for a while.\n\u003e\n\u003e - Therefore, the first API call may take a bit longer to respond. Subsequent calls should be faster as the server warms up. It is completely normal to take up to 2 minutes for the first API call to respond.\n\u003e\n\u003e - Also, the **Free Tier** of **Render** only allocates **512MB and 0.1 CPU**. This may result in slower response times for API calls and document processing.\n\u003e\n\u003e - Additionally, during high traffic periods, the server may take longer to respond, although we have employed [NGINX](#load-balancing) for load balancing and caching.\n\n\u003ch2 id=\"load-balancing\"\u003e⚖️ Load Balancing \u0026 Caching\u003c/h2\u003e\n\n- We are using **NGINX** for load balancing and caching to improve the performance and scalability of the app.\n  - The **NGINX** configuration file is included in the repository for easy deployment. You can find the file in the `nginx` directory.\n  - Feel free to explore the **NGINX** configuration file and deploy it on your own server for load balancing and caching.\n  - **NGINX** can also be used for SSL termination, reverse proxying, and serving static files. More advanced configurations can be added to enhance the performance of the app.\n  - You can also use **Cloudflare** or **AWS CloudFront** for content delivery and caching to improve the speed and reliability of the app, but we are currently using **NGINX** for load balancing and caching due to costs and simplicity.\n  - For more information, refer to the **[NGINX Directory](nginx/README.md)**.\n- We are also using **Docker** with **NGINX** to deploy the **NGINX** configuration file and run the server in a containerized environment. The server is deployed and hosted on **Render**.\n- Additionally, we are using **Redis** for in-memory caching to store frequently accessed data and improve the performance of the app.\n  - **Redis** can be used for caching user sessions, API responses, and other data to reduce the load on the database and improve response times.\n  - You can set up your own **Redis** server or use a managed service like **Redis Labs** or **AWS ElastiCache** for caching.\n\n\u003ch2 id=\"jenkins\"\u003e🔗 Jenkins Integration\u003c/h2\u003e\n\n- We are using **Jenkins** for continuous integration and deployment. The Jenkins pipeline is set up to automatically test and deploy the app whenever changes are pushed to the main branch.\n- The pipeline runs the tests, builds the app, and deploys it to **Vercel** and **Render**. Feel free to visit the pipeline at **[`Jenkinsfile`](Jenkinsfile)**.\n- The pipeline is triggered automatically whenever a new commit is pushed to the main branch.\n- You can set up your own Jenkins pipeline to automate testing and deployment for your projects by following these commands and steps:\n\n1. **Install Jenkins**:\n   ```bash\n   brew install jenkins\n   ```\n2. **Start Jenkins**:\n   ```bash\n   brew services start jenkins\n   ```\n3. **Access Jenkins**:\n   Open your browser and go to `http://localhost:8080` to access the Jenkins dashboard.\n\n4. **Follow the instructions to set up Jenkins and create a new pipeline**.\n\nIf successful, you should see the Jenkins pipeline running and deploying the app automatically whenever changes are pushed to the main branch. Here is an example:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/jenkins.png\" alt=\"Jenkins Pipeline\" width=\"100%\" style=\"border-radius: 8px\"\u003e\n\u003c/p\u003e\n\n\u003ch2 id=\"testing\"\u003e🧪 Testing\u003c/h2\u003e\n\nDocuThinker includes a comprehensive suite of tests to ensure the reliability and correctness of the application. The tests cover various aspects of the app, including:\n\n- **Unit Tests**: Individual components and functions are tested in isolation to verify their correctness.\n- **Integration Tests**: Multiple components are tested together to ensure they work as expected when integrated.\n- **End-to-End Tests**: The entire application flow is tested to simulate real user interactions and verify the overall functionality.\n- **API Tests**: The API endpoints are tested to ensure they return the expected responses and handle errors correctly.\n\n### Backend Unit \u0026 Integration Testing\n\nTo run the backend tests, follow these steps:\n\n1. **Navigate to the backend directory**:\n   ```bash\n   cd backend\n   ```\n   \n2. **Install the necessary dependencies**:\n   ```bash\n   # Run the tests in default mode\n   npm run test\n   \n   # Run the tests in watch mode\n   npm run test:watch\n   \n   # Run the tests with coverage report\n   npm run test:coverage\n   ```\n   \nThis will run the unit tests and integration tests for the backend app using **Jest** and **Supertest**.\n\n### Frontend Unit \u0026 E2E Testing\n\nTo run the frontend tests, follow these steps:\n\n1. **Navigate to the frontend directory**:\n   ```bash\n   cd frontend\n   ```\n   \n2. **Install the necessary dependencies**:\n   ```bash\n   # Run the tests in default mode\n   npm run test\n   \n   # Run the tests in watch mode\n   npm run test:watch\n   \n   # Run the tests with coverage report\n   npm run test:coverage\n   ```\n   \nThis will run the unit tests and end-to-end tests for the frontend app using **Jest** and **React Testing Library**.\n\n\u003ch2 id=\"kubernetes\"\u003e🚢 Kubernetes Integration\u003c/h2\u003e\n\n- We are using **Kubernetes** for container orchestration and scaling. The app can be deployed on a Kubernetes cluster for high availability and scalability.\n- The Kubernetes configuration files are included in the repository for easy deployment. You can find the files in the `kubernetes` directory.\n- Feel free to explore the Kubernetes configuration files and deploy the app on your own Kubernetes cluster.\n- You can also use **Google Kubernetes Engine (GKE)**, **Amazon EKS**, or **Azure AKS** to deploy the app on a managed Kubernetes cluster.\n\n\u003ch2 id=\"contributing\"\u003e🔧 Contributing\u003c/h2\u003e\n\nWe welcome contributions from the community! Follow these steps to contribute:\n\n1. **Fork the repository**.\n\n2. **Create a new branch**:\n   ```bash\n   git checkout -b feature/your-feature\n   ```\n   \n3. **Commit your changes**:\n   ```bash\n   git commit -m \"Add your feature\"\n   ```\n   \n4. **Push the changes**:\n   ```bash\n   git push origin feature/your-feature\n   ```\n   \n5. **Submit a pull request**: Please submit a pull request from your forked repository to the main repository. I will review your changes and merge them into the main branch shortly.\n\nThank you for contributing to **DocuThinker**! 🎉\n\n\u003ch2 id=\"license\"\u003e📝 License\u003c/h2\u003e\n\nThis project is licensed under the **Creative Commons Attribution-NonCommercial License**. See the [LICENSE](LICENSE.md) file for details.\n\n\u003e [!IMPORTANT]\n\u003e The **DocuThinker** open-source project is for educational purposes only and should not be used for commercial applications. But free to use it for learning and personal projects!\n\n\u003ch2 id=\"alternative-docs\"\u003e📚 Additional Documentation\u003c/h2\u003e\n\nFor more information on the **DocuThinker** app, please refer to the following resources:\n- **[Web-Based Documentation](https://hoangsonww.github.io/DocuThinker-AI-App/)**\n- **[Backend README](backend/README.md)**\n- **[Frontend README](frontend/README.md)**\n- **[Mobile App README](mobile-app/README.md)**\n\n\u003ch2 id=\"author\"\u003e👨‍💻 Author\u003c/h2\u003e\n\nHere are some information about me:\n- **[Son Nguyen](https://github.com/hoangsonww)** - An aspiring Software Developer \u0026 Data Scientist\n- Feel free to connect with me on **[LinkedIn](https://www.linkedin.com/in/hoangsonw/)**.\n- If you have any questions or feedback, please feel free to reach out to me at **[hoangson091104@gmail.com](mailto:hoangson091104@gmail.com)**.\n- Also, check out my **[portfolio](https://sonnguyenhoang.com/)** for more projects and articles.\n- If you find this project helpful, or if you have learned something from the source code, consider giving it a star ⭐️. I would greatly appreciate it! 🚀\n\n---\n\n**Happy Coding and Analyzing! 🚀**\n\n**Created with ❤️ by [Son Nguyen](https://github.com/hoangsonww) in 2024-2025.**\n\n---\n\n[🔝 Back to Top](#docuthinker---ai-powered-document-analysis-and-summarization-app)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangsonww%2Fdocuthinker-ai-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoangsonww%2Fdocuthinker-ai-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangsonww%2Fdocuthinker-ai-app/lists"}