A cross-platform mobile app for managing online status across multiple social platforms. Built with React Native, Expo, and TypeScript.
Ghost Switch uses a modular, plugin-based architecture designed for scalability and maintainability:
- Platform Connectors - Pluggable modules for each social platform
- Connector Registry - Centralized management of available connectors
- State Management - React Context for authentication and platform state
- UI Components - Reusable, themed components with real-time updates
- Mock Implementations - Realistic simulations for development and testing
- Modular Design: Each platform connector is independent and pluggable
- Type Safety: Full TypeScript coverage with strict typing
- Testable: Clean interfaces and dependency injection
- Scalable: Easy to add new platforms and features
- Maintainable: Clear separation of concerns
- Multi-Platform Status Management: Control visibility across connected platforms
- Real-Time Updates: Live status changes with visual feedback
- Batch Operations: "Go Invisible" across all platforms simultaneously
- Error Handling: Graceful failure handling with retry options
- Mock Implementations: Realistic platform simulations for development
- Node.js 18+
- Expo CLI
- iOS Simulator or Android Emulator (for mobile testing)
# Clone the repository
git clone <repository-url>
cd ghost-switch
# Install dependencies
npm install
# Start the development server
npm run dev# Start development server
npm run dev
# Build for web
npm run build:web
# Lint code
npm run lintβββ app/ # App screens and navigation
β βββ (tabs)/ # Tab-based navigation
β β βββ index.tsx # Dashboard screen
β β βββ platforms.tsx # Platform management
β β βββ profile.tsx # User profile
β βββ _layout.tsx # Root layout with providers
βββ components/ # Reusable UI components
β βββ GhostButton.tsx # Central action button
β βββ PlatformCard.tsx # Platform toggle card
β βββ PlatformStatusCard.tsx # Status display card
β βββ StatusSummary.tsx # Overview statistics
βββ hooks/ # React hooks and context
β βββ useAuth.tsx # Authentication management
β βββ usePlatforms.tsx # Platform state management
βββ services/ # Business logic and connectors
β βββ connectors/ # Platform connector implementations
β β βββ BaseConnector.ts # Abstract base class
β β βββ SlackConnector.ts # Slack integration
β β βββ DiscordConnector.ts # Discord integration
β β βββ WhatsAppConnector.ts # WhatsApp integration
β βββ ConnectorRegistry.ts # Connector management
βββ types/ # TypeScript type definitions
βββ platform.ts # Core interfaces and types
// services/connectors/NewPlatformConnector.ts
import { BaseConnector } from './BaseConnector';
import { PlatformStatus } from '@/types/platform';
export class NewPlatformConnector extends BaseConnector {
public readonly id = 'newplatform';
public readonly name = 'New Platform';
public readonly icon = 'π';
async initialize(credentials: any): Promise<boolean> {
// Initialize connection with platform API
// Handle authentication, tokens, etc.
}
async getCurrentStatus(): Promise<PlatformStatus> {
// Fetch current status from platform
}
async changeStatus(status: PlatformStatus): Promise<boolean> {
// Update status on platform
}
}// services/ConnectorRegistry.ts
import { NewPlatformConnector } from './connectors/NewPlatformConnector';
ConnectorRegistry.register('newplatform', () => new NewPlatformConnector());Add the new platform to the initial mock data in hooks/usePlatforms.tsx.
The app includes realistic mock implementations for:
- Slack - Simulates Slack Web API with workspace integration
- Discord - Mimics Discord's presence API with user status
- WhatsApp - Emulates WhatsApp Business API integration
- Realistic Delays: Network latency simulation (300ms - 2s)
- Failure Simulation: Configurable error rates for testing
- Status Mapping: Platform-specific status translations
- Error Messages: Platform-appropriate error responses
- Primary: Purple (#8b5cf6) - Ghost/mystical theme
- Background: Dark (#0a0a0a, #1a1a1a) - Modern dark theme
- Text: White/Gray scale for optimal contrast
- Status Colors: Green (online), Gray (invisible), Yellow (away), Red (busy)
- Cards: Rounded, shadowed containers with consistent spacing
- Buttons: Touch-friendly with proper feedback states
- Icons: Lucide React Native for consistent iconography
- Typography: Clear hierarchy with appropriate font weights
- Secure Credential Storage: Use platform-specific secure storage
- Token Management: Implement refresh token handling
- API Security: Use HTTPS and proper authentication headers
- Rate Limiting: Implement backoff strategies for API calls
- Privacy: Minimize data collection and provide transparency
- Credentials are simulated and not stored
- All operations are local to the app
- No actual external API calls are made
// Example connector test
describe('SlackConnector', () => {
it('should initialize with valid credentials', async () => {
const connector = new SlackConnector();
const result = await connector.initialize({ token: 'valid-token' });
expect(result).toBe(true);
});
it('should handle status changes', async () => {
const connector = new SlackConnector();
await connector.initialize({ token: 'valid-token' });
const result = await connector.changeStatus('invisible');
expect(result).toBe(true);
});
});- Test full platform workflows
- Verify error handling and recovery
- Test batch operations
- Component rendering tests
- User interaction flows
- State management verification
- API Keys: Configure platform API credentials
- Environment Variables: Set up staging/production configs
- Build Configuration: Optimize for production builds
- Error Tracking: Integrate crash reporting (Sentry, Bugsnag)
- Create Slack App in developer console
- Configure OAuth scopes:
users:write,users:read - Set up workspace installation
- Create Discord application
- Configure bot permissions
- Handle Discord's gateway connection
- Set up WhatsApp Business API account
- Configure webhook endpoints
- Handle message templates and compliance
- Code Style: Follow TypeScript strict mode
- Components: Use functional components with hooks
- Testing: Write tests for new connectors and components
- Documentation: Update README and inline docs
- Type Safety: Maintain full TypeScript coverage
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Update documentation
- Submit pull request with description
- Implement connector following
BaseConnectorinterface - Add comprehensive error handling
- Include realistic mock implementation
- Write unit tests for connector
- Update documentation
MIT License - see LICENSE file for details.
For questions, issues, or contributions:
- Check existing GitHub issues
- Create new issue with detailed description
- Join community discussions
- Contribute to documentation
Ghost Switch - Making social status management effortless across all platforms.