Here’s a modular breakdown of the prompt into smaller, more manageable parts. You can use these individually or sequentially to refine the AI’s responses.
Part 1: Project Overview & Core Stack
Prompt:
*"You are a Senior Full-Stack Developer. Outline a high-level architecture for a Telegram-like real-time chat app using React (TypeScript) and a Node.js backend. Include justifications for the following stack choices:
- Frontend: React + TypeScript + Vite
- State Management: Redux Toolkit or Zustand
- Styling: Tailwind CSS or Mantine/Chakra UI
- Backend: Node.js (Express/NestJS)
- Database: PostgreSQL
- Real-Time: Socket.io
- Auth: JWT + 2FA
- File Storage: AWS S3/MinIO
Focus on scalability, security, and performance."*
Part 2: Authentication & User Management
Prompt:
*"Detail the implementation of Telegram-like authentication and user management, including:
- Phone Number + OTP Login (like WhatsApp/Telegram)
- Two-Factor Authentication (2FA)
- User Profiles (avatars, usernames, bios)
- Privacy Controls (last seen, phone number visibility)
- Active Sessions Management
Provide API endpoints, database schema (PostgreSQL), and frontend state management logic."*
Part 3: Messaging Features (1-on-1, Groups, Channels)
Prompt:
*"Explain how to implement Telegram’s core messaging features in React + Node.js:
- 1-on-1 Chats (WebSocket-based)
- Group Chats (admin roles, invite links)
- Channels (broadcast-only)
- Message Syncing Across Devices
- Message Status (Read Receipts, Typing Indicators)
Include:
- Database schema for chats/messages
- Socket.io event structure
- React component hierarchy (e.g.,
ChatList, MessageBubble)"*
Part 4: Rich Media & Message Interactions
Prompt:
*"Describe the architecture for handling:
- File Uploads (images, videos, docs up to 2GB)
- Stickers, GIFs, Voice/Video Messages
- Message Editing/Deleting (for all or sender only)
- Replies, Forwards, Reactions, Pinned Messages
- Spoiler Text Formatting
Cover:
- Cloud storage (S3/MinIO) integration
- Real-time updates via WebSockets
- Optimizing media delivery (compression, lazy loading)"*
Part 5: Search, Notifications & Advanced Features
Prompt:
*"Explain how to implement:
- Global & In-Chat Search
- Push Notifications (Firebase Cloud Messaging or alternatives)
- Muting Chats/Channels
- End-to-End Encryption (E2EE) for Secret Chats (high-level approach)
- Scalability for Large Groups (10K+ users)
Provide:
- Database indexing strategies
- Notification service architecture
- Security considerations for E2EE"*
Part 6: Frontend Structure (React/TypeScript)
Prompt:
*"Break down the React (TypeScript) frontend structure for the chat app:
- Key Components (
ChatList, MessageInput, UserProfileModal)
- State Management (Redux/Zustand for auth, chats, messages)
- Socket.io Integration (hooks like
useSocket)
- Optimizations (virtualized message lists, lazy loading)
- Theming & Responsive Design (Tailwind/Mantine)
Include code snippets for critical logic (e.g., sending a message)."*
Part 7: Backend API & WebSocket Events
Prompt:
*"List the essential:
- REST/GraphQL API Endpoints (e.g.,
/auth/login, /chats/:id/messages)
- Socket.io Events (e.g.,
message:send, user:typing)
- Database Queries (e.g., fetching 50 latest messages with pagination)
- Rate Limiting & Security Middleware
Provide example payloads for requests/responses."*
Part 8: Deployment & Scaling
Prompt:
*"Outline a deployment strategy for:
- Containerization (Docker + Kubernetes)
- Load Balancing (WebSocket connections)
- Database Sharding/Replication (for high-traffic groups)
- Monitoring (logging, error tracking)
- CI/CD Pipeline (GitHub Actions, AWS CodeDeploy)"*
How to Use These Prompts
- Step-by-Step Refinement: Use each prompt sequentially to build the app piece by piece.
- Focus on Specifics: If you need deeper detail on one area (e.g., E2EE), expand that prompt further.
- Combine Responses: Merge the AI’s answers into a cohesive architecture document.
Let me know if you'd like any section expanded further!