Queens Connect is a hyper-local WhatsApp-first super app for Komani/Queenstown townships.
It combines community info, marketplace listings, lending, and payments – all inside one WhatsApp number – using:
- WhatsApp Cloud API → webhook into Firebase Cloud Functions
- Firebase (Firestore, Auth, Cloud Functions, Storage) as the main app backend
- Python ADK agent backend on FastAPI (Render) for AI orchestration and tools
- React frontend for web admin/ops and debugging
This README covers the whole monorepo: how folders fit together, how to run things locally, and how to deploy.
backend/– FastAPI backend, ADK agents and tools, serves the built React app in production.frontend/– React/Vite SPA used for web UI and ops.functions/– Firebase Cloud Functions (TypeScript) for WhatsApp webhooks, callable APIs, lending flows, and scheduled jobs.whatsapp/– WhatsApp Cloud API sandbox, testing tools, and related config (if present).docs/– Architecture plans, prompts, schema docs, deployment notes (start withdocs/things-to-build.md).firebase.json,firestore.rules,storage.rules,firestore.indexes.json– Firebase project config.render.yaml– Render template for deploying the Python backend + frontend as a single web service.
See backend/README.md for backend-only details.
- Node.js ≥ 18 (for
frontend/andfunctions/) - Python 3.11 (matches
.python-version) - Firebase CLI (
npm install -g firebase-tools) - Google Cloud SDK (optional but useful for credentials)
- Accounts/keys:
- Firebase project (Firestore, Storage, Functions enabled)
- Google AI / Gemini API key (
GOOGLE_API_KEYorGEMINI_API_KEY) - Optional: Groq, xAI, Ikhokha, Twilio, etc. (see
docs/deploy-render.md)
- Copy
backend/queens_connect/.env.exampleto.env(same folder) and fill in:GOOGLE_API_KEY/GEMINI_API_KEYFIREBASE_PROJECT_ID(if different from default)- Any other API keys you plan to use.
- (Optional on local) Point to Firebase emulator by setting
FIRESTORE_EMULATOR_HOSTas described in.env.example.
- In the Firebase Console, create a project (or use
queens-connect-2c94d). - Enable Firestore, Functions, Authentication (Phone), and Storage.
- Make sure
firebase.json,firestore.rules,storage.rulesmatch your project/bucket (seedocs/firebase-storage-cv.md).
From repo root:
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000Alternatively (from repo root):
pip install -r backend/requirements.txt
PYTHONPATH=. uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000See backend/README.md for more context.
From repo root:
cd frontend
npm install # or npm ci
npm run dev # Vite dev server, usually on http://localhost:5173You can set VITE_API_URL to point at your FastAPI server:
VITE_API_URL=http://localhost:8000 npm run devFrom repo root:
cd functions
npm install # or npm ci
npm run build
firebase emulators:start --only functionsUseful scripts (from functions/package.json):
npm run serve– build then start Firebase emulators for functions.npm run deploy– deploy Cloud Functions to your Firebase project.
The main function entrypoints live in functions/src/index.ts (WhatsApp webhook, callable APIs, scheduled jobs).
This project is set up to deploy as a single Render Web Service. Render runs the FastAPI backend and serves the built React app.
High‑level steps:
- Push the repo to GitHub/GitLab.
- In Render, create a Web Service from this repo (or use
render.yamlas a blueprint). - Set environment variables as described in
docs/deploy-render.md:- Core AI keys (
GOOGLE_API_KEY, etc.) - Firebase (
FIREBASE_PROJECT_ID,GOOGLE_APPLICATION_CREDENTIALS, etc.) - Optional payment/search keys.
- Core AI keys (
- Deploy – Render will:
- Install backend dependencies.
- Build the React app (
frontend/dist). - Start
gunicorn backend.main:appbound to$PORT.
See docs/deploy-render.md for full details.
From repo root:
firebase login
firebase use <your-project-id>
# Deploy rules and indexes
firebase deploy --only firestore:rules,firestore:indexes,storage
# Deploy Cloud Functions
cd functions
npm run build
firebase deploy --only functionsCheck docs/firebase-storage-cv.md for Storage bucket naming and configuration.
End‑to‑end message path:
- WhatsApp user sends a message.
- Meta Cloud API POSTs webhook to Firebase HTTPS function:
functions/src/index.ts→webhookWhatsApp.
- Cloud Function validates signature, then:
- Logs payload.
- Calls into the Python ADK backend / orchestrator (planned) or responds directly.
- ADK agents read/write data in Firestore using the tools in
backend/queens_connect/tools/. - Responses go back to the user via WhatsApp Cloud API.
More architecture detail lives in docs/things-to-build.md and the various prompt docs under docs/prompts/.
- Firebase Cloud Functions:
functions/src/index.ts - Python backend config:
backend/queens_connect/config.py - AI tools (Firestore, CVs, gamification, etc.):
backend/queens_connect/tools/ - Architecture overview:
docs/things-to-build.md - Deployment to Render:
docs/deploy-render.md
- Keep prompts and business rules in sync with the docs under
docs/. - When adding new tools or functions:
- Prefer small, composable functions with clear names.
- Update this README or the relevant sub‑README (
backend/README.md, etc.).
- Avoid committing secrets (
.env, service account JSON). Use environment variables or secret managers.