# Bangladesh directory and account provider setup

Updated 13 October 2026.

## Bangladesh data provenance

The bilingual base data is MIT-licensed [bangladesh-geo-json](https://github.com/iqbalhasandev/bangladesh-geo-json/tree/28ba44c344b72cfe4849f2dde75b98393c8316ae), pinned to commit `28ba44c344b72cfe4849f2dde75b98393c8316ae` (21 May 2026). Its snapshot contains 8 divisions, 64 districts, 495 upazilas, 4,540 union entries and 328 municipality entries. The licence is included at `/data/bangladesh-geo-LICENSE.txt`.

Five additions reported by the official Bangladesh Sangbad Sangstha on [7 May 2026](https://www.bssnews.net/news-flash/385117) bring this application's upazila directory to 500:

| District | Addition |
| --- | --- |
| Bogura | Mokamtala |
| Cox's Bazar | Matamuhuri |
| Thakurgaon | Ruhea |
| Thakurgaon | Bhully |
| Lakshmipur | Chandrogonj |

Administrative additions are marked `new2026`. Stable internal IDs combine district and place slugs; every upazila is validated against its district. English variants such as Comilla/Barisal are normalized to Cumilla/Barishal in the display directory. The localities snapshot retains its source spelling.

Union and municipality lists are reference snapshots, not an independently reconciled current boundary dataset. No union reassignment to the five new upazilas was guessed. City users may choose a district without an upazila. This directory must not be interpreted as proof of service operations, active donors or hospital partnerships in each area.

`lib/locations-data.ts` is the compact application catalogue. `/data/bangladesh-localities.json` provides the bilingual union and municipality references loaded on demand by `/coverage`. A profile uses district/upazila equality for regional discovery. Only the existing explicitly located Dhaka areas support approximate hospital-radius searches.

Hospital directories have not been fabricated. Three existing Dhaka references remain; users can provide a hospital name with district and optional upazila. Such names are labelled unverified requester-supplied references and have no invented coordinates or partner claim.

## Identity integration

The deployed Site preserves its native ChatGPT sign-in. Additional accounts use the official `@supabase/ssr` and `@supabase/supabase-js` SDKs, and remain disabled until the settings below are explicitly supplied. ChatGPT and Supabase identities have separate namespaces. No automatic email-based account linking is performed.

Use a dedicated Quickgency Supabase project. Do not reuse credentials or user tables from unrelated products.

### Server environment

| Variable | Purpose |
| --- | --- |
| `QUICKGENCY_SUPABASE_URL` | Dedicated Supabase project HTTPS URL |
| `QUICKGENCY_SUPABASE_PUBLISHABLE_KEY` | Project publishable key; a service-role key is neither needed nor accepted as the intended credential |
| `QUICKGENCY_AUTH_GOOGLE` | Set to `true` only after Google provider configuration and validation |
| `QUICKGENCY_AUTH_EMAIL` | Set to `true` only after email OTP template and delivery configuration |
| `QUICKGENCY_AUTH_PHONE` | Set to `true` only after SMS provider setup and Bangladesh delivery validation |
| `QUICKGENCY_ADMIN_IDS` | Comma-separated server-only allowlist for independent verifiers; Supabase IDs use `sb:<uuid>` |

Use the Sites environment-variable workflow. Do not commit provider secrets. Supabase owns the Google client secret and SMTP/SMS provider credentials. Only enable channels that have been configured.

### Google

1. Configure the dedicated project's Google provider in Supabase using a Google Cloud OAuth client.
2. Add the Supabase Auth callback URL shown by its dashboard to Google's authorized redirect URIs.
3. Set the Quickgency site URL to your owned canonical HTTPS origin (`QUICKGENCY_SITE_URL`) and allow only that origin's `/api/auth/callback` with its local `next` query parameter. Local development uses `http://localhost:5173`. Do not allow arbitrary off-site redirect URLs.
4. Enable the Google flag after exercising the real PKCE flow. Requested scopes are `openid email profile` only. No Gmail inbox permission is requested.

The app callback is `/api/auth/callback`; it does not replace the Sites-owned `/callback` or `/signin-with-chatgpt` routes.

### Email, including Gmail addresses

Enable email sign-up and configure production SMTP. The template must include `{{ .Token }}` so it sends the one-time code entered in Quickgency. Configure provider rate limits, CAPTCHA/abuse controls as needed and delivery monitoring. Email registration and login use `signInWithOtp` plus `verifyOtp`, with no custom password database.

### Bangladesh mobile numbers

Enable the phone provider and an SMS delivery provider in Supabase. Validate Bangladesh sender/destination support and delivery before enabling the phone flag. Quickgency normalizes supported Bangladeshi mobile numbers to E.164 `+8801…`, sends SMS via the provider SDK, and verifies the supplied code. It never simulates a successful send or accepts a hardcoded code.

Only the provider's server-verified `phone_confirmed_at` claim can establish a verified mobile identity. Such an identity can activate its own blood requests and save a phone-verified profile. Donor availability still requires explicit opt-in, and reported donations still require independent review. Google/email sign-in alone does not establish phone verification.

### Sessions and sign-out

PKCE and session handling use the maintained SDK. HttpOnly, secure, SameSite=Lax cookies are refreshed in `proxy.ts`; server actor resolution uses `getUser()`. POST mutations enforce same origin, bounded payloads, and persistent OTP limits. Sign-out clears the local Supabase session and continues through native ChatGPT sign-out. Account information erasure affects Quickgency records, not the user's Google account or the identity provider's account lifecycle.

Official references:

- [Supabase server-side clients](https://supabase.com/docs/guides/auth/server-side/creating-a-client)
- [Google provider configuration](https://supabase.com/docs/guides/auth/social-login/auth-google)
- [Phone login and SMS providers](https://supabase.com/docs/guides/auth/phone-login)
- [Email passwordless authentication](https://supabase.com/docs/guides/auth/auth-email-passwordless)

## Required real-provider acceptance checks

Test a new account and returning session for each enabled provider, cancelled OAuth, expired/wrong OTP, resend limits, session refresh, sign-out, account separation, and mobile claim enforcement. Verify that authentication emails/SMS are not confused with donation outreach: donor notifications in this release remain in-app, and real consented contact routing is a separate operational requirement.

At the time this edition was built, all provider flags and credentials were absent. ChatGPT sign-in is the configured path. Google/email/SMS end-to-end tests were therefore not performed.
