A lightweight finance management tool that fetches and processes transaction data for last month, leverages OpenAI to categorize transactions, and integrates with Google Sheets to store, update, and retrieve financial data. It aggregates transaction data from various sources (FIO bank and AIR bank).
.env
).Note: Steps 4 and 5 are optional, but at least one must be configured — the app cannot function properly without a data source.
Install Dependencies
Ensure all necessary packages are installed by running:
yarn install
Set Up Environment Variables
Rename .env.template
to .env
in your project root.
Google Sheets Integration
GOOGLE_SHEET_ID_PROD
and optionally GOOGLE_SHEET_ID_DEV
.service-account.json
) must
exist in the root folder of this project.Note: Some data sources must be configured. These can be FIO Bank, AIR Bank, or a custom source (e.g., parsing transaction PDFs from other banks).
FIO Bank (Optional)
FIO_TOKEN
.Note: If you need to modify FIO API calls, refer to the official documentation.
AIR Bank (Optional)
EMAIL_USERNAME
, EMAIL_PASSWORD
, EMAIL_IMAP_SERVER
, EMAIL_IMAP_PORT
, and AIR_ATTACHMENT_PASSWORD
in ./.env.Note: Gmail is not supported due to the lack of basic authentication. You can use email providers such as Seznam.cz.
OpenAI Integration (Optional)
Rename the following files and fill in your category identifiers and descriptions:
./src/static/prompts/expenses.template.txt
-> ./src/static/prompts/expenses.txt
./src/static/prompts/incomes.template.txt
-> ./src/static/prompts/incomes.txt
Register and sign in to the OpenAI developer platform
Go to Settings -> Organization -> Billing.
Add credit (e.g., $5 is sufficient for more than a year of monthly execution, depending on usage).
Create a new project.
Go to API Keys.
Create a new secret key — fill in the name, assign the project, select full permissions, then create.
Copy the key value and add it to ./.env as OPENAI_TOKEN
.
Note: The default model for development is gpt-4o-mini
for its speed and cost-efficiency. In production, o3-mini
is used for its reliable output structure.
The application and integration tests support the following flags:
Flag | Shortcut | Values | Default |
---|---|---|---|
--environment | -e | development, production | development |
--withLabeling | -w | boolean | undefined |
--actions | -a | all, mail, fio | undefined |
--cleanup | -c | all, mail, sheets | undefined |
Integration tests support one additional flag to target specific test case identifiers. It should be used standalone, without other flags.
Flag | Shortcut | Type | Values | Default |
---|---|---|---|---|
--id | -i | array | 1,..,27 | [] |
Note: If flags are omitted and .env
values are not properly configured, the app will throw an error. In the code, these flags are referred to as "app arguments."
Start commands support flags for configuring the application.
To start the application in development mode, run:
yarn start
To start the application in production mode, run:
yarn start:prod
To reset the environment (delete the last month of data and mark emails as unread), run:
yarn cleanup:all
To run integration tests (supports flags described above):
yarn test:integration
Note: Integration tests also accept the --id
flag to run specific test case(s) by ID.
Example:
yarn test:integration --id 12 25 5
To run unit tests (by default in watch mode), run:
yarn test:unit
Note: Unit tests are also triggered on merge to main via Github Action.
To build the application, run:
yarn build
To generate documentation, run:
yarn docs:generate
To start the documentation server, run:
yarn docs:start
To create a new version, run:
yarn release
To use the monthly automation GitHub Action for the entire ETL process after forking the repository, set up additional secrets beyond those listed in .env.template: EMAIL_SMTP_SERVER
, EMAIL_SMTP_PORT
, and EMAIL_USERNAME_CI_NOTIFICATION
. The action can be triggered manually via the GitHub UI with all supported flags.
yarn lefthook install
.commitlint
in the commit-msg
hook.pre-commit
hook.pre-commit
hook.Imports use the "@" alias configured in tsconfig and work project-wide. Vitest may execute files outside the test scope, so in .test.ts
files, prefer relative imports instead of using the index.
All objects (methods, constants, types, classes) must be exported, even if used in a single module — otherwise, Typedoc won't include them. Two commands exist for documentation: one generates the docs, the other starts the server. Documentation is also hosted via GitHub Pages here, served directly from the main branch.
Versioning is handled via a single yarn script yarn version
. It bumps the version in package.json and creates a version entry in CHANGELOG.md.
Ideas what could be added is written in 2DO.md file.