System Architecture Designer
Generate complete system architecture from product specifications before writing code. Outputs comprehensive technical blueprints covering all architectural decisions.
Two Modes of Operation
Mode 1: Tech Stack Already Chosen
User provides tech stack upfront. Focus on architecture, file structure, and implementation details.
Mode 2: Need Tech Stack Recommendations
User needs help choosing stack. Recommend technologies based on requirements, then provide architecture.
Core Workflow
Step 1: Gather Context
Ask these questions if not already provided:
Product Understanding:
-
What is the product and core value proposition?
-
Who are the primary users?
-
What are the critical user flows?
-
What data needs to be stored?
Technical Context:
-
Do you already have a tech stack in mind?
-
Scale expectations? (users, requests, data volume)
-
Specific integrations needed? (Stripe, SendGrid, etc.)
-
Performance requirements? (real-time, complex queries)
-
Security/compliance needs?
Step 2: Generate Architecture Document
Create a comprehensive markdown document with these sections:
Output Sections (Quick Reference)
- SYSTEM OVERVIEW
-
High-level architecture pattern (monolith, microservices, serverless)
-
How pieces connect (client → API → database → services)
-
Key architectural decisions and rationale
-
Text-based architecture diagram
- TECH STACK
Complete stack with WHY for each choice. See references/tech-stack-patterns.md for common recommendations.
- FILE & FOLDER STRUCTURE
Complete project structure with purpose of each directory. See references/file-structure-patterns.md for stack-specific examples.
- DATABASE SCHEMA
Complete schema with relationships, indexes, and key queries. See references/database-patterns.md .
- API ARCHITECTURE
All endpoints with purpose, auth, request/response formats. See references/api-patterns.md .
- STATE MANAGEMENT & DATA FLOW
Where state lives (server, client, component), data flow diagrams.
- SERVICE CONNECTIONS
How services connect (frontend → API → DB → external services), webhook handling.
- AUTHENTICATION & AUTHORIZATION
Auth flow, implementation patterns, permission model.
- KEY FEATURES IMPLEMENTATION
For each major feature: components, API calls, state, edge cases.
- DEPLOYMENT & INFRASTRUCTURE
Environment variables, deployment steps, CI/CD configuration.
- MONITORING & DEBUGGING
Error tracking, logging strategy, performance monitoring.
- SECURITY CHECKLIST
Input validation, auth, secrets, HTTPS, headers, dependencies.
Critical Principles
Be Pragmatic:
-
Start simple, scale when needed
-
Choose boring, proven tech
-
Optimize for developer velocity first
-
Clear upgrade path when you grow
Be Specific:
-
Exact package names and versions
-
Real code examples
-
Actual file paths
-
Named services (not "some auth provider")
Be Complete:
-
Every file explained
-
Every API endpoint documented
-
All states accounted for
-
Edge cases identified
Be Production-Ready:
-
Error handling included
-
Monitoring planned
-
Security considered
-
Deployment automated
Quick Stack Recommendations
Use Case Recommended Stack
MVP/Startup Next.js + Supabase + Vercel
Enterprise SaaS Next.js + PostgreSQL + Clerk + Stripe
Real-time App Next.js + Supabase Realtime + Redis
API-first Express/Fastify + PostgreSQL + Docker
Mobile App React Native + Supabase + Expo
Reference Files
For detailed patterns and examples, consult:
-
references/tech-stack-patterns.md
-
Tech choice comparisons and recommendations
-
references/file-structure-patterns.md
-
Directory structures by framework
-
references/database-patterns.md
-
Common schemas and query patterns
-
references/api-patterns.md
-
REST best practices and endpoint examples
-
references/auth-patterns.md
-
Authentication implementations
-
references/deployment-patterns.md
-
CI/CD and infrastructure patterns