A cutting-edge, full-stack expense management application designed for modern businesses and individuals who demand excellence in financial tracking and approval workflows.
π Authentication | πΌ Expense Management | π Analytics | β‘ Workflow |
---|---|---|---|
Secure Supabase Auth | Create & Track Expenses | Visual Dashboard | Multi-level Approvals |
Multi-tenant Support | Receipt OCR Scanning | Real-time Reports | Role-based Access |
Session Management | Multi-currency Support | Export Capabilities | Automated Notifications |
- π Secure Login/Signup - Powered by Supabase authentication
- ποΈ Multi-tenant Architecture - Company-based user isolation
- π₯ Role Management - Admin, Manager, and Employee roles
- π Session Handling - Automatic token refresh and validation
- β Quick Expense Creation - Intuitive form with smart validation
- π± Receipt Scanning - AI-powered OCR for automatic data extraction
- π Multi-currency Support - Real-time exchange rate conversion
- π Smart Categorization - Customizable expense categories
- π Date Tracking - Comprehensive expense timeline
- π Interactive Dashboard - Real-time expense visualization
- π Trend Analysis - Monthly and yearly spending patterns
- πΉ Budget Tracking - Set and monitor spending limits
- π Export Reports - PDF and Excel export capabilities
- π― Custom Filters - Advanced search and filtering options
- π Multi-level Approvals - Configurable approval chains
- β° Automated Notifications - Email and in-app alerts
- π¬ Comment System - Approval/rejection with feedback
- π Audit Trail - Complete approval history tracking
- ποΈ Flexible Rules - Percentage and amount-based approval rules
- π Responsive Design - Perfect on all devices
- π Dark/Light Mode - Customizable themes
- β‘ Lightning Fast - Optimized performance
- π Real-time Updates - Live data synchronization
- π§ Intuitive Navigation - User-friendly interface
graph TB
subgraph "Frontend Layer"
A[React 18 + TypeScript]
B[Tailwind CSS]
C[Vite Build Tool]
end
subgraph "Backend Layer"
D[Node.js + Express]
E[Supabase Authentication]
F[RESTful API]
end
subgraph "Data Layer"
G[Supabase PostgreSQL]
H[File Storage]
I[Real-time Subscriptions]
end
A --> D
D --> G
E --> G
F --> H
B --> A
C --> A
π¦ Expense_Frontend_v_01/
βββ π¬ README.md # You are here!
βββ π package.json # Root dependencies
βββ βοΈ scripts/ # Development scripts
β βββ π start-dev.js # Concurrent server starter
β βββ π§ setup.js # Interactive setup guide
β
βββ π Backend/ # Node.js + Express API
β βββ π¦ package.json # Backend dependencies
β βββ π .env # Environment variables
β βββ π SETUP.md # Backend setup guide
β βββ ποΈ src/
β β βββ π server.js # Express server entry
β β βββ βοΈ config/ # Configuration files
β β β βββ ποΈ database.sql # Database schema
β β β βββ π supabase.js # Supabase client
β β βββ ποΈ controllers/ # Business logic
β β β βββ π authController.js
β β β βββ π³ expenseController.js
β β β βββ π€ userController.js
β β β βββ β
approvalController.js
β β β βββ π± currencyController.js
β β βββ π‘οΈ middleware/ # Express middleware
β β β βββ π auth.js # Authentication
β β β βββ π€ upload.js # File upload
β β βββ π£οΈ routes/ # API routes
β β β βββ π auth.js
β β β βββ π³ expenses.js
β β β βββ π₯ users.js
β β β βββ β
approvals.js
β β β βββ π± currency.js
β β βββ π§ utils/ # Utility functions
β β βββ π± currency.js
β β βββ ποΈ ocr.js # Receipt scanning
β βββ π scripts/ # Database scripts
β βββ ποΈ init-db.js # Database initialization
β
βββ π¨ Frontend/ # React + TypeScript SPA
βββ π¦ package.json # Frontend dependencies
βββ π .env # Environment variables
βββ β‘ vite.config.ts # Vite configuration
βββ π― tsconfig.json # TypeScript config
βββ π¨ tailwind.config.js # Tailwind CSS config
βββ ποΈ src/
β βββ π main.tsx # Application entry
β βββ π± App.tsx # Root component
β βββ π¨ index.css # Global styles
β βββ π§© components/ # React components
β β βββ π Auth/ # Authentication UI
β β β βββ πͺ LoginPage.tsx
β β β βββ π SignupPage.tsx
β β βββ π€ Employee/ # Employee dashboard
β β β βββ π EmployeeDashboard.tsx
β β β βββ β ExpenseForm.tsx
β β β βββ π ExpenseTable.tsx
β β βββ π¨βπΌ Manager/ # Manager interface
β β β βββ π ManagerDashboard.tsx
β β β βββ β
ApprovalQueue.tsx
β β βββ π Admin/ # Admin panel
β β β βββ π AdminDashboard.tsx
β β β βββ π₯ UserManagement.tsx
β β β βββ βοΈ ApprovalRules.tsx
β β βββ π Charts/ # Data visualization
β β β βββ π ExpenseChart.tsx
β β β βββ π’ ExpenseStatusChart.tsx
β β βββ π¨ ui/ # Reusable UI components
β β βββ πΌοΈ Layout/ # Layout components
β βββ π contexts/ # React contexts
β β βββ π AuthContext.tsx
β β βββ π³ ExpenseContext.tsx
β β βββ π± CurrencyContext.tsx
β βββ π§ lib/ # Utilities & API
β β βββ π api.ts # API client
β βββ π types/ # TypeScript definitions
β βββ π index.ts
βββ π― Features.md # Detailed feature docs
Requirement | Version | Download |
---|---|---|
π’ Node.js | 18+ | Download |
π¦ npm | Latest | Included with Node.js |
ποΈ Supabase Account | Free Tier | Sign Up |
# 1οΈβ£ Clone the repository
git clone https://github.com/yourusername/expense-management-system.git
cd expense-management-system
# 2οΈβ£ Install all dependencies
npm run install-all
# 3οΈβ£ Set up environment variables
cp Backend/.env.example Backend/.env
cp Frontend/.env.example Frontend/.env
# 4οΈβ£ Configure Supabase credentials in Backend/.env
# SUPABASE_URL=https://your-project-id.supabase.co
# SUPABASE_ANON_KEY=your_anon_key
# SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# 5οΈβ£ Initialize the database
cd Backend && npm run init-db
# 6οΈβ£ Start the development servers
cd .. && npm run dev
Service | URL | Description |
---|---|---|
π¨ Frontend | http://localhost:5173 | Main application |
π Backend API | http://localhost:5000/api | REST API |
π₯ Health Check | http://localhost:5000/health | Server status |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST |
/api/auth/signup |
Create new user account | β |
POST |
/api/auth/login |
User authentication | β |
GET |
/api/auth/me |
Get current user | β |
POST |
/api/auth/logout |
End user session | β |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
GET |
/api/expenses |
List all expenses | β |
POST |
/api/expenses |
Create new expense | β |
PUT |
/api/expenses/:id |
Update expense | β |
DELETE |
/api/expenses/:id |
Delete expense | β |
POST |
/api/expenses/scan-receipt |
OCR receipt scanning | β |
Method | Endpoint | Description | Auth Required |
---|---|---|---|
GET |
/api/approvals/workflows |
Get approval workflows | β |
POST |
/api/approvals/expenses/:id/approve |
Approve expense | β |
POST |
/api/approvals/expenses/:id/reject |
Reject expense | β |
GET |
/api/approvals/rules |
Get approval rules | β |
Command | Description |
---|---|
npm run dev |
π Start both frontend and backend servers |
npm run setup |
βοΈ Interactive application setup |
npm run backend |
π Start only backend server |
npm run frontend |
π¨ Start only frontend server |
npm run install-all |
π¦ Install all dependencies |
# Server Configuration
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
# Supabase Configuration
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# External APIs
EXCHANGE_RATE_API_URL=https://api.exchangerate-api.com/v4/latest
COUNTRIES_API_URL=https://restcountries.com/v3.1/all
# API Configuration
VITE_API_URL=http://localhost:5000/api
# Supabase Configuration (if needed)
VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
π΄ Connection Refused Error
Problem: net::ERR_CONNECTION_REFUSED
Solutions:
- Ensure backend server is running on port 5000
- Check if ports are available
- Verify environment variables are correct
- Restart both servers:
npm run dev
π Authentication Issues
Problem: Invalid API key
or 401 Unauthorized
Solutions:
- Verify Supabase credentials in
.env
- Check service role key permissions
- Ensure database schema is initialized
- Run:
cd Backend && npm run init-db
ποΈ Database Connection Problems
Problem: Database errors or schema issues
Solutions:
- Check Supabase project status
- Verify network connectivity
- Run database initialization script
- Check SQL Editor in Supabase dashboard
Feature | Description | Benefit |
---|---|---|
β‘ Hot Reload | Instant development feedback | Faster development |
ποΈ Code Splitting | Optimized bundle loading | Better performance |
π± PWA Ready | Progressive Web App support | Mobile-like experience |
π Real-time Updates | Live data synchronization | Enhanced UX |
π― Lazy Loading | On-demand component loading | Reduced initial load |
We welcome contributions! Please see our Contributing Guidelines for details.
- π΄ 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
- π Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Special thanks to:
- π Supabase for the amazing backend infrastructure
- βοΈ React Team for the incredible frontend framework
- π¨ Tailwind CSS for the beautiful styling system
- β‘ Vite for the lightning-fast build tool