AI-Powered Invoice Management & Automated Payment Reminders for Freelancers
A modern, full-stack invoice tracking application with AI-powered automated reminders. Track payments, manage due dates, and let AI handle payment follow-ups via email and SMSβso you can focus on your work.
- Create, edit, and delete invoices with auto-generated invoice numbers
- Real-time dashboard with financial insights
- Track invoice status (pending, paid, overdue)
- Multiple payment methods (UPI, Bank Transfer, PayPal, Cash)
- Export/Import (CSV, JSON)
- Search and filter functionality
- Offline-first with localStorage
- AI Message Generation: OpenAI/Anthropic integration for personalized, professional reminder messages
- Smart Escalation: Automatic tone adjustment (gentle β firm β urgent) based on days overdue
- Multi-Channel Delivery: Send reminders via Email (SendGrid/Resend/SMTP) and SMS (Twilio)
- Automated Scheduling: Cron-based scheduler checks for overdue invoices every 6 hours
- Manual Controls: Send immediate reminders, pause/resume automation per invoice
- Business Hours: Respect business hours and exclude weekends
- Real-time cost tracking for AI, Email, and SMS services
- Monthly spending dashboard with usage statistics
- Budget limits with automatic enforcement
- Cost warning notifications at 80% threshold
- Service credit balance monitoring
- Rate Limiting: 4-tier protection (general, strict, reminder, test)
- JWT Authentication: Secure token-based authentication
- Audit Logging: Complete audit trail with daily log rotation
- Input Sanitization: XSS and NoSQL injection prevention
- API Key Encryption: AES-256 encryption for all API keys
- Security Headers: Helmet.js for HTTP security headers
- Reminder history with delivery status tracking
- Cost analysis and usage metrics
- Reminder effectiveness tracking
- Error logging and diagnostics
- Audit log viewer with filtering
- Node.js 18+ and npm
- MongoDB 6.0+ (local or cloud)
- API keys for services (optional):
- OpenAI or Anthropic (for AI reminders)
- SendGrid/Resend (for email)
- Twilio (for SMS)
-
Clone the repository
git clone https://github.com/yourusername/invoice-guard.git cd invoice-guard -
Install dependencies
# Install root dependencies npm install # Install backend dependencies cd backend npm install cd ..
-
Configure environment
cd backend cp .env.example .env # Edit .env with your configuration
-
Start the application
# Start backend server cd backend npm start # In another terminal, serve frontend cd frontend npx http-server -p 8000
-
Access the application
- Frontend:
http://localhost:8000 - Backend API:
http://localhost:3000 - Health Check:
http://localhost:3000/api/health
- Frontend:
invoice-guard/
βββ frontend/ # Client-side application
β βββ index.html # Main application
β βββ unsubscribe.html # Opt-out page
β βββ css/
β β βββ styles.css # Main styles
β β βββ dark-premium.css # Dark theme
β β βββ premium-ui.css # Premium components
β βββ js/
β βββ app.js # Main controller
β βββ invoice.js # Invoice logic
β βββ reminder.js # Reminder UI
β βββ reminder-settings.js # Settings panel
β βββ reminder-history.js # History viewer
β βββ service-config.js # Service configuration
β βββ cost-dashboard.js # Cost monitoring
β βββ test-preview.js # Testing tools
β βββ ... # Other modules
βββ backend/ # Node.js/Express API
β βββ server.js # Express server
β βββ models/ # Mongoose models
β β βββ ClientContact.js
β β βββ ReminderLog.js
β β βββ ReminderConfig.js
β β βββ ServiceConfig.js
β βββ routes/ # API routes
β β βββ reminders.js
β β βββ contacts.js
β β βββ serviceConfig.js
β β βββ costs.js
β β βββ auditLogs.js
β β βββ ...
β βββ services/ # Business logic
β β βββ aiService.js # AI integration
β β βββ emailService.js # Email delivery
β β βββ smsService.js # SMS delivery
β β βββ schedulerService.js # Cron scheduler
β β βββ notificationService.js
β βββ middleware/ # Security & utilities
β β βββ rateLimiter.js # Rate limiting
β β βββ auth.js # JWT authentication
β β βββ auditLog.js # Audit logging
β β βββ sanitizer.js # Input sanitization
β βββ config/
β βββ database.js # MongoDB config
βββ tests/ # Property-based tests
β βββ *.properties.test.js # PBT tests
β βββ *.unit.test.js # Unit tests
βββ docs/ # Documentation
β βββ ARCHITECTURE.md
β βββ DEPLOYMENT.md
β βββ SETUP.md
βββ .kiro/ # Spec documentation
β βββ specs/ai-automated-reminders/
β βββ requirements.md
β βββ design.md
β βββ tasks.md
βββ SECURITY.md # Security guide
βββ FEATURES.txt # Complete feature list
βββ README.md # This file
Create a .env file in the backend/ directory:
# Server
PORT=3000
NODE_ENV=development
# Database
DB_HOST=localhost
DB_PORT=3306
DB_NAME=invoice_guard
# Security
ENCRYPTION_KEY=your-32-character-encryption-key
JWT_SECRET=your-jwt-secret-key
JWT_EXPIRES_IN=7d
# AI Service (choose one)
AI_PROVIDER=openai
OPENAI_API_KEY=sk-your-key
# OR
ANTHROPIC_API_KEY=sk-ant-your-key
# Email Service (choose one)
EMAIL_PROVIDER=sendgrid
SENDGRID_API_KEY=SG.your-key
SENDER_EMAIL=noreply@yourdomain.com
# OR
RESEND_API_KEY=re_your-key
# OR use SMTP
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
# SMS Service
TWILIO_ACCOUNT_SID=ACyour-sid
TWILIO_AUTH_TOKEN=your-token
TWILIO_PHONE_NUMBER=+1234567890
# Scheduler
CRON_SCHEDULE=0 */6 * * *
ENABLE_SCHEDULER=true
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100// Create an invoice
POST /api/invoices
{
"clientName": "John Doe",
"amount": 50000,
"dueDate": "2024-02-15",
"email": "john@example.com",
"phone": "+919876543210"
}- Navigate to Settings β Service Configuration
- Add your OpenAI/Anthropic API key
- Configure email service (SendGrid/Resend/SMTP)
- Configure SMS service (Twilio)
- Test connections
- Go to Settings β Reminder Settings
- Enable automated reminders
- Set interval (default: 3 days)
- Choose channels (email, SMS, or both)
- Configure business hours
- Set maximum reminders per invoice
- View Cost Dashboard for real-time spending
- Set monthly budget limits
- Receive warnings at 80% threshold
- Track usage by service (AI, Email, SMS)
GET /api/audit-logs?userId=user123&startDate=2024-01-01# Run all tests
npm test
# Run specific test suite
npm test -- invoice.properties.test.js
# Run tests in watch mode
npm run test:watch
# Run with coverage
npm run test:coverage- Rate Limiting: Prevents API abuse with 4-tier protection
- JWT Authentication: Secure token-based auth (ready for implementation)
- Audit Logging: Complete audit trail stored in
backend/logs/ - Input Sanitization: XSS and injection attack prevention
- API Key Encryption: AES-256 encryption for stored credentials
- Security Headers: Helmet.js for HTTP security
- CORS Configuration: Configurable cross-origin policies
See SECURITY.md for detailed security documentation.
GET /api/invoices- List all invoicesPOST /api/invoices- Create invoicePUT /api/invoices/:id- Update invoiceDELETE /api/invoices/:id- Delete invoice
POST /api/reminders/send-now- Send immediate reminderPOST /api/reminders/pause- Pause automationPOST /api/reminders/resume- Resume automationGET /api/reminders/status/:invoiceId- Check status
POST /api/service-config- Add service configGET /api/service-config- List configurationsPUT /api/service-config/:id- Update configPOST /api/service-config/test- Test connection
GET /api/costs/monthly- Monthly costsGET /api/costs/usage- Usage statisticsPOST /api/costs/budget- Set budget limit
GET /api/audit-logs- View audit logsGET /api/audit-logs/summary- Log summary
# Login to Heroku
heroku login
# Create app
heroku create invoice-guard-app
# Add MongoDB addon
heroku addons:create mongolab:sandbox
# Set environment variables
heroku config:set OPENAI_API_KEY=sk-your-key
heroku config:set SENDGRID_API_KEY=SG-your-key
# Deploy
git push heroku mainSee docs/DEPLOYMENT.md for detailed AWS deployment guide.
# Install Netlify CLI
npm install -g netlify-cli
# Deploy
cd frontend
netlify deploy --prod- Vanilla JavaScript (ES6+)
- HTML5/CSS3
- Tailwind CSS
- Local Storage API
- Node.js 18+
- Express.js
- MongoDB/Mongoose
- JWT for authentication
- OpenAI GPT-4 / Anthropic Claude
- SendGrid / Resend / Nodemailer
- Twilio SMS
- Helmet.js
- Express Rate Limit
- Validator.js
- Crypto (AES-256)
- Vitest
- Fast-check (property-based testing)
- Frontend Load Time: < 2 seconds
- API Response Time: < 200ms (average)
- Database Queries: Optimized with indexes
- Caching: AI message caching for similar requests
- Rate Limiting: Prevents abuse and ensures stability
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
- OpenAI for GPT-4 API
- Anthropic for Claude API
- SendGrid for email delivery
- Twilio for SMS services
- All open-source contributors
- Issues: GitHub Issues
- Email: support@invoiceguard.com
- Documentation: docs/
- WhatsApp Business API integration
- Multi-language support
- Voice call reminders
- Payment gateway integration
- Mobile app (React Native)
- Advanced analytics dashboard
- Team collaboration features
Made with β€οΈ for freelancers worldwide
β Star this repo if you find it helpful!