System Design Prompt for Architecture Decisions
A structured prompt that produces a system design — components, data flow, storage, and trade-offs — instead of a vague architecture chat.
Enhanced prompt — ready to use
ROLE You are a senior software architect with expertise in designing scalable and efficient application systems. Your goal is to create a detailed system design for a mobile or web application. TASK Design a comprehensive system architecture for the user’s application. Think through this step by step, considering key components such as frontend, backend, database, APIs, security, and scalability. Address potential edge cases and performance concerns. CONTEXT The user seeks assistance to design the overall system for their application. No specific technology stack or app domain was provided, so assume a typical web or mobile app requiring robust architecture suitable for moderate to high user traffic. REQUIREMENTS - Provide a clear breakdown of system components and their interactions. - Recommend suitable technologies and design patterns. - Consider scalability, security, and maintainability. - Think through potential bottlenecks and failure points. - Before finalizing, verify your answer for completeness and correctness. - Assumptions: Since no app domain or tech stack was specified, assume a generic app with typical user authentication, data storage, and API integration needs. OUTPUT FORMAT Present the system design as a structured outline with sections for architecture overview, component descriptions, technology recommendations, and scalability/security considerations. Use bullet points and numbered lists for clarity.
That's what PromptAI produced from this vague prompt: “help me design a system for my app”
Example result
Certainly! Below is a comprehensive system architecture design for a generic web or mobile application with typical requirements such as user authentication, data storage, API integrations, and support for moderate to high user traffic. --- # System Design for Generic Web/Mobile Application --- ## 1. Architecture Overview ### 1.1. High-Level Components - **Client Layer (Frontend)** - Web app and/or mobile app - UI components, state management, offline support - **Backend Layer (API Services)** - Stateless RESTful or GraphQL API servers - Business logic, input validation, authentication, authorization - **Data Layer (Databases)** - Primary data storage (relational or NoSQL) - Caching layer for performance - Search/indexing service (optional) - **External Integrations** - Third-party APIs (payments, notifications, analytics) - **Infrastructure** - Load balancers, CDN, service discovery, message queues (async processing) - **Monitoring & Logging** - Application performance monitoring (APM) - Centralized logging and alerting system - **Security Layers** - Authentication and authorization modules - Network level security (firewalls, WAF) - Data encryption at rest and in transit ### 1.2. Architectural Style - **Microservices or Modular Monolith:** Start modular (bounded contexts) for maintainability; evolve into microservices if scale demands. - **API-First Design:** Decouple frontend and backend, enable multiple client types. - **Event-Driven Components:** Use message queues for async, decoupled processing (e.g., email notifications, analytics). --- ## 2. Component Descriptions and Interactions ### 2.1. Client Layer (Frontend) - **Responsibilities:** - Render UI, provide smooth user experience - Handle offline states and client-side caching (e.g., IndexedDB, localStorage) - Communicate with backend via secure APIs (HTTPS) - **Key Features:** - Authentication UI (login/signup, password reset) - State management (Redux, Vuex, MobX, etc.) - Responsive design for mobile and desktop - **Technology Suggestions:** React/Angular/Vue for web; React Native/Flutter/Swift/Kotlin for mobile ### 2.2. Backend Layer - **API Gateway / Load Balancer** - Route requests to appropriate backend services - Provide rate-limiting, authentication, and SSL termination - **Authentication Service** - Support OAuth2, JWT, multi-factor authentication (MFA) - Handle session management, token refresh, user profile management - **Core Business Logic Services** - User management, content management, transaction processing, etc. - **Asynchronous Processing** - Message queues (e.g., RabbitMQ, Kafka) to handle resource-intensive or delayed tasks - Background workers (e.g., Celery, Sidekiq) - **Inter-service communication** - REST or gRPC for synchronous - Message queues for async ### 2.3. Data Layer - **Primary Database** - Relational DB (PostgreSQL, MySQL) for structured data with ACID properties - NoSQL DB (MongoDB, DynamoDB) for flexible schema / document storage if required - **Cache Layer** - In-memory cache (Redis, Memcached) for frequently accessed data, session store - **Search Engine** - ElasticSearch or Algolia for full-text search and analytics queries - **Data Replication & Backup** - Setup master-slave or multi-region replication for fault tolerance - Regular backups and tested restore procedures ### 2.4. External Integrations - Payment gateways, email/SMS providers, push notifications (e.g., Firebase Cloud Messaging) - Analytics and monitoring services (e.g., Google Analytics, Prometheus, Grafana) --- ## 3. Technology Recommendations | Component | Technology Options | |------------------------|------------------------------------------------------------| | Frontend Framework | React, Vue.js, Angular (web); React Native, Flutter (mobile)| | API Layer | Node.js + Express, Spring Boot, Django, Go (gRPC/REST) | | Authentication | OAuth2/OpenID Connect, JWT, Auth0/Firebase Auth | | Database | PostgreSQL (relational), MongoDB (document), DynamoDB | | Caching | Redis or Memcached | | Messaging Queue | RabbitMQ, Apache Kafka, AWS SQS | | Search Service | ElasticSearch, Algolia | | Load Balancing | NGINX, HAProxy, AWS ELB | | Containerization | Docker, Kubernetes | | CI/CD | Jenkins, GitLab CI/CD, GitHub Actions | | Monitoring | Prometheus, Grafana, ELK Stack, Datadog | | Logging | ELK (Elasticsearch, Logstash, Kibana), Fluentd | --- ## 4. Scalability Considerations ### 4.1. Horizontal Scalability - Frontend: Delivered via CDN to handle large traffic globally - Backend/API Servers: Stateless design enables horizontal scaling behind load balancers - Database: Use read replicas, partitioning/sharding for scale - Cache: Distributed caching cluster to avoid bottlenecks ### 4.2. Performance Optimization - Use CDN for static assets (images, JS, CSS) - Implement server-side and client-side caching - Optimize DB queries; use indexing and query profiling tools - Employ asynchronous processing to offload long-running tasks - Lazy loading and pagination for large data sets ### 4.3. Fault Tolerance & Resilience - Health checks and auto-restart for services - Circuit breakers and retries for downstream dependencies - Graceful degradation: fallback UI or cached data on partial failures - Multi-region deployment to reduce latency and increase availability - Backpressure handling with message queues and rate limiting --- ## 5. Security Considerations ### 5.1. Authentication & Authorization - Use secure token-based auth (JWT with short expiry and refresh tokens) - Implement Role-Based Access Control (RBAC) or Attribute-Based Access Control (ABAC) - Enforce MFA and strong password policies ### 5.2. Data Protection - Encrypt sensitive data at rest (DB encryption) and in transit (TLS/SSL) - Use secrets management tools for API keys, credentials (Vault, AWS Secrets Manager) - Sanitize all inputs to prevent injection attacks (SQLi, XSS) ### 5.3. Network Security - Deploy WAF to protect against common web exploits - Isolate internal services via private VPCs, subnetting, and security groups - Enable DDoS protection (e.g., AWS Shield, Cloudflare) ### 5.4. Compliance & Auditing - Maintain audit logs for critical operations - Follow privacy regulations (GDPR, CCPA) based on target regions - Periodic security assessments and penetration testing --- ## 6. Edge Cases and Failure Points | Scenario | Mitigation Strategy | |---------|---------------------| | Sudden traffic spikes
How to adapt it
- •State scale expectations (users, requests/sec) — designs differ wildly by load.
- •Ask for trade-offs per decision so you can defend the design in review.
Have your own rough prompt? Enhance it into a structured prompt like this in one click.
Enhance your own promptOr use the ChatGPT prompt enhancer right inside ChatGPT, or the prompt enhancer for Claude Code in your terminal.
More coding prompts
GitHub Actions Prompt for CI Workflows That Pass
A structured prompt that writes a GitHub Actions workflow — triggers, caching, matrix builds — with a real example YAML you can adapt.
Pull Request Description Prompt Reviewers Thank You For
A structured prompt that writes a PR description from your diff summary — what changed, why, how to test, and risks — with a real example.
React Component Prompt for Production Components
A structured prompt that writes a typed, accessible React component with props, states, and edge cases handled — with a real example.
Web Scraping Prompt for Working Python Scrapers
A structured prompt that writes a Python scraper with selectors, pagination, and polite rate limits — plus a real example script.
API Documentation Prompt for Clear Docs
A structured prompt that documents your API endpoint — params, responses, errors, and examples — in clean reference style, with a real example.
Bash Script Prompt for Shell Automation
A structured prompt that writes a safe, portable Bash script for your task — with checks, comments, and a real example output.