📌 About the Project 🚀 Inspiration Managing and verifying financial documents—especially account statements—manually is time-consuming and error-prone. We wanted to automate the process of scanning Gmail inboxes, identifying relevant statements, and verifying them using account numbers. This project was inspired by real-world use cases such as financial auditing, personal finance automation, and KYC (Know Your Customer) workflows.

đź§  What I Learned How to authenticate with Gmail API using OAuth2 securely.

Parsing email data and attachments using NestJS with TypeScript.

Extracting and scanning content from PDFs, including password-protected files.

Building secure, well-structured REST APIs with file handling, error reporting, and search criteria support.

Understanding how to manage user authorization, temporary file storage, and asynchronous operations.

🛠️ How It Was Built Framework: NestJS (Node.js + TypeScript)

Email Access: Gmail API using OAuth2 (no token refresh post-revocation)

PDF Processing: pdf-parse, qpdf, and custom password-checking logic

Storage: Attachments stored in a /attachments-temp directory

API Routes:

/search: Search and analyze Gmail emails based on subject, sender, and account number

/check-pdf: Check password-protected PDFs for account number

/download-pdf: Download specific attachments

/delete-pdf: Remove unwanted files

đź§© Challenges Faced Gmail API limitations on searching messages required parsing entire message bodies and attachments.

Dealing with password-protected PDFs—standard libraries do not fully support encrypted files out of the box.

Ensuring secure handling of sensitive data, like account numbers and temporary files.

Managing OAuth token revocation and respecting Gmail’s API usage policies without refreshing tokens once revoked.

Built With

  • api
  • attachments
  • axios
  • azure
  • express.js
  • fs/promises
  • gmail
  • maintainable-code-nestjs-?-progressive-node.js-framework-for-building-efficient-server-side-applications-gmail-api-?-access-gmail-messages
  • nestjs
  • node.js
  • oauth2
  • pdf-parse
  • qpdf
  • swagger/openapi
  • typescript
Share this project:

Updates

Submission history