Skip to content

MobinMithun/pack-n-trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pack-n-Trace

Inventory app with:

  • React/Vite frontend
  • Supabase database
  • Python-only Telegram bot integration

Frontend

npm install
npm run dev

For local development, stock updates call the backend POST /api/perform-stock.

  • If you use npm run dev, run a backend that serves /api/* on http://127.0.0.1:3000, or
  • set VITE_API_BASE_URL to the deployed backend origin, or
  • set VITE_API_PROXY_TARGET to another local backend origin for Vite proxying.

Frontend env must point to the same Supabase project as the backend service-role credentials:

  • VITE_SUPABASE_URL
  • VITE_SUPABASE_PUBLISHABLE_KEY
  • VITE_SUPABASE_PROJECT_ID (optional, but if set it must match the URL/project)

Server-side env must point to that same exact project:

  • SUPABASE_URL
  • SUPABASE_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.

Python Telegram Bot

Telegram integration is implemented only in python/telegram_bot.

Run locally

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 --reload

Environment variables (Python service)

  • SUPABASE_URL
  • SUPABASE_SERVICE_ROLE_KEY
  • TELEGRAM_BOT_TOKEN
  • TELEGRAM_WEBHOOK_SECRET
  • SUPABASE_EVENT_SECRET

Supabase trigger callback migration

Apply:

  • supabase/migrations/20260217_telegram_bot_setup.sql
  • supabase/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>';

Telegram webhook

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>\"}"

Removed TypeScript Telegram Endpoints

These no longer exist:

  • POST /api/telegram-webhook
  • POST /api/telegram-notify?action=*

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors