GithubHelp home page GithubHelp logo

hursey013 / real-balance Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 53 KB

Discretionary funds less credit card spending via Plaid API + Firebase Functions

JavaScript 100.00%
firebase-functions firebase-realtime-database firebase plaid-api

real-balance's Introduction

real-balance

Discretionary funds less credit card spending via Plaid API + Firebase Functions

Introduction

Endpoint to provide your current "real" balance using the Plaid API. The function totals up your depository (checking) accounts as well as credit accounts and returns the difference.

Further reading:

Functions code

See file functions/index.js for the code.

The dependencies are listed in functions/package.json.

Initial setup

Clone this repo

  • Clone or download this repo and open the real-balance directory.

Create a Firebase project

  • Create a Firebase Project using the Firebase Developer Console
  • Enable billing on your project by switching to the Blaze or Flame plan. See pricing for more details. This is required to allow requests to non-Google services within the Function.
  • Install Firebase CLI Tools if you have not already, and log in with firebase login.
  • Configure this sample to use your project using firebase use --add and select your project.

Install dependencies and add environment variables

  • Install dependencies locally by running: cd functions; npm i; cd -
  • Add your Plaid API credentials and basic auth password to the Firebase config:
    firebase functions:config:set \
    plaid.clientid=<YOUR PLAID CLIENT ID> \
    plaid.secret=<YOUR PLAID SECRET> \
    user.password=<YOUR BASIC AUTH PASSWORD>
  • You will also need to add an array of Plaid access_token's for each Plaid Item you would like included in your "real" balance. You may also (optionally) add an array of specific accounts to be used with each access_token, otherwise all accounts will included.
    firebase functions:config:set \
    plaid.items.0.token=<FIRST PLAID ACCESS TOKEN> \
    plaid.items.1.token=<ANOTHER PLAID ACCESS TOKEN> \
    plaid.items.1.account_ids.0=<A SPECIFIC ACCOUNT ID> \
    plaid.items.1.account_ids.1=<ANOTHER SPECIFIC ACCOUNT ID>

Deploy the app to production

  • Deploy your function using firebase deploy --only functions
  • After deploying the function you can use the your basic auth credentials to access the endpoint at:
https://us-central1-<project-id>.cloudfunctions.net/balance

real-balance's People

Contributors

hursey013 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  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.