A Next.js-powered financial intelligence platform that automatically extracts transactions from bank statements, provides AI-powered insights, and estimates tax obligations for Nigerian users.
- PDF Bank Statement Processing - Upload and extract transactions from Nigerian bank statements (GTBank, Access, UBA, First Bank)
- AI-Powered Categorization - Smart transaction categorization with user correction learning
- Income Detection & Classification - Automatically identifies and classifies different income sources
- Historical Trend Analysis - Compare spending patterns across multiple statements
- Financial Goal Tracking - Set and automatically evaluate financial todos
- Tax Estimation Engine - Calculate Nigerian tax estimates with compliance tracking
- Automated Tax Calculation - Based on progressive Nigerian tax brackets
- Income Aggregation - Combines income from multiple statements and sources
- Compliance Tracking - Monitor upcoming, overdue, and paid tax obligations
- Email Reminders - Automatic notifications for upcoming tax deadlines
- Configurable Tax Rules - Database-driven tax configuration for easy updates
- Frontend & Backend: Next.js 14 with TypeScript (full-stack framework)
- Database: PostgreSQL with Supabase (recommended) or any PostgreSQL provider
- AI: Google Gemini 1.5 Flash for transaction extraction and insights
- Deployment: Vercel with cron jobs for automated tasks
Note: You don't need to install a separate backend! Next.js provides both the frontend and backend API routes in a single application. The "backend" functionality is handled by Next.js API routes within the same project.
- Hybrid Extraction Engine - Regex parsing with AI fallback for cost efficiency
- Category Standardization System - Consistent categorization with learning capabilities
- Tax Calculation Engine - Rule-based, configurable tax calculations
- Automated Reminder System - Email notifications for tax deadlines and goal tracking
users- User accounts and authenticationstatements- Uploaded bank statements with metadatatransactions- Individual transactions with categorizationcategories- Standardized categories with keyword matchingfinancial_todos- User-defined financial goals
tax_estimates- Calculated tax estimates with status trackingtax_configurations- Flexible tax rules and bracketstax_brackets- Progressive tax calculation data
- Node.js 18+
- PostgreSQL database (Supabase recommended for easy setup)
- Google AI Studio API key (free tier available)
No! SpendWise AI uses Next.js, which is a full-stack framework. The backend functionality is handled by Next.js API routes within the same project. You only need to:
- Set up a PostgreSQL database (Supabase is recommended for free hosting)
- Configure your environment variables
- Run the Next.js development server
The API routes in the app/api/ directory handle all backend operations like PDF processing, tax calculations, and data storage.
# Clone the repository
git clone <repository-url>
cd spendwise-ai
# Install dependencies (use pnpm for this project)
pnpm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration
# Run database migrations
pnpm run db:migrate
# Start development server
pnpm run devNote: This project uses pnpm as the package manager. If you encounter npm errors, use pnpm instead.
# Database
DATABASE_URL="your-postgres-connection-string"
# AI Services
GEMINI_API_KEY="your-google-ai-studio-key"
# Email Service (Resend/SendGrid)
EMAIL_API_KEY="your-email-service-key"
FROM_EMAIL="noreply@yourdomain.com"
# App Configuration
NEXT_PUBLIC_APP_URL="https://yourdomain.com"
CRON_SECRET="your-cron-secret"spendwise-ai/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── upload/ # PDF upload endpoint
│ │ ├── transactions/ # Transaction management
│ │ ├── tax/ # Tax calculation endpoints
│ │ └── todos/ # Financial goal management
│ ├── analysis/ # Analysis dashboard pages
│ ├── tax/ # Tax overview and details
│ └── insights/ # AI insights pages
├── components/ # Reusable React components
├── lib/ # Utility functions
│ ├── ai/ # AI integration (Gemini)
│ ├── extraction/ # PDF processing logic
│ ├── categorization/ # Transaction categorization
│ ├── tax/ # Tax calculation engine
│ └── notifications/ # Email and reminder system
├── public/ # Static assets
└── types/ # TypeScript type definitions
The system uses a hybrid approach:
- Regex Parsing - Fast, free extraction for common bank formats
- AI Fallback - Google Gemini for complex or unrecognized formats
- Validation Layer - Ensures data quality and consistency
- Keyword Matching - Fast categorization using predefined keywords
- AI Categorization - Fallback for uncategorized transactions
- Learning System - Improves from user corrections
- Historical Analysis - Compares spending across multiple periods
- Trend Identification - Highlights patterns and anomalies
- Actionable Recommendations - Specific, measurable financial advice
- Progressive Tax Brackets - Nigerian tax structure with configurable rates
- Relief Allowances - Personal and consolidated relief calculations
- Income Classification - Separate handling for salary, freelance, business, and investment income
- Period-based Estimates - Monthly and yearly tax calculations
- Status Management - Track upcoming, overdue, and paid taxes
- Automated Reminders - Email notifications at 30 and 7 days before due dates
- Payment History - Complete record of tax payments
- Overdue Detection - Automatic status updates for missed deadlines
- Database-driven Rules - No hardcoded tax rates in the application
- Flexible Brackets - Easy updates for changing tax laws
- Country Support - Designed for Nigerian tax system but extensible
- Tax Reminders - Check for upcoming tax obligations
- Overdue Detection - Update status for missed deadlines
- Todo Evaluation - Assess financial goals at month-end
- Tax Reminders - 30 days and 7 days before due dates
- Overdue Alerts - Immediate notification for missed payments
- Goal Completion - Success/failure notifications for financial todos
- Payment Confirmations - Receipt when taxes are marked as paid
- Unit Tests - Extraction logic, tax calculations, categorization
- Integration Tests - AI pipeline, database operations
- E2E Tests - Complete upload-to-insights workflow
- Tax Calculation Tests - Various income levels and scenarios
# Run all tests
pnpm test
# Run with coverage
pnpm run test:coverage
# Run E2E tests
pnpm run test:e2e- Token Usage - Monitor AI API consumption
- Extraction Methods - Track regex vs AI usage
- User Engagement - Statement uploads and feature usage
- Cost Monitoring - Alert system for approaching limits
- Processing Speed - PDF extraction and analysis times
- Categorization Accuracy - User correction rates
- Tax Calculation Accuracy - User feedback on estimates
- Database - Set up PostgreSQL with Supabase or Railway
- Environment Variables - Configure all required variables
- Domain & SSL - Set up custom domain with HTTPS
- Cron Jobs - Configure automated daily tasks
- Monitoring - Set up error tracking and analytics
# Deploy to Vercel
pnpm run deploy
# Set up cron jobs in vercel.json
# Configure environment variables in Vercel dashboard- File Validation - PDF-only uploads with size limits
- Secure Storage - Temporary file handling with cleanup
- API Authentication - Protected routes with proper validation
- Data Encryption - Sensitive data encrypted at rest
All tax estimates include clear disclaimers:
- Estimates based on uploaded statements only
- Not a substitute for professional tax advice
- Users should consult qualified tax professionals
- Actual tax liability may vary
- Fork the repository
- Create feature branch
- Make changes with proper tests
- Submit pull request with description
- TypeScript - Strict typing throughout
- ESLint + Prettier - Consistent code formatting
- Component Structure - Reusable, well-documented components
- Error Handling - Comprehensive error boundaries and logging
This project is licensed under the MIT License - see the LICENSE file for details.
- API Documentation - Complete API reference
- Database Schema - Detailed table descriptions
- Tax Configuration - Guide for updating tax rules
- PDF Processing - Supported formats and troubleshooting
- Categorization - Improving accuracy with user corrections
- Tax Calculations - Understanding estimates and limitations
- Push notifications for todos and tax reminders
- Mobile app (React Native)
- Multi-bank account support
- Tax configuration admin panel
- Budget recommendations based on income
- Spending predictions
- Savings goals with compound interest calculator
- Integration with FIRS for tax filing guidance
- Monetization (freemium model)
- Partnership with savings platforms
- AI financial coaching chat
- Tax professional marketplace
- Week 2: PDF upload + extraction working
- Week 4: Full analysis pipeline + tax estimation working
- Week 6: Historical trends + todos + tax tracking functional
- Week 7: Production-ready with 10 beta users
- User Engagement - Monthly active users and statement uploads
- Feature Adoption - Usage of tax estimates and financial todos
- Accuracy Rates - Categorization and extraction accuracy
- User Satisfaction - Feedback on tax estimates and insights
SpendWise AI - Your intelligent financial assistant for smarter spending and tax compliance.
Built with ❤️ for Nigerian users who want to take control of their finances.