{"id":25115797,"url":"https://github.com/allancalix/clerk-alert-example","last_synced_at":"2025-04-02T11:41:37.492Z","repository":{"id":130356347,"uuid":"529717307","full_name":"allancalix/clerk-alert-example","owner":"allancalix","description":"An example repository combining a few tools to perform ad-hoc automatic personal finance monitoring.","archived":false,"fork":false,"pushed_at":"2022-08-28T00:54:53.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-08T02:35:34.335Z","etag":null,"topics":["budget","finance","personal-finance","plaid","plaintext-accounting"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allancalix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-27T23:18:13.000Z","updated_at":"2022-08-28T01:08:42.000Z","dependencies_parsed_at":"2023-04-28T23:47:39.751Z","dependency_job_id":null,"html_url":"https://github.com/allancalix/clerk-alert-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancalix%2Fclerk-alert-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancalix%2Fclerk-alert-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancalix%2Fclerk-alert-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allancalix%2Fclerk-alert-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allancalix","download_url":"https://codeload.github.com/allancalix/clerk-alert-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246811205,"owners_count":20837745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["budget","finance","personal-finance","plaid","plaintext-accounting"],"created_at":"2025-02-08T02:34:18.124Z","updated_at":"2025-04-02T11:41:36.976Z","avatar_url":"https://github.com/allancalix.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clerk-alert-example\nA template repository for demonstrating how you could use clerk, litestream,\nand Plaid for building an ad-hoc personal transaction monitoring system. In this\nexample, we print a message when we encounter a paycheck transaction.\n\nLitestream is used here to replicate transaction data to S3 so data could be\naccessed seamlessly across a variety of machines. This means you could perform\ntransaction syncs manually and have \"read-replica\" like cron jobs that check data\nperiodically.\n\n## Requirements\n- [clerk](https://github.com/allancalix/clerk) cli\n- [litestream](https://litestream.io/install/) cli\n- [tera-cli](https://github.com/chevdor/tera-cli) - jinja2-like templating\n- [shadowenv](https://github.com/Shopify/shadowenv) - automatic directory-based environment variables for secrets\n- sqlite3 - probably already installed\n- Plaid API key - require development level access for real transaction data\n- S3 credentials - used to synchronize transaction data between machines\n\nYou can update the [env.sh](./env.sh) file with your secret credentials, this is\nused to automatically configure litestream and clerk. After the `.shadowenv`\ndirectory is created (on first link) these secrets are no longer required in this script.\n## Use\n```bash\n# Bootstrap your first Plaid link\nsource env.sh\n# Repeat for as many accounts as you'd like to link.\nmake link\n```\n\nSome useful commands to get you started. Check paycheck is a bit naive, in a real\nimplementation you'd probably want to keep a watermark saved in the repository that\nsays you've already checked transactions up to the watermark to avoid duplicate\nalerts. You could use the date of transactions but the transaction `id` column is\nULID and can be used as a cursor as well.\n```bash\n# Sync transactions starting from the given date.\n./scripts/sync.sh --begin 2022-08-14\n\n./scripts/check-paycheck.sh\n```\n\n### Paycheck alert\nA quick breakdown of the query used to select the paycheck transaction from the\ndatastore.\n\n```sql\nselect\n  -- Clerk stores the raw data returned from Plaid's API as json in the database.\n  -- We can use this to access the raw payloads while clerk handles syncing and\n  -- link management.\n  json_extract(source, '$.amount') as amount,\n  json_extract(source, '$.name') as name\nFROM transactions\n-- You'll likely want to set a floor amount and set name equal to those that appear\n-- in your transactions.\nWHERE amount \u003e 5.00 AND name LIKE 'Uber%';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallancalix%2Fclerk-alert-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallancalix%2Fclerk-alert-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallancalix%2Fclerk-alert-example/lists"}