A modern, secure chat application featuring end-to-end encryption, room-based conversations, and universal dark mode. Built with React, Supabase, and modern cryptography.
- End-to-end encryption using ECDH key exchange and AES-256-GCM
- Personal encryption keys - only you can decrypt your messages
- Secure room-based architecture with unique keypairs per room
- Google OAuth authentication via Supabase Auth
- Universal dark mode with toggle (defaults to dark)
- Responsive design that works on all devices
- Professional chat interface with message bubbles and timestamps
- Smooth animations (fade-in, slide-up, bounce-in effects)
- Real-time message updates with loading indicators
- Create private rooms with custom names and generated codes
- Join rooms via invite links or room codes
- Multi-user encrypted group chats
- Room member management with creator privileges
- Node.js 16+ and npm
- Supabase account and project setup (instructions below)
-
Clone the repository
git clone <repository-url> cd porcupine-chat
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Add your Supabase credentials to .env -
Start the development server
npm start
-
Open your browser Navigate to http://localhost:3000
npm start- Runs the development server (with deprecation warnings suppressed)npm test- Launches the test runner in interactive watch modenpm run build- Builds the app for productionnpm run eject- Ejects from Create React App (one-way operation)
- Frontend: React 18 + Tailwind CSS v3
- Backend: Supabase (PostgreSQL + Real-time + Auth)
- Encryption: Web Crypto API (ECDH + AES-256-GCM)
- State Management: React Context API + useState/useEffect
src/
βββ components/
β βββ App.js # Main app with theme provider
β βββ Navbar.jsx # Navigation with dark mode toggle
β βββ SignIn.jsx # Google OAuth authentication
β βββ RoomSelection.jsx # Room list and creation interface
β βββ RoomChat.jsx # Chat interface with E2E encryption
β βββ DarkModeToggle.jsx # Animated theme toggle
β βββ ErrorBoundary.jsx # Error handling wrapper
βββ contexts/
β βββ ThemeContext.js # Dark mode state management
βββ utils/
β βββ crypto.js # Encryption utilities
βββ supabase.js # Supabase client configuration
- Room Creation/Join: Each user generates an ECDH keypair for the room
- Key Exchange: Public keys are stored in the database, private keys stay local
- Shared Secrets: Users derive shared secrets with other room members
- Message Encryption: Messages are encrypted with AES-256-GCM using shared secrets
- Real-time Delivery: Encrypted messages are sent via Supabase real-time
- Theme Context: Global state management for dark/light mode
- LocalStorage Persistence: User preference saved across sessions
- Default Dark: New users start with dark mode enabled
- Universal Application: All components support both themes
- Django backend migration
- Enhanced secure connection debugging and auto-recovery
- Improved error handling for edge cases
- Message search and filtering
- File sharing with encryption
- Voice/video calling integration
- Mobile app development (React Native)
- Advanced room management (admin controls, member permissions)
The project includes comprehensive preparation for migrating from Supabase to Django:
Phase 1: Parallel Systems
- Docker Compose setup with Django + PostgreSQL + Redis
- API compatibility testing and documentation
Phase 2: Data Migration
- Export/import scripts for rooms, users, and messages
- Data integrity validation and rollback procedures
Phase 3: Frontend API Switch
- Django JWT authentication replacement
- WebSocket real-time messaging migration
- Encryption handling updates
Phase 4: Cleanup
- Supabase dependency removal
- Documentation updates and deployment script changes
- Dark Theme: Custom scale from
dark-50todark-950 - Accent Colors: Blue to purple gradients
- Success/Error States: Green and red variants with dark mode support
- Font: System font stack with fallbacks
- Spacing: Tailwind's 4px-based scale
- Shadows: Layered shadows with dark mode variants
- Duration: 200ms for micro-interactions, 300ms for page transitions
- Easing:
ease-in-outfor natural movement - Types: fade-in, slide-up, bounce-in effects
"Unable to establish secure connection"
- Clear localStorage and refresh the page
- Check browser console for detailed error messages
- Ensure Supabase connection is stable
Messages not appearing
- Verify room membership in database
- Check if encryption keys are properly generated
- Refresh page to re-establish real-time connection
Dark mode not persisting
- Check localStorage for
themekey - Ensure ThemeProvider wraps the entire app
- Clear browser cache if needed
REACT_APP_SUPABASE_URL=your_supabase_url
REACT_APP_SUPABASE_ANON_KEY=your_supabase_anon_key
REACT_APP_ENV=developmentRequired tables and configurations are documented in:
setup-database.sql- Initial schemaenable-realtime.sql- Real-time subscriptionsroom-based-schema.sql- Room and member tables
This project is licensed under the MIT License - see the LICENSE file for details.
