Features
- Financial Dashboard: Get a quick overview of your total spending, expense count, and top spending category.
- Expense Management: Add, view, edit, and delete expense records.
- Live Search & Filters: Find expenses by title, category, or date.
- Category Breakdown: Explore spending distribution with a doughnut chart.
- Monthly Spending: Visualize monthly expenses using a bar chart.
- Monthly Budget: Set a budget and track it against your spending.
- CSV Export: Export expense records for spreadsheets and further analysis.
- Dark Mode: Switch themes for a more comfortable experience.
- Toast Notifications: Get feedback when actions succeed or fail.
- Local Database: Store expense records in SQLite on your machine.
Tech Stack
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Backend: Node.js, Express.js
- Database: SQLite with better-sqlite3
- Charts: Chart.js
- Version Control: Git and GitHub
No frontend framework required. Just the fundamentals, put to work.
Get Started
Prerequisites
Install the following before running the application:
1. Clone the repository
git clone https://github.com/rohans-cs24/Expense-Tracker.git
cd Expense-Tracker
2. Install dependencies
npm install
3. Start the server
node server.js
4. Open the application
Visit:
http://localhost:3000
🎉 That's it! Your local expense tracker is ready.
Note: Run the application through the Express server rather than opening index.html directly. This allows the frontend to communicate with the backend API.
How It Works
┌─────────────────────────────┐
│ Browser UI │
│ HTML · CSS · JavaScript │
└──────────────┬──────────────┘
│ HTTP requests
▼
┌─────────────────────────────┐
│ Express API │
│ CRUD · Validation · Routes │
└──────────────┬──────────────┘
│ SQL queries
▼
┌─────────────────────────────┐
│ SQLite │
│ Local expense data │
└─────────────────────────────┘
API Endpoints
GET/api/healthCheck server healthGET/api/expensesRetrieve expensesPOST/api/expensesCreate an expensePUT/api/expenses/:idUpdate an expenseDELETE/api/expenses/:idDelete an expense
Project Structure
Expense-Tracker/
├── public/
│ ├── index.html # Application interface
│ ├── style.css # Styling and themes
│ └── script.js # Frontend logic and charts
├── database.js # SQLite connection and schema
├── server.js # Express server and API routes
├── seed.js # Optional sample-data seeder
├── package.json # Project metadata and dependencies
├── package-lock.json # Locked dependency versions
├── .gitignore
└── README.md
Your exact file structure may differ slightly depending on your latest changes.
Data & Privacy
- Expenses are stored in a local SQLite database.
- Each person running the application locally can have their own database.
- The database file is created automatically when the application initializes.
- Sample data can be added with the seed script, if configured.
Important: Do not commit your real expense database or personal financial data to GitHub. Keep expenses.db in your .gitignore.
The monthly budget and theme preferences are stored in browser localStorage, so they are specific to that browser.
Security Notes
- Never commit secrets, credentials, or personal financial records.
- Validate user input on the server.
- Keep dependencies updated.
- Use a proper persistent database before hosting the application for real users.
License
Apache License 2.0
Rohan S Mirjankar