This repository is meant for a Backend application for an expense tracker application.
Link for frontend web application: https://github.com/nahwu/expense-app-react
While there are many expense trackers out there. The good ones are mostly behind a paywall.
Knowledge
or awareness
of your own expenses is very crucial to our personal financial health for both the present and the future.
For example, it only takes 20 average medium-sized spending (e.g. $50) within a month to reach 4 figure expense (>= $1000) for the month. It's not uncommon to know someone who spends beyond their means, especially when one suddenly have more income than before.
The goal of this project is to begin with expense awareness
and then expand onwards to expense budgeting
>> saving & networth projection
>> retirement planning
- Expenses info - Date, item description, expense category, payer, receiver, amount
- Connection to MongoDB
- Feature: API for creating new transaction
- Feature: API for retrieving all transactions
- Feature: API for dynamic transaction search support (optional search filters, sort, sort direction, partial match, case sensitivity)
- Feature: API for aggregation of transactions (for descriptive analytics e.g. charts)
- Summation of amount, by category. Optional date range filter
- Feature: Add support for delete Transaction API
- Feature: Allow data import from CSV file
- CSV import from You Need a Budget (YNAB). User need to delete following columns - Flag, Check Number, Cleared
- Added in Dockerfile for this application
- Added in Docker Compose file to include MongoDB deployment + this backend application
- Added TLS support
- Feature: Add support for edit Transaction API
- Feature: Add support for list, create, edit, delete Expense Category API
- Feature: Add support for income
- Feature: Add support for list, create, edit, delete Expense Payer API
- Feature: Add support for list, create, edit, delete Expense Receiver API
- Feature: Allow data import from CSV file
- Flexible field-name remapping for data import/export
- Allow CSV file upload via multipart request
- Feature: Allow data export to CSV file
- Add in pagination (page + page size) for results
- Feature: Investment tracking
- Feature: Account login
- Feature: Account creation
- Feature: Multi accounts visibility for family sharing
- Feature: Upload and attach image to expense
- Add in DB fields for dateCreated, userCreated
- Sort by date DESC, then date_created DESC. to ensure that the newest date stays at the top
- Properly do Swagger documentation (OpenAPI 3)
- Do different env (1 for dev. 1 for production)
- For personal usage & cloud data storage, consider switching to embedded database or simple "database" where it can be hosted on Google Drive or Dropbox
node app.js
Name & place desired CSV file ./Register.csv
in root folder of application.
Refer to controllers/csvImport.js
for business logic details.
-
Build Docker image
docker build . -t nahwu2/expense-app-backend:0.1
-
Upload Docker image to Docker Registry
docker push nahwu2/expense-app-backend:0.1
-
Export Docker image as a file. Normally used when there is no Internet at the deployment location. If on Windows, use this command with Git Bash.
docker save nahwu2/expense-app-backend:0.1 | gzip > exported_expense_app_backend_0_1.tar.gz
-
Run Docker container via docker run method
docker run --name expense-app-backend -p 8080:8080 -d nahwu2/expense-app-backend:0.1
Open app.js and change from
const https = require("https");
const fs = require("fs");
const sslOptions = {
key: fs.readFileSync(path.join(__dirname, "./mycert/privkey.pem")),
cert: fs.readFileSync(path.join(__dirname, "./mycert/bundle.pem")),
};
const sslServer = https.createServer(sslOptions, app);
mongoConnect(() => {
sslServer.listen(port, () => {
console.log(`Server running at https://${hostname}:${port}/`);
});
});
to
mongoConnect(() => {
app.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
});
-
(Optional) Delete package.json and package-lock.json
-
Swagger UI Express
npm install swagger-ui-express -S
-
MongoDB dependency
npm install --save mongodb
-
csv dependency
npm install --save csv