
Building PDF Open Source Services with Angular & GCP - PDF AI Chat

PDFun - Open Source PDF Services (4 Part Series)
Welcome to the first part of the journey in building open source PDF service using Angular (Analogjs), Firestore, Cloud Storage, and CloudRun. This project serves as a platform for sharing my knowledge, continually learning best practices, and simultaneously contributing to the community.
Demo: https://pdfun.xyz
GitHub - dalenguyen/pdfun
The solution is built around GCP ecosystem, it’s better to deploy the project on GCP, so it can access their services. There are two parts of the solution:
- Web UI (Analogjs - Angular): handle user interaction
- Backend (Node - Express): process PDF files
In this part, we will explore the process of building a solution that you can chat with your PDF file using AI.
Architecture Overview

In general, there’re two parts of the process: uploading PDF file & Chat with your PDF.
Uploading PDF file
This is the first step before you can chat with your PDF - uploading a PDF file. Here is the process:
- User uploads an PDF file -> Cloud Storage -> Save metadata to Firestore
- Firestore -> trigger PDF service (cloud run service)
- Create an OpenAI assistant
- Download PDF file from Cloud storage
- Upload PDF file -> OpenAI -> vector store
- Add vector store -> OpenAI Assistant
- Save assistant data -> Firestore
Chat with your PDF
This is the next step after your PDF file is processed. After you upload your PDF file, you will be redirected to a chat page with the document id in the param, so we can use it to retrieve data from firestore.
Since we have the assistant id saved from the previous process, so every time you send a chat message, the assistant id is included, so you can chat with the correct data.
On the chat page, we need to listen to the document, and make sure that the assistant
exists before chatting.

After that, each chat message will include the assistant, so the backend don’t need to read data from Firestore.

For the backend that handles the chat, I’m using Analogjs, so it’s included. You can create any API that you want to the handle the chat.

Now we a fully running solution for chatting with your PDF files using OpenAI and https://pdfun.xyz.
Questions?
If you have any questions or run into any issues, please don’t hesitate to create an issue on our GitHub repository. Alternatively, you can chat with me. I’m here to help and would love to hear your feedback.
Stay tuned for the next part. Until then, happy coding!