Skip to content

Instantly share code, notes, and snippets.

@brccabral
Last active April 16, 2024 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brccabral/01f76916e48c62a8d9c668c411dfbdc0 to your computer and use it in GitHub Desktop.
Save brccabral/01f76916e48c62a8d9c668c411dfbdc0 to your computer and use it in GitHub Desktop.
Firefly III

Firefly III with Plaid Connector

A free and open source personal finance manager https://firefly-iii.org/

Documentation https://docs.firefly-iii.org/

Need to setup .env, .db.env and .importer.env before running docker compose.

The Importer is a separated web app (created by Firefly III) to support import of external files (CSV and other formats).
More details https://docs.firefly-iii.org/how-to/data-importer/installation/docker/

The firefly-plaid-connector-2 is an external app that can connect to Plaid in order to sync data between your financial institution and Firefly III
https://github.com/dvankley/firefly-plaid-connector-2

Need to create an account with Plaid and request for a Development token (it takes one or two days for approval).
Then, use Plaid Quickstart https://plaid.com/docs/quickstart/ app to request the tokens from your financial institution.

Get the docker-compose.yml from https://github.com/plaid/quickstart.git and .env.example. Edit .env.example with your clientId and secret, change env to development.
Also, follow instructions to setup a Redirect.
Start one backend and the frontend.

docker compose up -d node frontend

Try to connect to your financial institution, if success, you will get an item_id (not used) and an access token.
The financial institution may have many accounts (checking, savings, loan, etc).
With your access token, find the accountId for each account type with the curl command described at https://plaid.com/docs/api/accounts/#accountsget

Once you have the all tokens (clientId, secret, development access token and accountId), setup the aplication.yml from firefly-plaid-connector-2.
Create the Volume firefly_plaid_connector_2 in advance.

docker volume create firefly_plaid_connector_2

Change permissions to a+w. This is needed by the container to create some files in the volume.
Don't worry, after the container is created the permissions are revoked.

sudo chmod a+w /var/lib/docker/volumes/firefly_plaid_connector_2/_data

Double check .env, .db.env, .importer.env, application.yml and up the services.

docker compose up -d

Known issues:

Apparently Plaid has some sync problem with some finantial institutions, therefore the endpoint /transactions/sync are not enough to retrieve recently transactions, and a manual refresh is needed /transactions/refresh.
dvankley/firefly-plaid-connector-2#69

curl -X POST https://development.plaid.com/transactions/refresh \
-H 'Content-Type: application/json' \
-d '{ "client_id": "abc", "secret": "xyz", "access_token": "access-development-abc123" }'
version: "3.3"
#
# The Firefly III Data Importer will ask you for the Firefly III URL and a "Client ID".
# You can generate the Client ID at http://your.server.domain:50080/profile (after registering)
# The Firefly III URL is: http://your.server.domain:50080
#
# Other URL's will give 500 | Server Error
#
services:
fireflyiii:
image: fireflyiii/core:latest
hostname: fireflyiii
container_name: firefly_iii_core
networks:
- firefly_iii
restart: unless-stopped
volumes:
- firefly_iii_core:/var/www/html/storage/upload
env_file: .env
ports:
- "50080:8080"
depends_on:
- db
db:
image: mariadb:lts
hostname: fireflyiii_db
container_name: firefly_iii_db
networks:
- firefly_iii
restart: unless-stopped
env_file: .db.env
volumes:
- firefly_iii_db:/var/lib/mysql
ports:
- 33060:3306
importer:
image: fireflyiii/data-importer:latest
hostname: firefly_iii_importer
restart: unless-stopped
container_name: firefly_iii_importer
networks:
- firefly_iii
ports:
- '50081:8080'
depends_on:
- fireflyiii
env_file: .importer.env
volumes:
- firefly_iii_upload:/var/www/html/storage/upload
cron:
#
# To make this work, set STATIC_CRON_TOKEN in your .env file or as an environment variable and replace REPLACEME below
# The STATIC_CRON_TOKEN must be *exactly* 32 characters long
#
image: alpine
container_name: firefly_iii_cron
restart: unless-stopped
command: sh -c "echo \"0 3 * * * wget -qO- http://your.server.domain:50080/api/v1/cron/REPLACEME\" | crontab - && crond -f -L /dev/stdout"
networks:
- firefly_iii
firefly_plaid_connector_2:
image: ghcr.io/dvankley/firefly-plaid-connector-2:latest
container_name: firefly_plaid_connector_2
restart: unless-stopped
volumes:
- type: bind
source: "/path/to/firefly_plaid_connector_2/application.yml"
target: /opt/fpc-config/application.yml
read_only: true
- firefly_plaid_connector_2:/opt/fpc-cursors
environment:
- SPRING_CONFIG_LOCATION=/opt/fpc-config/application.yml
- FIREFLYPLAIDCONNECTOR2_POLLED_CURSORFILEDIRECTORYPATH=/opt/fpc-cursors
depends_on:
- fireflyiii
networks:
- firefly_iii
volumes:
firefly_iii_core:
name: firefly_iii_core
firefly_iii_upload:
name: firefly_iii_upload
firefly_iii_db:
name: firefly_iii_db
firefly_plaid_connector_2:
name: firefly_plaid_connector_2
networks:
firefly_iii:
name: firefly_iii
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment