Skip to content

cyberkunju/hastkala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

145 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HastKala β€” from a voice note to a livelihood

Live WhatsApp Languages License

Try it now β€” send hi on WhatsApp to +91 90379 78905.


Why this exists

Hundreds of initiatives are trying to bring women artisans online. Almost all of them ask her to learn something first β€” an app, a dashboard, a checkout flow, English. The ones that don't, leave her offline and invisible.

HastKala asks her to learn nothing. The whole journey β€” discovery, training, certification, listing, orders, payments, support β€” happens inside one app she already trusts: WhatsApp.

We are not asking women artisans to become digital sellers.
We are making digital selling adapt to them.


How it works

Three women, three different starting points. One platform that meets each of them where they are.

                                                                
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        
                β”‚         The Hesitant Artisan         β”‚        
                β”‚                                      β”‚        
                β”‚   joins via her community,           β”‚        
                β”‚   takes a 7-day workshop,            β”‚        
                β”‚   becomes a certified seller.        β”‚        
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        
                                   β”‚                            
                                   β–Ό                            
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        
                β”‚        The Confident Artisan         β”‚        
                β”‚                                      β”‚        
                β”‚   sends a photo + voice note,        β”‚        
                β”‚   bot drafts the listing,            β”‚        
                β”‚   product goes live, orders flow.    β”‚        
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        
                                   β”‚                            
                                   β–Ό                            
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        
                β”‚       The Entrepreneur Artisan       β”‚        
                β”‚                                      β”‚        
                β”‚   web dashboard for inventory,       β”‚        
                β”‚   network, bulk requests, payments   β”‚        
                β”‚   β€” full control, on her terms.      β”‚        
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        

She never has to leave WhatsApp until she chooses to.


What's inside

For the artisan (WhatsApp bot β€” apps/wa-bot)

  • 5 languages: English, Hindi, Kannada, Tamil, Malayalam
  • Voice-first input β€” she speaks; the bot listens, transcribes, confirms
  • 7-day learning track inside WhatsApp β†’ certificate as a real PDF
  • Listing flow: photo + voice note β†’ AI-cleaned catalog entry, pre-filled and editable
  • Orders, customer details, payment links β€” all delivered as WhatsApp messages
  • Persistent session β€” once paired, the bot survives restarts and deploys without re-pairing
  • Allowlist for safety; demo mode for testing without leaking real numbers

For the buyer (src/)

  • Public marketplace at cyberkunju.com β€” TanStack Start SSR
  • Browse by craft, district, or category; product story on every listing
  • WhatsApp-style purchase flow β€” name, address, phone, all in natural language
  • Order tracking, certificate viewing, community network browsing
  • Buyer-side OTP authentication via WhatsApp (no passwords)

For the operations side (apps/api + vendor_ui/)

  • Express + Prisma against Supabase Postgres
  • Karigar Sakhi admin console β€” pending products, members, orders, certifications
  • Activity feed β€” every approval, certificate, order, broadcast
  • Razorpay payment links generated per order
  • Cloudinary image hosting; OpenAI for AI extraction; Sarvam-ready for native Indic voice

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    cyberkunju.com (Cloudflare)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚  HTTPS
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚  EC2 / Fedora 43    β”‚
                β”‚  nginx :443         β”‚
                β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
                   β”‚      β”‚      β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”  β”Œβ”€β”€β–Όβ”€β”€β”  β”Œβ–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ web :3000 β”‚  β”‚ api β”‚  β”‚ wabot     β”‚
        β”‚ TanStack  β”‚  β”‚5000 β”‚  β”‚ :5001     β”‚
        β”‚ Start SSR β”‚  β”‚     β”‚  β”‚ Chromium  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”¬β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                          β”‚           β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”   β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                  β”‚ Supabase  β”‚   β”‚ WhatsApp β”‚
                  β”‚ Postgres  β”‚   β”‚ Web      β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

CI/CD: every push to main deploys via GitHub Actions, with smoke tests against both the origin and the public Cloudflare URL.


Getting started

Prerequisites

  • Node 22+
  • A Supabase Postgres DATABASE_URL
  • An OpenAI API key
  • A WhatsApp number for the bot (any Android phone or WhatsApp Web)

Quick start (local dev)

# Clone
git clone https://github.com/cyberkunju/hastkala.git
cd hastkala

# Install root deps (frontend + shared)
npm install

# API
cd apps/api && npm install && npx prisma generate
cp .env.example .env  # fill in DATABASE_URL, OPENAI_API_KEY, etc.
npm run dev           # starts on :5000

# WhatsApp bot
cd ../wa-bot && npm install
cp .env.example .env  # fill in OPENAI_API_KEY, ALLOWED_TEST_NUMBERS
npm run dev           # starts on :5001 β€” scan the QR

# Frontend
cd ../.. && npm run dev   # starts on :3000

Or run everything together:

npm run dev:all

Deploy

This repo deploys itself. Push to main, and the Deploy to EC2 workflow:

  1. SSHes to the configured EC2 instance
  2. Pulls the commit
  3. Builds API, bot, and frontend
  4. Smart-restarts only the services whose dist/ actually changed (preserves WhatsApp session)
  5. Smoke-tests every public endpoint

Provisioning a fresh box is a one-shot script β€” see scripts/AWS-DEPLOY.md.


Project layout

