A Go based expense manager and visulisation with a variety of input sources
Phase 1:
- Use the Up Bank API to fetch existing transactions and store them in a SQLite database
- Create webhooks so that it also fetches real-time transactions
- Create a simple web UI to manually interact with the system using templ
- Have some basic static charts using go-echarts to summarise spending
Phase 2:
- Implement some level of authentication
- Implement this in a runnable docker container
Phase 3:
- Interactable UI
- Have a UI in which you can interact with the transactions - give them additional metadata such as tags, photos (receipts/invoices)
- Mutate the graphs - apply filters to change what the graphs output
- expense-manager
- data-fetcher
- data-storer
- data-manager
- visualisation
Fetching spending data from UpBank using their open api spec
Storing the data in a local sqlite database
interface for updating the transactions/metadata
endpoitns to drive the UI
- Install the OpenAPI generator
sudo npm install openapi-generator
- Install Templ and air
- Install Tailwind CSS Install using npm as we're already using NPM for the API client generation. Tailwind Installation
- Fetch the open-api definition JSON file
curl https://raw.githubusercontent.com/up-banking/api/master/v1/openapi.json
- Make sure that you've set your up bank token in the environment variables in your
.bashrc
or.zshrc
file - typically located at~/.<editor>rc
Get your token from Up Bank
export UP_BANK_TOKEN='<your token here>'
Most of the comands have been simplified down to a really simple make file
Doing active development, run:
make watch
as this will create a hot-reloading environment which will automatically update CSS, Templ generated HTML and Go logic while editing.
If you need to regenerate the upbank API client run:
make upclient-generate
If you want to generate a hard executable file then run:
make build
- Generate the REST client code
openapi-generator-cli generate -i openapi.json -g go -o ./datafetcher/upclient --additional-properties packageName=upclient --git-user-id esteanes --git-repo-id expense-manager/datafetcher/upclient
Its recommended to have a file called .openapi-generator-ignore
inside the /upclient with the following contents:
# OpenAPI Generator Ignore
go.mod
go.sum
LICENSE
This will stop the generator from generating those files (which will mess up the Go compilation)
-
Generate the TEMPL components
templ generate
- Note if you're finding it hard to run
templ
, it might be because$GOPATH
is not on your$PATH
so your computer can't find the executable. In that case either update your path or run./$GOPATH/templ
- Note if you're finding it hard to run
-
Format code
gofmt -s -w .
-
Fix up any import changes
go mod tidy
-
Build an executable
go build -o expense-manager
- Run the executable
./expense-manager
Add to your .bashrc
file.
alias expenseManagerBuild="templ generate && gofmt -s -w . && go mod tidy && go build -o expense-manager"
alias expenseManagerBuildRun="templ generate && gofmt -s -w . && go mod tidy && go build -o expense-manager && ./expense-manager"