by Abhishekh Singh (https://github.com/aksweb/tensorgo)
This project is an Invoice Management and Mailing System that provides a comprehensive solution for managing invoices and sending automated email reminders for due payments. The project is divided into Frontend and Backend sections to ensure clarity and maintainability.
-
Backend API Development:
- Developed backend API endpoints to handle:
- Authentication using Google OAuth and JWT tokens.
- Invoice management to fetch, filter, and process invoice data.
- Automated email workflows integrated with Zapier.
- Developed backend API endpoints to handle:
-
Frontend Integration:
- Designed a user-friendly interface to display invoices.
- Implemented features to:
- Fetch invoice data from the backend via API calls.
- Filter invoices based on their status (Paid/Due).
- Display customer details like name, email, purchase date, due date, amount, and payment status.
-
Zapier Zap Configuration:
- Created a Zapier workflow to handle automated emails:
- Step 1: Set up a webhook in Zapier to receive dynamic email details like recipient name, amount due, and invoice ID.
- Step 2: Linked the Zapier Gmail service to send automated email reminders using the received data.
- Created a Zapier workflow to handle automated emails:
-
Zap Execution Workflow:
- Trigger the zap from the frontend:
- When the user clicks the Send Due Alert button, send a
POSTrequest to the backend server. - The backend:
- Filters invoices based on their Due status.
- Prepares the required data (e.g., recipient details and invoice information).
- Sends the filtered data to the Zapier webhook.
- Zapier processes the webhook data and triggers automated email alerts.
- When the user clicks the Send Due Alert button, send a
- Trigger the zap from the frontend:
- Google OAuth Login:
- Implemented Google OAuth for user authentication.
- Uses JWT tokens to manage user sessions and control scope throughout the web app.
- Upon successful login:
- A code is generated and sent to the backend for authentication via
GET http://localhost:5000/auth/. - The token is saved in
localStorageasuser-info.
- A code is generated and sent to the backend for authentication via
- Easy login for existing users and signup for new users.
- Logic to retain the token on page refresh:
- The token is checked in
localStorageand verified for validity. - The token expires after the predefined expiration time.
- The token is checked in
- Dashboard:
- After logging in, users are redirected to the dashboard (
localhost:5713/dashboard). - Fetch invoices using
GET http://localhost:5000/invoices:- Implemented using the
useEffecthook for real-time updates.
- Implemented using the
- Filter invoices based on Paid or Due status.
- Display customer details:
- Name, email, purchase date, due date, amount, and status.
- After logging in, users are redirected to the dashboard (
- Persistent User Data:
- User information is stored in a MongoDB database for persistent storage.
const token = localStorage.getItem('user-info');
if (token) {
// Validate the token (optional call to backend for verification).
// If valid, set the user session.
}- Endpoint:
GET localhost:5000/auth/google
Handles Google OAuth authentication. - Uses JWT to issue tokens to authenticated users.
- Endpoint:
GET localhost:5000/invoices
Retrieves all invoice details. - Filters invoices based on their status (Paid/Due).
- Invoice data is stored in MongoDB for reliability and scalability.
- Built using Zapier for seamless integration:
- Step 1: Created a webhook in Zapier to receive dynamic email details (recipient name, amount due, invoice ID).
- Step 2: Integrated Zapier's Gmail service to send automated emails using this webhook.
- Flow:
- Manager clicks the Send Due Alert button.
- Sends a
POSTrequest tohttp://localhost:5000/exezapto execute thesendDueInvoicesToZapierfunction. - Filters due customers and sends their details to the Zapier webhook.
- Zapier triggers the Gmail service to send email reminders.
- Endpoint:
GET localhost:5000/auth/google
For user authentication.
- Endpoint:
GET localhost:5000/invoices
Fetch invoice details.
- Endpoint:
POST localhost:5000/exezap
Trigger Zapier workflow for email alerts.
The backend follows MVC Architecture to ensure separation of concerns and better maintainability:
- Model: Handles database schemas and interactions with MongoDB.
- View: Manages data presentation (integrates with the frontend).
- Controller: Manages business logic and API endpoints.
git clone <repository-url>
cd invoice-management-system
npm installEnsure the following environment variables are configured in your .env file:
- Database URI for MongoDB
Example:MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/myDatabase - Zapier Webhook URL
Example:ZAPIER_WEBHOOK_URL=https://hooks.zapier.com/hooks/catch/<your-webhook-id>/ - Google OAuth Credentials
Example:GOOGLE_CLIENT_ID=<your-client-id> GOOGLE_CLIENT_SECRET=<your-client-secret>
backend: npm start frontend: npm run dev