Inventory app with:
- React/Vite frontend
- Supabase database
- Python-only Telegram bot integration
npm install
npm run devFor local development, stock updates call the backend POST /api/perform-stock.
- If you use
npm run dev, run a backend that serves/api/*onhttp://127.0.0.1:3000, or - set
VITE_API_BASE_URLto the deployed backend origin, or - set
VITE_API_PROXY_TARGETto another local backend origin for Vite proxying.
Frontend env must point to the same Supabase project as the backend service-role credentials:
VITE_SUPABASE_URLVITE_SUPABASE_PUBLISHABLE_KEYVITE_SUPABASE_PROJECT_ID(optional, but if set it must match the URL/project)
Server-side env must point to that same exact project:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
If these values belong to different Supabase projects, the frontend and API will talk to different databases and stock updates will fail.
Telegram integration is implemented only in python/telegram_bot.
cd python/telegram_bot
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8000 --reloadSUPABASE_URLSUPABASE_SERVICE_ROLE_KEYTELEGRAM_BOT_TOKENTELEGRAM_WEBHOOK_SECRETSUPABASE_EVENT_SECRET
Apply:
supabase/migrations/20260217_telegram_bot_setup.sqlsupabase/migrations/20260218_telegram_event_triggers.sql
Set DB settings used by trigger callbacks:
alter database postgres set "app.settings.python_webhook_url" = 'https://<your-python-host>';
alter database postgres set "app.settings.supabase_event_secret" = '<shared-secret>';Set webhook to Python endpoint:
curl -X POST "https://api.telegram.org/bot<TELEGRAM_BOT_TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://<your-python-host>/telegram/webhook\",\"secret_token\":\"<TELEGRAM_WEBHOOK_SECRET>\"}"These no longer exist:
POST /api/telegram-webhookPOST /api/telegram-notify?action=*