naira-expense-tracker
About the project
💸 Naira Expense Tracker
A simple, mobile-first expense tracker that shows you where your money goes. Built with plain HTML, CSS and JavaScript in a single file. No backend, no API keys, no installs.
Live demo: <add your link here>
Table of Contents
- Overview
- Features
- Screenshots
- Getting Started
- How to Use
- Project Structure
- How It Works
- Data Format
- Design Decisions
- Browser Support
- Privacy and Data Storage
- Troubleshooting
- Roadmap
- Contributing
- Author
Overview
Most people don’t know where their money goes until it’s gone. This app makes tracking quick: type what you spent, pick a category, and see your totals update instantly. It’s built for everyday Naira spending like food, transport, data and bills.
The whole app lives in one HTML file, so you can open it, host it anywhere, or edit it with no tooling.
Features
Core
- Add expenses with a name, amount (₦), category and date
- Total spent displayed at the top, formatted like ₦12,500
- Category breakdown shown as chips (e.g. Food: ₦5,000)
- Expense list sorted newest first
- Edit or delete any expense
- Clear all with a confirmation popup
Budgeting
- Set a monthly budget in ₦
- Progress bar showing spent vs budget
- Turns orange at 80% and red when the limit is passed, with a warning message
Views
- All time, This month and This week
Data
- Auto-saves to your browser (localStorage)
- Export all expenses to CSV
Design
- Mobile-first layout, max width 480px
- Automatic dark mode
- Large tap-friendly inputs and buttons
- Safe-area support for phones with notches
Screenshots
| Light mode | Dark mode |
|---|---|
<add screenshot> |
<add screenshot> |
Getting Started
Option 1: Open locally
- Download
index.html - Double-click it, or open it in your browser
Option 2: Host it for free
- GitHub Pages: push the file to a repo, then go to Settings > Pages and select the main branch
- Netlify: drag and drop the file onto netlify.com/drop
- Vercel: import the repo and deploy
No build step and no environment variables needed.
How to Use
- Add an expense: type the name (e.g. “Jollof rice”), enter the amount, choose a category and date, then tap Add expense.
- Set a budget: enter your monthly budget. The progress bar updates as you add expenses.
- Switch views: use the tabs to see all time, this month or this week.
- Edit: tap Edit on an expense. It loads into the form, then tap Save changes.
- Delete: tap ✕ on an expense to remove it.
- Export: tap Export CSV to download your data as a spreadsheet file.
- Reset: tap Clear all and confirm to wipe everything.
Project Structure
naira-expense-tracker/
├── index.html # The entire app (HTML + CSS + JS)
└── README.md # This file
Inside index.html:
-
<style>: CSS variables, layout, dark mode -
<body>: form, budget bar, tabs, list -
<script>: state, rendering, storage, CSV export
How It Works
-
State: all expenses live in a JavaScript array called
items. -
Storage: every change is saved to
localStorageas JSON. On page load, the data is read back in. All storage calls are wrapped intry/catchso the app still works if storage is blocked. -
Rendering: a
render()function recalculates totals, category chips, the budget bar and the list from the current state, then updates the page. -
Money formatting: amounts are formatted with
toLocaleString("en-NG"). -
Safety: user text is inserted with
textContentinstead ofinnerHTML, which prevents HTML injection. - CSV export: the app builds a CSV string, wraps it in a Blob, and triggers a download.
Data Format
Expenses are stored under the localStorage key exp like this:
[
{
"name": "Jollof rice",
"amt": 1500,
"cat": "Food",
"date": "2026-10-31"
}
]
CSV export columns: name, category, amount, date
Design Decisions
- Single file: easy to share, host and edit.
- No dependencies: loads instantly and works offline once opened.
- CSS variables: one place to change colors and themes.
- Green accent: fits the Naira theme and keeps the UI calm.
- Local-first: no accounts, no servers, no tracking.
Browser Support
Works on any modern browser:
- Chrome, Edge, Brave, Opera
- Safari (iOS and macOS)
- Firefox
Privacy and Data Storage
- All data stays on your device, in your browser.
- Nothing is sent to any server.
- Clearing browser data, using private mode, or switching devices will remove or hide your expenses.
- Back up regularly with Export CSV.
Troubleshooting
| Problem | Fix |
|---|---|
| Expenses disappear after refresh | Your browser may be blocking localStorage or you’re in private mode. Use a normal window. |
| Amount won’t add | Amount must be greater than zero and the name can’t be empty. |
| Budget bar not showing | Enter a budget amount first. |
| CSV won’t download | Allow downloads for the page in your browser settings. |
| Layout looks cramped on desktop | The app is built mobile-first. Zoom out or open it on your phone. |
Roadmap
- Charts for spending by category
- Custom categories
- Recurring expenses (data, rent, subscriptions)
- Income tracking and balance
- Import from CSV
- Install as a PWA (works like a real app)
- Multiple budgets per category
Contributing
Ideas and improvements are welcome.
- Fork the repo
- Create a branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m "Add your feature" - Push:
git push origin feature/your-feature - Open a pull request
License
MIT License. Free to use, modify and share.
Author
Built by Fawaz.
Built with
AI tools
Prize Categories Entered
- Submitted
Best Use of Gemma 4