Code Monkey home page Code Monkey logo

expense-app-backend's Introduction

Read Me

1. Introduction

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

2. Purpose

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

3. Supported features

  1. Expenses info - Date, item description, expense category, payer, receiver, amount
  2. Connection to MongoDB
  3. Feature: API for creating new transaction
  4. Feature: API for retrieving all transactions
  5. Feature: API for dynamic transaction search support (optional search filters, sort, sort direction, partial match, case sensitivity)
  6. Feature: API for aggregation of transactions (for descriptive analytics e.g. charts)
    1. Summation of amount, by category. Optional date range filter
  7. Feature: Add support for delete Transaction API
  8. Feature: Allow data import from CSV file
    1. CSV import from You Need a Budget (YNAB). User need to delete following columns - Flag, Check Number, Cleared
  9. Added in Dockerfile for this application
  10. Added in Docker Compose file to include MongoDB deployment + this backend application
  11. Added TLS support

4. Development Roadmap

  1. Feature: Add support for edit Transaction API
  2. Feature: Add support for list, create, edit, delete Expense Category API
  3. Feature: Add support for income
  4. Feature: Add support for list, create, edit, delete Expense Payer API
  5. Feature: Add support for list, create, edit, delete Expense Receiver API
  6. Feature: Allow data import from CSV file
    1. Flexible field-name remapping for data import/export
    2. Allow CSV file upload via multipart request
  7. Feature: Allow data export to CSV file
  8. Add in pagination (page + page size) for results
  9. Feature: Investment tracking
  10. Feature: Account login
  11. Feature: Account creation
  12. Feature: Multi accounts visibility for family sharing
  13. Feature: Upload and attach image to expense
  14. Add in DB fields for dateCreated, userCreated
    1. Sort by date DESC, then date_created DESC. to ensure that the newest date stays at the top
  15. Properly do Swagger documentation (OpenAPI 3)
  16. Do different env (1 for dev. 1 for production)
  17. For personal usage & cloud data storage, consider switching to embedded database or simple "database" where it can be hosted on Google Drive or Dropbox

X. OPTIONAL - Developers only

X1. To run NodeJS application

node app.js

X2. CSV file for data import.

Name & place desired CSV file ./Register.csv in root folder of application.

Refer to controllers/csvImport.js for business logic details.

X3. Build, push, export Docker image

  • 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
    

X4. To remove TLS support from backend server

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}/`);
    });
});

X5. Redo dependencies (package.json)

  1. (Optional) Delete package.json and package-lock.json

  2. Swagger UI Express

     npm install swagger-ui-express -S
    
  3. MongoDB dependency

     npm install --save mongodb
    
  4. csv dependency

     npm install --save csv
    

expense-app-backend's People

Contributors

nahwu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.