This project is a Docx to PDF Converter web application where users can:
- Upload a
.docx
file. - Optionally encrypt the PDF with a password.
- View the file's metadata after upload.
- Download the converted PDF via a button or email.
The system is built using microservice architecture and provides a seamless experience with notification support. Users receive an email with a download button for the converted PDF.
- Frontend: Built with React.js and Tailwind CSS for an intuitive UI/UX.
- Backend: Uses Python, Flask, Docker, RabbitMQ, and MongoDB to handle the conversion, notifications, and metadata.
- Microservices:
- Gateway: Routes requests to the appropriate services.
- Metadata Service: Fetches metadata for the uploaded files.
- Download Service: Handles PDF downloads.
- RabbitMQ Service: Manages communication queues.
- Docx-to-PDF Converter Service: Converts
.docx
files to.pdf
. - Notification Service: Sends emails with PDF download links.
- Architecture: Uses Minikube and Docker for scalability and containerization.
-
Upload a Docx File:
- Go to http://localhost:3000.
- Upload a
.docx
file. - Provide your email and an optional password to encrypt the PDF.
- Submit the form.
-
View File Metadata:
- Once the file is uploaded, the application will display its metadata (e.g., file size, upload date).
-
Download the PDF:
- Click the "Download" button to download the PDF immediately.
- Alternatively, check your email for a notification containing a download link.
-
Upload File
- URL:
http://localhost:8081/upload
- Method:
POST
- Request (Form Data):
docx
(required)email
(optional to send file through email)password
(optional to encrypt and protect generated PDF)
- Response:
{ "docx_id": "6742147169a563840a36958e", "message": "file uploaded successfully" }
- URL:
-
Get File Metadata
- URL:
http://localhost:8081/getMetadata?fid=<docx_id>
- Method:
GET
- Query Parameter:
fid
(docx_id from upload response)
- Response:
{ "author": null, "created": null, "keywords": null, "modified": "Sat, 23 Nov 2024 17:28:44 GMT", "paragraph_count": 268, "subject": null, "title": "Word Document", "word_count": 775 }
- URL:
-
Download PDF
- URL:
http://localhost:8081/download?fid=<docx_id>
- Method:
GET
- Query Parameter:
fid
(docx_id from upload response)
- Response: PDF file
- URL:
Ensure the following are installed:
- Docker
- Python
- Kubectl
- Minikube
- MongoDB
-
Clone the repository:
git clone <repository-url> cd Rapidfort-Assignment/word-to-pdf-converter-backend
-
Start Minikube:
minikube start minikube addon enable ingress
-
Add the following to your
/etc/hosts
file:127.0.0.1 docx2pdfconverter.com 127.0.0.1 rabbitmq-manager.com
-
Run the backend setup scripts:
- Start all Kubernetes manifests:
./start.sh
- Build and push Docker images:
./buildandpush.sh
- Start all Kubernetes manifests:
-
Open a new terminal and run:
minikube tunnel
-
Set up RabbitMQ queues:
- Open RabbitMQ Manager in your browser.
- Login with:
- Username: guest
- Password: guest
- Create two queues:
docx
pdf
The backend services should now be running. You can access them at:
- Gateway: http://docx2pdfconverter.com
- RabbitMQ Dashboard: http://rabbitmq-manager.com
-
Navigate to the frontend directory:
cd Rapidfort-Assignment/word-to-pdf-convert-frontend
-
Install dependencies:
npm install
-
Start the frontend server:
npm run start
Access the frontend at: http://localhost:3000
This application is built using microservices architecture for better scalability and modularity.
- Gateway Service: Routes requests to the correct microservices.
- Metadata Service: Retrieves and sends file metadata to the user.
- Docx-to-PDF Converter Service: Converts
.docx
files to.pdf
. - Download Service: Handles the PDF file downloads.
- Notification Service: Sends emails with download links.
- RabbitMQ Service: Manages communication between services using two queues (
docx
andpdf
).
Below is the architecture diagram showing the system workflow:
- Frontend: React.js, Tailwind CSS
- Backend: Python, Flask, MongoDB, RabbitMQ
- DevOps: Docker, Minikube, Kubernetes
Want to contribute? Follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Describe your changes"
- Push the branch:
git push origin feature-name
- Open a pull request and explain your changes.
Enjoy using the Docx to PDF Converter! 🚀