hastkala/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api/                Express + Prisma backend
β”‚   β”‚   β”œβ”€β”€ prisma/         Schema (14 models: Artisan, Product, Order, …)
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ controllers/    Request handlers
β”‚   β”‚       β”œβ”€β”€ routes/         Express routers (/api/products, /api/orders, …)
β”‚   β”‚       β”œβ”€β”€ services/       AI, storage, WhatsApp integration
β”‚   β”‚       └── middleware/     Auth, error handling
β”‚   β”‚
β”‚   └── wa-bot/             WhatsApp bot (whatsapp-web.js)
β”‚       └── src/
β”‚           β”œβ”€β”€ conversations/  ~70-state engine + per-flow handlers
β”‚           β”œβ”€β”€ services/       Transcription, TTS, NLU, translation, Q&A
β”‚           β”œβ”€β”€ server/         Internal HTTP server (:5001)
β”‚           └── openwa/         WhatsApp Web client + supervisor
β”‚
β”œβ”€β”€ src/                    Buyer marketplace (TanStack Start)
β”‚   β”œβ”€β”€ routes/             File-based routing
β”‚   β”œβ”€β”€ components/         Layout, product, common
β”‚   └── lib/                API client, i18n, Razorpay, types
β”‚
β”œβ”€β”€ vendor_ui/              Karigar Sakhi admin console (static HTML+JS)
β”œβ”€β”€ scripts/                Deploy, bootstrap, runbooks
β”œβ”€β”€ .github/workflows/      CI/CD
└── Logo/                   Brand assets

The conversation engine

The bot is the heart of HastKala. It's a deterministic finite-state machine over ~70 conversation states, with NLU + voice transcription as the input layer:

Voice/text in any language
         β”‚
         β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Transcribe  │───▢│  Universal cmds  β”‚  RESET, MENU, BACK,
  β”‚  (gpt-4o)    β”‚    β”‚                  β”‚  HELP, LANGUAGE,
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  HUMAN, EXIT
                               β”‚
                               β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ NLU classifier β”‚  Maps free text β†’
                      β”‚ (gpt-4o-mini)  β”‚  menu choice / nav
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ State dispatch β”‚  ~70 states across
                      β”‚                β”‚  identity, seller,
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  buyer, sakhi flows
                               β”‚
                               β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ Translate +    β”‚  ta/ml: gpt-4o-audio
                      β”‚ TTS            β”‚  en/hi/kn: gpt-4o-mini-tts
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  (Sarvam Bulbul if key set)

Voice-confirmation gates protect critical inputs (price, address, phone) β€” the bot reads back what it heard before committing.


Languages

Language Bot text Voice in Voice out (TTS)
English Native pack βœ… Native
Hindi Native pack βœ… Indic-tuned
Kannada Native pack βœ… Indic-tuned
Tamil Runtime trans βœ… Unified audio
Malayalam Runtime trans βœ… Unified audio

Set SARVAM_API_KEY in apps/wa-bot/.env to switch the Indic stack to Sarvam Bulbul + Saaras for native-grade transcription and prosody.


What's been built

Module Where Status
WhatsApp bot apps/wa-bot βœ… Live
Voice transcription + TTS services/transcribeService.ts, ttsService.ts βœ… Live
5-language UI conversations/messages/{en,hi,kn}.ts + runtime βœ… Live
Product catalog API apps/api/src/routes/product.routes.ts βœ… Live
Order management apps/api/src/routes/order.routes.ts βœ… Live
Buyer marketplace src/routes/ βœ… Live
Karigar Sakhi admin (/admin) src/routes/admin.tsx βœ… Live
Community + certification apps/api/src/routes/community.routes.ts βœ… Live
7-day learning modules apps/api/src/routes/community.routes.ts βœ… Live
Seller product CRUD (web) src/routes/seller.tsx βœ… Live
Direct order β†’ seller WhatsApp apps/api/src/controllers/order.controller.ts βœ… Live
Artisan talent-request alerts apps/api/src/routes/network.routes.ts βœ… Live
Cloudinary image hosting apps/api/src/services/storage.service.ts βœ… Live
BUY deeplink β†’ purchase flow apps/wa-bot/src/conversations/engine.ts βœ… Live
Autoplay bot demo on homepage src/components/common/BotDemo.tsx βœ… Live
WhatsApp CTA on homepage src/routes/index.tsx βœ… Live
RESET clears pending state apps/wa-bot/src/conversations/engine.ts βœ… Live
Buyer requests + quotes apps/api/src/routes/{request,quote}.routes.ts βœ… Live
Auto-deploy CI/CD .github/workflows/deploy.yml βœ… Live

The numbers

  • 5 Indian languages
  • ~70 conversation states in the bot engine
  • 14 Prisma models
  • 17 frontend routes
  • ~25 API route files
  • 1 app the artisan needs to know β€” WhatsApp

Built for

Project Sankalp / Code4Change Hackathon
Problem statement: W-1 β€” Artisan Women's Market Exclusion Across 15+ Craft Districts
Theme: Women's Entrepreneurship & Economic Empowerment


License

MIT β€” see LICENSE.

The artisan stories, names, and example imagery are illustrative; production deployments must collect explicit consent before showcasing real artisans publicly.


HastKala β€” from a voice note to a livelihood

About

WhatsApp-first marketplace for India's women artisans. Five Indian languages, voice-driven onboarding, certified-seller pipeline, end-to-end orders inside one app she already trusts. Built for the Sankalp/Code4Change hackathon.

Topics

Resources

Stars

Watchers

Forks

Contributors