A full-stack MERN application for managing company expenses with multi-level approval workflows.
- Build Tool: Vite 5.0
- Framework: React 18.2 (JSX)
- Styling: TailwindCSS 3.4
- Routing: React Router DOM 6.20
- HTTP Client: Axios 1.5
- Charts: Chart.js 4.x + react-chartjs-2 5.x
- Runtime: Node.js
- Framework: Express.js 4.18
- Database: MongoDB with Mongoose 7.5
- Authentication: JWT (jsonwebtoken)
- Password Hashing: bcryptjs 2.4
- File Upload: Multer
- Email: Nodemailer
- โ Company registration with automatic admin user creation
- โ Country-based currency auto-selection (195+ countries)
- โ Secure password hashing with bcrypt
- โ RESTful API architecture
- โ Multi-role dashboards (Admin/Manager/Employee)
- โ Advanced filtering and search
- โ Change password feature
- โ Forgot Password with Email Verification (6-digit code, 10-min expiry)
- โ JWT authentication (7-day expiry)
- โ Role-based access control (Admin/Manager/Employee)
- โ Receipt upload for expenses (images & PDFs, 5MB limit)
- โ CSV export functionality with role-based filtering
- โ Multi-level expense approval workflow
- โ Rejection reasons tracking
- โ Password reset emails with verification code
- โ Expense submission notifications to managers
- โ Expense approval confirmations to employees
- โ Expense rejection notifications with reasons
- โ Welcome emails for new users with credentials
- โ Professional HTML email templates (responsive design)
- โ Interactive Charts with Chart.js
- โ Expense by Category - Pie/Doughnut chart
- โ Expense Trends - Line chart over time
- โ Status Distribution - Bar chart (Pending/Approved/Rejected)
- โ Top Categories - Horizontal bar chart
- โ Real-time data updates
- โ Responsive chart design
- โ Dark Mode ๐ (System preference detection, localStorage persistence)
- โ Comprehensive animations (fadeIn, slideIn, scaleIn, shake, pulse)
- โ Smooth transitions and hover effects
- โ Mobile-responsive design
- โ Color-coded status badges
- โ Loading states and spinners
- โ Toast notifications
Expense-Management/
โโโ backend/ # Express.js API server
โ โโโ src/
โ โ โโโ models/ # Mongoose schemas
โ โ โโโ routes/ # API endpoints
โ โ โโโ utils/ # DB connection
โ โโโ package.json
โโโ frontend/ # Vite + React app
โโโ src/
โ โโโ pages/ # React pages
โ โโโ App.jsx
โโโ package.json
- Node.js (v18+)
- MongoDB (running locally or MongoDB Atlas)
- Git
- Navigate to backend folder:
cd backend- Install dependencies:
npm install- Create
.envfile:
Copy-Item .env.example .env-
Update
.envwith your MongoDB connection string if needed. -
Start the backend server:
npm startThe backend will run on http://localhost:5000
- Open a new terminal and navigate to frontend folder:
cd frontend- Install dependencies:
npm install- Start the development server:
npm run devThe frontend will run on http://localhost:5173
The application features comprehensive data visualization using Chart.js to help users understand their expense patterns:
-
Expense by Category (Pie/Doughnut Chart)
- Visual breakdown of expenses by category
- Interactive legends
- Percentage distribution
- Color-coded categories
-
Expense Trends Over Time (Line Chart)
- Track spending patterns over months
- Multiple datasets for different categories
- Smooth curves with tension
- Responsive tooltips
-
Status Distribution (Bar Chart)
- Compare pending, approved, and rejected expenses
- Count and amount visualizations
- Color-coded by status (yellow/green/red)
-
Top Spending Categories (Horizontal Bar)
- Identify highest expense categories
- Sorted by amount
- Easy comparison across categories
- โ Real-time updates - Charts refresh with data changes
- โ Interactive tooltips - Hover for detailed information
- โ Responsive design - Adapts to screen size
- โ Smooth animations - Professional transitions
- โ Role-based data - Each role sees relevant data
- โ Custom colors - Brand-consistent color palette
- โ Export-ready - Charts can be exported as images
- Employee Dashboard: Personal expense analytics
- Manager Dashboard: Team expense overview
- Admin Dashboard: Company-wide analytics
The application features a complete dark mode implementation for comfortable viewing in low-light conditions:
- ๐จ Complete UI Coverage: All pages, components, and charts support dark mode
- ๐พ Persistent Preference: Your theme choice is saved in localStorage
- ๐ System Sync: Automatically detects your system's dark mode preference
- โก Instant Toggle: Switch between light and dark themes with one click
- ๐ Chart Compatibility: All Chart.js visualizations adapt to dark mode
- ๐ฏ Consistent Design: Carefully crafted dark color palette for optimal readability
- โ Authentication pages (Login, Register, Forgot Password)
- โ All dashboards (Employee, Manager, Admin)
- โ Settings page
- โ Forms and input fields
- โ Tables and data grids
- โ Charts and visualizations
- โ Status badges and alerts
- โ Navigation headers
Dark Mode Colors:
- Background:
#0f172a(slate-900) - Cards:
#1e293b(slate-800) - Borders:
#334155(slate-700) - Text:
#e2e8f0(slate-200) - Muted Text:
#94a3b8(slate-400)
- Look for the sun/moon toggle button in the top-right corner of any page
- Click to switch between light and dark themes
- Your preference is automatically saved for future visits
- Tailwind CSS:
darkMode: 'class'strategy - React Context: ThemeContext provides global state management
- Chart.js: Dynamic color configuration based on theme
- localStorage: Theme persistence across sessions
Automated email notifications keep all stakeholders informed:
- Password Reset - 6-digit verification code (10-min expiry)
- Expense Submitted - Notify manager of new submissions
- Expense Approved - Confirm approval to employee
- Expense Rejected - Notify with rejection reason
- New User Welcome - Credentials and onboarding info
- โ Professional HTML templates
- โ Mobile-responsive design
- โ Color-coded by type
- โ Automatic sending
- โ Error handling & logging
See EMAIL_SETUP.md for Gmail configuration instructions.
Register a new company with an admin user.
Request Body:
{
"companyName": "Acme Corp",
"country": "US",
"adminName": "John Doe",
"adminEmail": "john@acme.com",
"adminPassword": "securepassword123"
}Response:
{
"message": "Company and admin created",
"company": {
"id": "...",
"name": "Acme Corp",
"currency": "USD"
},
"admin": {
"id": "...",
"email": "john@acme.com",
"name": "John Doe"
}
}- View all company expenses
- Manage users (create, edit, delete employees & managers)
- Approve/reject any expense
- Access all analytics and reports
- Export complete company data
- Change user roles
- View team expenses
- Approve/reject team member expenses
- Submit personal expenses
- View team analytics
- Export team expense data
- Assign expenses to employees
- Submit expenses with receipts
- Track expense status
- View personal analytics
- Export personal expense history
- Update profile & change password
- Upload receipt images/PDFs
The system supports 195+ countries with automatic currency detection via REST Countries API.
Popular currencies:
- ๐บ๐ธ US โ USD ($)
- ๐ฎ๐ณ IN โ INR (โน)
- ๐ฌ๐ง GB โ GBP (ยฃ)
- ๐ช๐บ EU โ EUR (โฌ)
- ๐ฏ๐ต JP โ JPY (ยฅ)
- ๐จ๐ฆ CA โ CAD (C$)
- ๐ฆ๐บ AU โ AUD (A$)
- And 188+ more!
- EMAIL_SETUP.md - Gmail configuration for email notifications
- EMAIL_NOTIFICATIONS.md - Complete email system documentation
- EMAIL_QUICK_REFERENCE.md - Quick setup guide for emails
- FORGOT_PASSWORD_IMPLEMENTATION.md - Password reset feature details
- HACKATHON_STRATEGY.md - Feature roadmap and priorities
- ๐จ Professional UI/UX - Smooth animations, modern design
- ๐ Data Visualization - Interactive charts with Chart.js
- ๐ง Email Integration - Automated notifications with HTML templates
- ๐ Security - JWT auth, password hashing, reset verification
- ๐ฑ Responsive - Works perfectly on mobile and desktop
- ๐ Global - Supports 195+ countries and currencies
- ๐ Receipt Management - Upload and view receipt images/PDFs
- ๐ Analytics - Real-time expense insights and trends
- ๐ Workflow - Complete approval/rejection workflow
- ๐พ Export - CSV export for reporting
- RESTful API design
- JWT-based authentication
- Role-based access control (RBAC)
- MongoDB with Mongoose ODM
- Multer for file uploads
- Nodemailer for emails
- React with functional components
- TailwindCSS for styling
- Chart.js for data visualization
- Multi-level approval chains (threshold-based)
- Budget tracking and alerts
- Expense categories customization
- Advanced analytics dashboard
- Mobile app (React Native)
- Integration with accounting software
- Recurring expense templates
- Expense report generation (PDF)
- Dark mode
- Multi-language support
MIT