This file contains the strict development, architectural, and design constraints for GrixChat. As an AI Agent, you must read and adhere to these guidelines during every turn.
- Backend, Database, Storage, and Sync: Built 100% on Supabase. Do not introduce any secondary server-side database stores or standard polling endpoints unless explicit.
- Push Notifications: Firebase Cloud Messaging (FCM) is strictly used only for native background notification delivery. No other Firebase features (Auth, Firestore, Storage) should be used.
- Calling & Streaming: Web RTC signaling is managed through lightweight Supabase channels. Keep media channels clean.
- Platform Delivery: Deployed primarily as a Progressive Web App (PWA) and Trusted Web Activity (TWA) on Android.
- The UX must feel native.
- Use safe-area paddings for navigation bars/status headers (
pb-[safe],h-[100dvh]dynamic viewport sizing to prevent mobile browser scroll bouncing). - Hover events must gracefully degrade, and touch targets must be minimum
44pxon mobile wrappers.
To comfortably support more than 50k users on Supabase's free tier, database operations and API calls must be kept highly optimized:
- No Unfiltered Postgres Listeners: Never listen to entire tables globally. A subscriber must always filter listeners to their own active context:
- ❌ Bad (High Egress):
.on('postgres_changes', { table: 'follows' }) - ✅ Good (Filtered):
.on('postgres_changes', { table: 'follows', filter: 'follower_id=eq.' + userId })
- ❌ Bad (High Egress):
- Transients via Broadcast Channels: Use lightweight WebSocket broadcasts instead of standard database inserts for highly transient actions (such as real-time typing indicators, active call signaling, online presence updates, and read confirmations). This retains a 0B database egress load.
- Consolidated Tab Bars: Never poll the database to update message feeds or list indicators across background screens. Listen directly to local cache updates from the
LocalDataCacheinside global headers and bottom navigation controllers.
- Offline Cache (
LocalDataCache): Always write conversational states dynamically to local storage/local memory cache. Feed views locally before loading the network. - Pruning and Batch Counts: Keep initial load ranges restricted (e.g., paging size of
20-30messages). Automatically prune deep DOM elements and maintain clean lists to minimize local runtime footprint.
GrixChat has a highly polished, aesthetic modern visual blend:
- 20% Telegram: Micro-animations (
motion/react), high velocity, clean chat bubble swipe gestures, dynamic typing feedback running instantly under avatars. - 20% WhatsApp: Simple, intuitive messaging mechanics:
- Message Ticks: Live delivery state visually synced:
✓Single Tick (Gray): Message sent securely.✓✓Double Tick (Gray): Message delivered (Recipient is online).✓✓Blue Tick: Message read by recipient.
- Selection Highlight Aesthetic: Selecting chats in selection mode changes background shade and adds an elegant left-colored border (
border-l-[4px] border-l-[var(--primary)] text-[var(--primary)]/10) instead of displaying intrusive checkboxes or moving the avatar block. - Header Context Menu: All bulk action bars (archives, deletes, mutes) reside cleanly inside the
TabHeaderto keep the bottom navigation bar neat and clutter-free.
- Message Ticks: Live delivery state visually synced:
- 60% Unique Identity: Elegant Dark Cosmic theme styled with deep charcoal tones, rich borders, bold Display typography (Space Grotesk, Inter), and customizable UI gradients.
- Keep code modular. Do not bloat files like
App.tsxorChatScreen.tsx. Extract helpers, individual sheets, and custom tabs to independent folders. - Always execute
/srcactions with high type-safety using standard standard TypeScript types and strictly avoid compiling failures. - SQL Registry Structure: All database schemas, incremental migration updates, row-level security (RLS) definitions, triggers, and indices must be kept updated and strictly stored inside the
/sqlfolder at the root level. Running developers/AI agents must keep the/sqldirectory perfectly updated at all times.