A command-line application to track and manage expenses. Built with Node.js using Commander.js for CLI functionality and Chalk for styling the output. Project idea from roadmap.sh
- Add new expenses with a description and amount.
- Update existing expenses by their unique ID.
- Delete expenses by their unique ID.
- List all recorded expenses in a tabular format.
- Summarize expenses for:
- All time: Get the total of all expenses.
- Specific month/year: Filter expenses by a certain year or month.
- Node.js (v14 or later)
-
Clone the repository:
git clone https://github.com/kxng0109/expense-tracker-cli-app.git cd expense-tracker-cli-app
-
Install dependencies:
npm install
Add a new expense by providing a description and amount:
node app.js add -d "Coffee" -a 500
Update an existing expense by its ID. Optionally, specify the new description and/or amount:
node app.js update -i 1 -d "Latte" -a 600
Remove an expense by its ID:
node app.js delete -i 1
View all recorded expenses in a tabular format:
node app.js list
Get a summary of expenses:
- All time:
node app.js summary
- Specific month:
node app.js summary -m 8
- Specific year:
node app.js summary -y 2024
expense-tracker/
├── src/
│ ├── commands/ # CLI command definitions
│ ├── services/ # Core application logic
│ └── utils/ # Helper utilities
├── exp.json # Expense storage file
├── app.js # Entry point for the CLI
├── package.json # Dependencies and scripts
├── README.md # Project documentation
- Commander.js - For handling CLI commands.
- Chalk - For styling terminal output.
- The
exp.json
file is used to store expense data in JSON format. Future versions may integrate a database for scalability. - Error handling and input validation have been implemented to ensure robust operation.
- Modular design allows easy maintenance and extension of the application.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.