Skip to main content

Tech Stack

Backend

PackageVersionPurpose
Python≥ 3.12Language
FastAPI≥ 0.121Web framework
SQLAlchemy≥ 2.0ORM
Alembic≥ 1.17Database migrations
psycopg2-binary≥ 2.9PostgreSQL driver
OpenAI SDK≥ 2.7AI order parsing
reportlab≥ 4.0PDF generation
pdf2image≥ 1.17PDF to image conversion
PoetryDependency management

Frontend

PackageVersionPurpose
React19.2.0UI framework
TypeScript5.9.3Type safety
Vite7.2.2Build tool
Tailwind CSS4.1.17Styling
React Router DOM7.9.5Client-side routing
Zustand5.0.8State management
Axios1.13.2HTTP client
Lucide React0.553.0Icons

Environment Setup

Backend — backend/.env

# PostgreSQL
DATABASE_URL=postgresql://postgres:PASSWORD@localhost:5432/sahyogi

# OpenAI (for WhatsApp order parsing)
OPENAI_API_KEY=sk-proj-...

# Gupshup WhatsApp
GUPSHUP_HEENA_ORDER_PLACEMENT_SUB_TAG=sahyogi_jewellers_order_hook
GUPSHUP_PARTNER_EMAIL=your-email@example.com
GUPSHUP_PARTNER_PASSWORD=your-password
GUPSHUP_APP_ID=your-gupshup-app-id

# URLs
PUBLIC_API_URL=http://localhost:8000
FRONTEND_URL=http://localhost:3000

# Allowed WhatsApp numbers (comma-separated, with country code)
ALLOWED_PHONE_NUMBERS=917595903437,918902673788

Frontend — .env

VITE_API_BASE_URL=http://localhost:8000
If not set, the Axios instance defaults to http://localhost:8000.

Running the App

Backend

cd backend

# Install dependencies
poetry install

# Create the database
psql -U postgres -c "CREATE DATABASE sahyogi;"

# Apply migrations
alembic upgrade head

# Start dev server
poetry run uvicorn sj.app:app --reload --host 0.0.0.0 --port 8000
API available at http://localhost:8000 Swagger UI at http://localhost:8000/docs

Frontend

cd frontend

npm install
npm run dev
Frontend available at http://localhost:5173

Running Tests

cd backend

# Run all tests
poetry run pytest

# Run a specific file
poetry run pytest tests/test_karigar_routes.py

# Verbose output
poetry run pytest -v
Test files:
  • test_bank_routes.py
  • test_bullion_routes.py
  • test_client_routes.py
  • test_karigar_routes.py
  • test_polisher_routes.py
  • test_client_order_routes.py
  • test_calculations.py
  • test_services.py