I created this project for automating some tasks I was doing manually when taking care of my personal finances.
Long story short, this is an ETL for tracking my expenses.
The project consists of two lambda functions : budgetcategorizer and budget2sheets
The transform part is performed by budgetcategorizer and has two main responsibilities : sanitize the expense description and assign a category to the expense.
The load part is performed by budget2sheets which is going to upload the transactions (i.e. expenses) to Google Sheets.
Clone the repo inside the following directory:
~/go/src/github.com/jbleduigou/
If you want to fork the repo, replace the latest path element with your GitHub handle.
You will need to have Go installed on your machine.
Currently the project uses version 1.23
You will find a Makefile at the root of the project.
To run the full build and have zip file ready for AWS Lambda use:
make zip
If you only want to run the unit tests:
make test
This project uses SAM as an Infrastructure As Code tool.
To deploy this project run the following commands:
sam build
sam deploy --guided
- extract logic to dedicated classes and write unit tests
- improve error handling
- create cloud formation template
- fix weird behaviour for GitHub Actions upload artifact : actions/upload-artifact#39 ?
Configuration in this application is based on the concepts exposed by The Twelve Factor App.
The idea is to strictly separate config from code by using environment variables.
Please read the page on 12 Factor Configuration for more details.
The following environment variables should be declared within you lambda:
Name | Description | Sample Value |
---|---|---|
GOOGLE_ACCESS_TOKEN | OAuth 2.0 to Access Google APIs | Swac9MxkndN1elrl3y7Gk6XWizKC97gs48eJ3p7O |
GOOGLE_CLIENT_ID | OAuth 2.0 to Access Google APIs | 769149424942-sUsY928FXCeQB15Dpot0.apps.googleusercontent.com |
GOOGLE_CLIENT_SECRET | OAuth 2.0 to Access Google APIs | Swac9MxkndN1elrl3y7G |
GOOGLE_PROJECT_ID | OAuth 2.0 to Access Google APIs | budget2sheets-633863 |
GOOGLE_REFRESH_TOKEN | OAuth 2.0 to Access Google APIs | XgukkG2720EZOZuiYiHZ |
GOOGLE_SPREADSHEET_ID | ID of spreadsheet to be populated | 6JIJnDjHKcXwF9EhCTPLp0BJiZ03tMPvbVn36sj4 |
GOOGLE_SPREADSHEET_RANGE | Range of cells where data should be appended | Suivi Dépenses Janvier!A2:F2 |
The project structure was inspired by the project Go DDD.
The entry point is located in folder cmd/budgetcategorizer.
What it does is instantiating all the dependencies for the command.
The business logic was separated by concerns and placed in dedicated folders.
Interfaces were introduced to avoid tight coupling and therefore facilitate unit testing (amongst other benefits).
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Jean-Baptiste Le Duigou - Initial work - jbleduigou
See also the list of contributors who participated in this project.
Licensed under the Apache License, Version 2.0.
See LICENSE.txt for more details.
Copyright 2020 Jean-Baptiste Le Duigou