Backend Docs - hemanth-sunkireddy/Invoice-Management-System GitHub Wiki
- Using Express.js and deployed on Vercel
Setup
- Create a
.env
file in thebackend
folder and add the following keys:
GEMINI_API=string
MONGO_STRING=string
- Start Server:
cd backend
npm install
npm run start
- Backend runs on 4000 port
Folder Structure
(base) hemanth@Sunkireddy backend % tree
.
├── README.md
├── api
│ └── index.js
├── config
│ ├── genAI.js
│ └── mongodb.js
├── helpers
│ ├── extractionCommand.js
│ ├── invoiceExtractor.js
│ └── xlsxConverter.js
├── package-lock.json
├── package.json
├── routes
│ ├── customers.js
│ ├── file-upload.js
│ ├── home.js
│ ├── invoices.js
│ └── products.js
├── services
│ ├── customer-update.js
│ ├── invoiceDB-update.js
│ └── product-update.js
└── vercel.json
File Descriptions
- api/index.js: The entry point for the Express.js server.
- config/genAI.js: Configures Google Gemini for extracting structured data from files.
- config/mongodb.js: Manages MongoDB connection settings.
- helpers/extractionCommand.js: Commands for gemini model to execute
- helpers/invoiceExtractor.js: Implements the logic for parsing invoice data.
- helpers/xlsxConverter.js: Converts Excel files to csv and base64.
- routes/customers.js: GET request to get all the customers present in the mongodb.
- routes/file-upload.js: POST request to handle file data and update in mongodb.
- routes/invoices.js: GET request to get all the invoices present in the mongodb.
- routes/products.js: GET request to get all the products present in the mongodb.
- services/customer-update.js: request to update the customer details in the Mongodb.
- services/invoiceDB-update.js: request to update the invoice details in the Mongodb.
- services/product-update.js: request to update product details in the Mongodb.
API structure:
Please check API docs for API's structure: API Strucuture docs