Bansify Chat is a high-performance, low-cost messaging and private-calling app, built as a PWA and Google Play TWA. It is deliberately scoped to five tabs — Chats, Stories, Search, Calls and Profile — plus an in-app AI assistant (Grix AI), a GitHub repository browser, and an app lock.
The visual language blends 60% unique Dark Cosmic identity, 20% Telegram performance micro-animations, and 20% WhatsApp communication mechanics.
👉 New here? Start at
docs/CONTEXT.md. It is the shortest path to a working mental model — how to run the app, where things live, and what will bite you.
- Backend, Storage & Real-Time Sync: Driven 100% by Supabase. Includes custom PostgreSQL procedures, storage buckets, and filtered
postgres_changeslisteners. - Push Notifications: Firebase Cloud Messaging (FCM) is strictly restricted to background mobile notifications so database egress loads remain at exactly zero.
- Direct Private Calling: Peer-to-peer audio/video calling powered by WebRTC with automatic 45-second persistent dialing, Web Audio API sound synths, and background conversation survival.
- Aesthetic Visual Blend: Custom display typography of Space Grotesk paired with Inter and JetBrains Mono, complete with WhatsApp-style delivery double-ticks, custom context sliders, and selection highlights.
To support more than 50,000 active users comfortably on Supabase's free tier, database operations obey strict efficiency guidelines:
- Unfiltered Listeners Banned: All real-time channel listeners are strictly targeted and filtered based on keys (e.g.
receiver_id=eq.${userId}). We never listen to entire tables globally to protect egress. - Lightweight WebSocket Broadcasts: High-frequency, fleeting events—such as typing feedback, read ticks, or calling connection states—are routed via Supabase Broadcast and Presence channels, avoiding heavy relational database queries.
- Optimized Local Caching: State managers cache local messages and profiles before triggering remote syncs, delivering a persistent offline-first experience.
- Range constraints & Pagination: Initial list loading feeds only the vital 20-30 conversational records.
- Background Video/Voice Calling: WebRTC signalling lives inside a global React Context (
providers/CallProvider.tsx). You can back out of a call to keep messaging, and a WhatsApp-style pulsing green line keeps ticking beneath the navigation bar. - Micro-Animations: Staggered transition arrays and slide-out logout menus engineered via
motion/reactfor smooth, native-like user flows. - Interactive Multi-Tab Setup: Visited views are retained using a custom keep-alive container pattern to prevent visual reloads.
- Secure App Lock: Secure PIN screen and privacy toggles to protect chats.
/src/providers: Application context singletons (SupabaseAuthProvider, global WebRTCCallProvider)./src/features: Modular screens broken into focus zones (chat,call,profile,search,stories,github,grixai)./src/components: UI layouts, bottom/top navigation components, and global drop-downs./sql: The only place for schema —01_schema.sql(tables, policies, indexes) and02_functions_realtime_storage.sql(functions, triggers, realtime, storage, the egress work), plus00_master_instructions.md(the runbook). Both files are safe to re-run: nothing is dropped, missing objects are created, policies and functions are re-created. New SQL is appended to the current file until it reaches 600–1000 lines, then the next number starts; superseded files live in/sql/legacy— never run those./server/api.ts: The API. Runtime-neutral (WebRequest/Response), so the same file serves Cloudflare Pages Functions and the Express dev server./functions: Cloudflare Pages Functions — thin adapters that forward/api/*and/auth/*toserver/api.ts./docs: Developer documentation — orientation, setup, testing, data model, known issues./dev: The mock Supabase (dev/mock/) and test setup (dev/test/). See docs/TESTING.md.
npm installnpm run dev:mock→ http://localhost:3000 · login demo@grixchat.app / grixchat
This runs the full app against an in-memory Supabase mock (dev/mock/) with a
seeded social graph. Nothing touches the network.
cp .env.example .env # fill in VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY
npm run dev.env.example documents every variable, frontend and server — including the
ones that live in the Cloudflare Pages dashboard in production.
npm test # 99 tests
npm run lint # tsc --noEmit
npm run build # vite build → dist/ (what Cloudflare Pages builds)Cloudflare Pages builds this repository and serves
https://grixchat.gothwadtech.com — dist/ as the static site and functions/
as the API. Build command npm run build, output directory dist, and the
project's environment variables. Full checklist:
docs/DEV_SETUP.md.
npx wrangler pages functions build # check the API bundles for the edge
npx wrangler pages dev dist # run it locally in workerd on :8788CI (.github/workflows/ci.yml) typechecks, tests and bundle-checks every push;
it does not deploy.
Crafted under high-precision directives for the Bansify Chat Mobile Ecosystem. 🌌