{"id":26028676,"url":"https://github.com/tyler-cromwell/forage","last_synced_at":"2026-02-13T06:11:07.599Z","repository":{"id":41864462,"uuid":"405677987","full_name":"tyler-cromwell/Forage","owner":"tyler-cromwell","description":"An Internet-of-Things (IoT) application written in Go using MongoDB to add smart functionality to my kitchen. Goal is to utilize a barcode scanner and scale through my Raspberry Pi to automatically track the groceries I have stored to quickly tell me what recipes I can cook and when items will expire.","archived":false,"fork":false,"pushed_at":"2025-02-27T02:19:55.000Z","size":3497,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T03:25:08.792Z","etag":null,"topics":["go","http-server","internet-of-things","javascript","mongodb","raspberry-pi","trello","twilio"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyler-cromwell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-09-12T15:24:18.000Z","updated_at":"2025-02-27T02:19:58.000Z","dependencies_parsed_at":"2025-02-16T04:27:57.381Z","dependency_job_id":null,"html_url":"https://github.com/tyler-cromwell/Forage","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler-cromwell%2FForage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler-cromwell%2FForage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler-cromwell%2FForage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler-cromwell%2FForage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyler-cromwell","download_url":"https://codeload.github.com/tyler-cromwell/Forage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242250930,"owners_count":20096898,"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":["go","http-server","internet-of-things","javascript","mongodb","raspberry-pi","trello","twilio"],"created_at":"2025-03-06T17:19:20.051Z","updated_at":"2026-02-13T06:11:07.560Z","avatar_url":"https://github.com/tyler-cromwell.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forage\n\n## What is Forage?\nAn Internet-of-Things (IoT) application written in [Go][go] using [MongoDB][mongo] that adds smart functionality to my kitchen. Goal is to utilize a barcode scanner and scale on my Raspberry Pi to automatically track the groceries I have stored to quickly tell me what recipes I can cook and when items will expire.\n\nIts goals are to:\n1. Quickly identify what recipes I can make from the food I have stocked.\n2. Reduce/prevent food waste by alerting (via [Twilio][twilio] SMS) and creating a shopping list (as a [Trello][trello] card) when items are nearing their expiration dates. Food items are defined as [JSON][json] documents in a [MongoDB][mongo] database.\n\n## Features\nPresently, *Forage* can handle the following:\n- Ingredient expiration: know which of the ingredients in your kitchen will expire and how soon.\n- Recipe availability: know which recipes you can cook tonight from what you have available.\n- Shopping list curation: see which ingredients need replacing, without risk of forgetting.\n- SMS alerting: be reminded of when its time to go grocery shopping.\n\n## Depenencies\n- [adlio/trello][packageTrello]: Trello API client\n- [twilio/twilio-go][packageTwilio]: Twilio API client\n- [mongo-driver][packageMongo]: MongoDB driver\n- [sirupsen/logrus][packageLogrus]: Logging\n- [gorilla/mux][packageMux]: HTTP router/multiplexer\n\nSee `go.mod` for details.\n\n## Usage\n### Environment Variables\n- `FORAGE_CONTEXT_TIMEOUT`:\n- `FORAGE_LOOKAHEAD`: the amount of time the Expiration job [checks ahead][checksAhead] for expiring items.\n- `FORAGE_INTERVAL`: the number of time units between executions of the Expiration job (currently in Days).\n- `FORAGE_TIME`: the time of day at which the Expiration job is [scheduled to execute][checkExpirationsScheduled].\n- `FORAGE_TIMEZONE`: the timezone in which this instance is hosted.\n- `LISTEN_SOCKET`: the socket upon which to listen for incoming connections.\n- `LOGRUS_LEVEL`: the log granularity threshold (e.g. `DEBUG`, `INFO`, `WARN`, `ERROR`).\n- `MONGO_URI`: the database connection string.\n- `TRELLO_MEMBER`: \n- `TRELLO_BOARD`: the Trello board upon which to place the shopping list card.\n- `TRELLO_LIST`: the Trello list upon which to place the shopping list card.\n- `TRELLO_LABELS`: the Trello labels to be added to the shopping list card.\n- `TRELLO_API_KEY`:\n- `TRELLO_API_TOKEN`: \n- `TWILIO_ACCOUNT_SID`: \n- `TWILIO_AUTH_TOKEN`: \n- `TWILIO_PHONE_FROM`: the Twilio phone number assigned to this instance of Forage from which to send SMS messages.\n- `TWILIO_PHONE_TO`: the recipent phone number for SMS messages from Twilio.\n\n#### Example\n```\nexport FORAGE_CONTEXT_TIMEOUT=\"5s\"\nexport FORAGE_LOOKAHEAD=\"48h\"\nexport FORAGE_INTERVAL=\"1\"\nexport FORAGE_TIME=\"19:00\"\nexport FORAGE_TIMEZONE=\"America/New_York\"\nexport LISTEN_SOCKET=\":8001\"\nexport LOGRUS_LEVEL=\"DEBUG\"\nexport MONGO_URI=\"mongodb://127.0.0.1:27017\"\n```\n\n### Steps\n\n1. Test: `docker-compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from test`\n  - OR\n2. Deploy: `docker-compose up --build`\n3. Cleanup: `docker-compose down -v --remove-orphans`\n\nEasy as 1,2,3.\n\n## Experience\n\n## Design Goals\n- Comprehensive testing\n- Clear readability\n- Detailed logging\n\n## Repository Hierarchy\n- `api/`: Code that defines the REST API and background job(s).\n  - `api_test.go`: Primary test file, containing unit tests for every case in HTTP handlers and their supporting functions.\n  - `api.go`: Primary API handler and background job functions.\n  - `listen.go`: Code for the listening/serving of HTTP requests.\n  - `mocks.go`: Defines various mock functions and test variables for use in `api_test.go`.\n- `clients/`: Code for interfacing with 3rd-party APIs.\n  - `mongo.go`: MongoDB interface.\n  - `trello.go`: Trello interface.\n  - `twilio.go`: Twilio interface.\n- `config/`: Definition of global configuration (including client interface definitions) as well as an abstract MongoDB interface to enable mocking.\n- `operations/`: Various scripts intended to be run manually.\n  - `populate.js`: Script to populate MongoDB with documents describing each ingredient \u0026 recipe being tracked.\n- `tests/`: Unit tests and mocks.\n- `utils/`: Miscellaneous helper code.\n- `vendor/`: Vendored dependencies.\n\n## Contributing\n1) Write your code, following the current style\n2) Write your tests \u0026 ensure complete coverage\n3) Submit a pull request and I'll review it :)\n\n[go]: https://golang.org/\n[json]: https://www.json.org/json-en.html\n[mongo]: https://www.mongodb.com/\n[trello]: https://trello.com/\n[twilio]: https://www.twilio.com/\n\n[packageLogrus]: https://pkg.go.dev/github.com/sirupsen/logrus\n[packageMongo]: https://pkg.go.dev/go.mongodb.org/mongo-driver\n[packageMux]: https://pkg.go.dev/github.com/gorilla/mux\n[packageTrello]: https://pkg.go.dev/github.com/adlio/trello\n[packageTwilio]: https://pkg.go.dev/github.com/twilio/twilio-go\n\n[checksAhead]: https://github.com/tyler-cromwell/Forage/blob/master/api/mocks.go#L136\n[checkExpirationsScheduled]: https://github.com/tyler-cromwell/Forage/blob/master/api/listen.go#L36\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler-cromwell%2Fforage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyler-cromwell%2Fforage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler-cromwell%2Fforage/lists"}