What you get
- Postgres DB (source of truth)
- Notion sync (publish + ingest
On hand,Par,Preferred store) - Build weekly shopping list from gaps
- Export CSV
- Playwright demo to add items to a Walmart cart (headless browser)
Note: Retailer automation is fragile and may violate ToS. Use for personal learning.
Quick start
- Copy env
cp .env.example .env
# Fill NOTION_TOKEN and NOTION_PARENT_PAGE_ID
- Up services
docker compose up --build -d
- Seed some items
docker compose exec db psql -U ${POSTGRES_USER:-lifeos} -d ${POSTGRES_DB:-lifeos} -c "insert into items (name, unit, par_qty, on_hand, preferred_store) values ('Coffee Beans','bag',2,0,'Costco'),('Eggs','dozen',2,1,'Walmart'),('Olive Oil','bottle',1,0,'Amazon') on conflict do nothing;"
- Create Notion DB
docker compose exec orchestrator python -m app.cli create_notion_db
# paste NOTION_DB_ID into .env, then:
docker compose restart orchestrator
- Push to Notion
docker compose exec orchestrator python -m app.cli sync_push
- Edit in Notion, then Pull
docker compose exec orchestrator python -m app.cli sync_pull
- Build/Export list
docker compose exec orchestrator python -m app.cli build_list --name "Weekly Staples"
# copy LIST_ID, then:
docker compose exec orchestrator python -m app.cli export_list <LIST_ID> /app/list.csv
docker cp $(docker compose ps -q orchestrator):/app/list.csv ./list.csv
- (Optional) Walmart demo
# First run non-headless to log in manually (will save session to walmart-state.json)
docker compose exec -it orchestrator bash -lc "python -c "import asyncio;from app.carts.walmart import add_to_cart;asyncio.run(add_to_cart([{'name':'Milk 1 gallon','qty':1}]))""
# Then from CSV:
docker compose exec orchestrator python -m app.cli walmart_cart /app/list.csv
API also available at http://localhost:8000/health etc.
Notion Shopping List (new)
Create a separate Notion DB for the Shopping List lines:
docker compose exec orchestrator python -m app.cli create_notion_shopping_db
# paste NOTION_SHOPPING_DB_ID into .env and restart
docker compose restart orchestrator
Now you can add rows directly in Notion (Item / Qty / Unit / Store).
When you pull, they will be upserted into your DB (and any new Items will be created automatically):
docker compose exec orchestrator python -m app.cli sync_pull_shopping --list-name "Weekly Staples"