A modern, secure, and cloud-powered full-stack web application for tracking personal expenses. Built with Firebase (Authentication & Firestore), Spring Boot backend (optional), and vanilla JavaScript frontend featuring interactive charts, dark mode, responsive UI, and real-time data sync.
- 🔥 Firebase Powered - Cloud authentication and real-time Firestore database
- 🎯 Dual Backend Architecture - Works with Firebase directly OR Spring Boot backend
- 🔐 Secure Authentication - Firebase Auth with email/password
- 📊 Interactive Charts - Beautiful visualizations with Chart.js
- 🌗 Dark Mode - Eye-friendly theme with persistent preference
- 📱 Fully Responsive - Optimized for mobile, tablet, and desktop
- ⚡ Real-time Sync - Instant data updates across all devices
- 🛡️ Multi-Layer Validation - Frontend + Backend validation
- 🚀 Production Ready - Deployed and tested
- ✅ User Authentication - Secure login/signup with Firebase Auth
- ✅ Add Expenses - Quick expense entry with real-time validation
- ✏️ Edit & Update - Modify existing records seamlessly
- 🗑️ Delete - Remove expenses with confirmation
- 📋 Real-time List - Auto-updates when data changes
- 💰 Summary Dashboard - Total expenses, monthly spending, daily average
- 🔄 Auto-Sync - Firebase Firestore real-time synchronization
- 👤 User Isolation - Each user sees only their own expenses
- 🍩 Category Distribution - Doughnut chart showing spending breakdown
- 📊 Category Comparison - Bar chart for easy analysis
- 📈 Monthly Trend - Line chart tracking spending patterns
- 🎯 Monthly Distribution - Pie chart for monthly insights
- 📉 Category Progress - Visual progress bars per category
- 🌗 Theme Toggle - Seamless light/dark mode switching
- 🔍 Filter & Sort - By category, date, or amount
- 💫 Smooth Animations - Professional transitions and hover effects
- 🎭 Empty States - Beautiful placeholders when no data exists
- 📱 Mobile Optimized - Touch-friendly responsive design
- 🎨 Modern Design - Clean interface with gradient cards
- ⚡ Fast Loading - Optimized performance
- 🔐 Firebase Authentication - Industry-standard user management
- ✔️ Frontend Validation - Instant feedback before submission
- 🛡️ Backend Validation - Server-side security (Spring Boot optional)
- 📏 Firestore Security Rules - Database-level access control
- 🔒 XSS Prevention - Input sanitization on all layers
- 🚫 SQL Injection Safe - No SQL database used (NoSQL Firestore)
┌─────────────────────────────────────────────────────────────┐
│ Frontend (Vanilla JS) │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ api-service.js (Unified API Layer) │ │
│ │ • ExpenseValidator (Frontend validation) │ │
│ │ • ExpenseAPI (Backend abstraction) │ │
│ │ • Supports both Firebase & Spring Boot │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────┴─────────────────┐
│ │
┌───────▼────────┐ ┌───────────▼──────────┐
│ Firebase │ │ Spring Boot Backend │
│ (Default) │ │ (Optional) │
├────────────────┤ ├──────────────────────┤
│ • Auth │ │ • Firebase Admin SDK │
│ • Firestore DB │ │ • REST API │
│ • Real-time │ │ • Firestore DB │
│ • Free tier │ │ • Railway hosting │
└────────────────┘ └──────────────────────┘
Expense Tracker/
│
├── Frontend/ # Client-side application
│ ├── index.html # Main HTML file
│ ├── styles.css # Modern CSS with animations
│ ├── app.js # UI logic and event handlers
│ ├── firebase-auth.js # Authentication & user management
│ ├── api-service.js # Unified API layer (NEW!)
│ ├── firebase-config.js # Firebase configuration
│ └── team.html # Team page
│
├── Backend/ # Spring Boot (Optional)
│ ├── src/main/java/com/expensetracker/
│ │ ├── ExpenseTrackerApplication.java
│ │ ├── config/
│ │ │ └── FirebaseConfig.java # Firebase Admin SDK setup
│ │ ├── controller/
│ │ │ └── ExpenseController.java # REST endpoints
│ │ ├── model/
│ │ │ └── Expense.java # Entity with validation
│ │ ├── service/
│ │ │ └── ExpenseService.java # Business logic
│ │ └── dto/
│ │ └── ErrorResponse.java # Error handling
│ ├── src/main/resources/
│ │ └── application.properties # Configuration
│ ├── serviceAccountKey.json # Firebase credentials (gitignored)
│ ├── pom.xml # Maven dependencies
│ └── target/
│ └── expense-tracker-1.0.0.jar # Built artifact
│
├── Documentation/
│ ├── COMPLETE_DEPLOYMENT.md # Full deployment guide
│ ├── RAILWAY_DEPLOYMENT.md # Railway-specific guide
│ ├── FIREBASE_BACKEND_SETUP.md # Backend Firebase setup
│ ├── FRONTEND_UPDATE_COMPLETE.md # Frontend architecture
│ └── ERROR_FIXES.md # Common issues & solutions
│
└── README.md # This file
| Technology | Version | Purpose |
|---|---|---|
| HTML5 | - | Structure and semantics |
| CSS3 | - | Styling, animations, theming |
| JavaScript | ES6+ | Logic, API calls, DOM manipulation |
| Chart.js | 4.4.0 | Data visualization |
| Firebase SDK | 10.7.1 | Authentication & Firestore |
| Technology | Version | Purpose |
|---|---|---|
| Java | 17+ | Core language |
| Spring Boot | 3.1.5 | Web framework |
| Firebase Admin SDK | 9.2.0 | Firestore operations |
| Maven | 3.6+ | Build tool |
| Jakarta Validation | 3.0.2 | Input validation |
| Technology | Type | Features |
|---|---|---|
| Firebase Firestore | NoSQL | Real-time sync, offline support, scalable |
- ✅ Modern web browser (Chrome, Firefox, Edge, Safari)
- ✅ Firebase project (free tier available)
- ✅ Internet connection
- ✅ Java 17 or higher (Download)
- ✅ Maven 3.6+ (Download)
- ✅ Firebase project with service account
- ✅ Modern web browser
Check installations:
java -version
mvn -version- Go to Firebase Console
- Create a new project
- Enable Authentication → Email/Password
- Enable Firestore Database (Start in test mode)
Update Frontend/firebase-config.js:
window.firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT.appspot.com",
messagingSenderId: "YOUR_SENDER_ID",
appId: "YOUR_APP_ID"
};cd Frontend
npx serve .
# Or use VS Code Live Servernpm install -g firebase-tools
firebase login
firebase init hosting
firebase deployDone! ✅ Your app is live on Firebase!
- Firebase Console → Project Settings → Service Accounts
- Click "Generate New Private Key"
- Save as
Backend/serviceAccountKey.json
Ensure Backend/src/main/resources/application.properties:
server.port=8080
logging.level.com.expensetracker=INFOcd Backend
mvn clean package
mvn spring-boot:runBackend will run on http://localhost:8080
In Frontend/api-service.js:
const API_CONFIG = {
USE_FIREBASE: false, // ← Change to false
BACKEND_URL: 'http://localhost:8080/api/expenses'
};cd Frontend
npx serve .See RAILWAY_DEPLOYMENT.md for detailed instructions.
Production: https://your-app.railway.app/api/expenses
Local: http://localhost:8080/api/expenses
GET /api/expenses
Headers: X-User-Id: {userId}Response:
[
{
"id": "abc123",
"title": "Groceries",
"amount": 1200.50,
"category": "Food",
"date": "2025-11-11",
"userId": "user123"
}
]POST /api/expenses
Headers:
Content-Type: application/json
X-User-Id: {userId}
Body:
{
"title": "Lunch",
"amount": 350.00,
"category": "Food",
"date": "2025-11-11"
}Response: 201 Created with created expense
PUT /api/expenses/{id}
Headers:
Content-Type: application/json
X-User-Id: {userId}
Body: (same as create)Response: 200 OK with updated expense
DELETE /api/expenses/{id}
Headers: X-User-Id: {userId}Response: 204 No Content
| Icon | Category | Use Cases |
|---|---|---|
| 🍕 | Food | Meals, groceries, restaurants |
| 🚗 | Transport | Fuel, taxi, bus, metro |
| 🎬 | Entertainment | Movies, games, Netflix |
| 💡 | Utilities | Electricity, water, internet |
| 🏥 | Healthcare | Medicine, doctor, insurance |
| 🛍️ | Shopping | Clothes, gadgets, accessories |
| 📚 | Education | Books, courses, tuition |
| 📌 | Other | Everything else |
| Field | Rule | Error Message |
|---|---|---|
| Title | Required, 1-100 chars | "Title is required" / "Title too long" |
| Amount | 0.01 - 999,999,999.99 | "Amount must be greater than 0" |
| Category | Alphanumeric + spaces/hyphens | "Invalid characters in category" |
| Date | Not in future | "Date cannot be in the future" |
-
Frontend Validation (
api-service.js)- Instant user feedback
- Prevents invalid submissions
- Reduces server load
-
Backend Validation (Spring Boot - Optional)
- Jakarta Bean Validation
- Custom business rules
- Server-side enforcement
-
Firestore Security Rules
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /expenses/{expense} { allow read, write: if request.auth != null && resource.data.userId == request.auth.uid; } } }
-
Authentication
- Firebase Auth tokens
- Session management
- Secure logout
Open browser console and run:
// Test validation
ExpenseValidator.validateExpense({
title: 'Test',
amount: 100,
category: 'Food',
date: '2025-11-11'
});
// Test API (if using Firebase)
await ExpenseAPI.getAll(userId);cd Backend
mvn test
mvn clean test jacoco:reportCoverage report: Backend/target/site/jacoco/index.html
firestore/
└── expenses/ (collection)
├── {documentId}
│ ├── userId: "user123"
│ ├── title: "Groceries"
│ ├── amount: 1200
│ ├── category: "Food"
│ ├── date: Timestamp
│ └── createdAt: Timestamp
└── ...
- ✅ Real-time sync - Changes appear instantly
- ✅ Offline support - Works without internet
- ✅ Scalable - Handles millions of records
- ✅ Secure - Built-in security rules
- ✅ Multi-device - Same data everywhere
const API_CONFIG = {
USE_FIREBASE: true, // Switch to false for Spring Boot
BACKEND_URL: 'http://localhost:8080/api/expenses',
PRODUCTION_URL: 'https://your-app.railway.app/api/expenses'
};server.port=8080
logging.level.com.expensetracker=INFOGOOGLE_APPLICATION_CREDENTIALS_JSON={"type":"service_account",...}
PORT=8080
| Problem | Solution |
|---|---|
| Login not working | Check Firebase config in firebase-config.js |
| Charts not showing | Clear cache (Ctrl+F5), check Chart.js CDN |
| Expenses not loading | Check browser console, verify Firebase rules |
| "Modules not loaded" error | Wait a few seconds, refresh page |
| Problem | Solution |
|---|---|
| Backend won't start | Check Java 17+, verify serviceAccountKey.json |
| Port 8080 in use | Change port in application.properties |
| Firebase errors | Verify service account key is valid |
| Build fails | Run mvn clean install -U |
-
Check Console Logs
✅ Firebase initialized successfully ✅ Firestore modules set ✅ API Service initialized -
Verify Firebase Connection
console.log(window.db); // Should show Firestore instance console.log(window.auth); // Should show Auth instance
-
Test Backend (if using)
curl http://localhost:8080/api/expenses
firebase login
firebase init hosting
# Select Frontend folder
firebase deployLive at: https://your-project.web.app
# Push to GitHub
git add .
git commit -m "Deploy to Railway"
git push origin main
# In Railway:
# 1. Connect GitHub repo
# 2. Add GOOGLE_APPLICATION_CREDENTIALS_JSON env var
# 3. DeployLive at: https://your-app.railway.app
See COMPLETE_DEPLOYMENT.md for detailed guides!
- Budget limits & alerts
- Export to CSV/PDF
- Recurring expenses
- Multi-currency support
- Receipt upload with OCR
- Mobile app (React Native)
- Expense categories customization
- Email/SMS notifications
- Shared expenses with family/friends
- Financial insights & AI suggestions
- 📖 Complete Deployment Guide
- 🚂 Railway Deployment
- 🔥 Firebase Backend Setup
- 🏗️ Frontend Architecture
- 🔧 Error Fixes & Solutions
Contributions are welcome! Please:
- 🍴 Fork the repository
- 🌿 Create a feature branch (
git checkout -b feature/amazing) - ✨ Make your changes
- 🧪 Test thoroughly
- 📝 Update documentation
- 🚀 Submit a pull request
This project is open source and available under the MIT License.
Built with ❤️ by a passionate development team demonstrating:
- Clean code architecture
- Modern web development practices
- Cloud-native application design
- Security-first approach
- User-centric design
Check out our Team Page to meet the developers!
- Firebase - Google's app development platform
- Spring Boot - Java's powerful framework
- Chart.js - Beautiful JavaScript charts
- GitHub Copilot - AI pair programmer
- Railway - Modern deployment platform
- Open Source Community - For amazing tools and libraries
- Check the Troubleshooting section
- Review Error Fixes documentation
- Check browser console for errors
- Verify Firebase configuration
- Test with fresh cache (Ctrl+F5)
- 📧 Open an issue on GitHub
- 💬 Check existing documentation
- 🔍 Search for similar issues
- 📖 Read the deployment guides
Current Version: 3.0.0
Status: ✅ Production Ready
Last Updated: November 2025
- ✅ Migrated from PostgreSQL to Firebase Firestore
- ✅ Added Firebase Authentication
- ✅ Created unified API service layer
- ✅ Fixed timezone issues in date validation
- ✅ Improved error handling and logging
- ✅ Updated all documentation
- ✅ Added dual backend support
Happy Expense Tracking! 💰✨
Built with ☕ Java, 🔥 Firebase, and 💻 JavaScript
- Lines of Code: ~2,500+
- Files: 20+
- Features: 15+ major features
- Deployment Platforms: Firebase, Railway
- Security Layers: 4 (Auth, Frontend, Backend, Database)
- Supported Devices: Mobile, Tablet, Desktop
- ✅ Real-time data synchronization
- ✅ Multi-platform deployment
- ✅ Comprehensive validation
- ✅ Modern responsive design
- ✅ Production-ready code
- ✅ Complete documentation
"Track every penny, visualize your spending, achieve your financial goals!" 🎯💰