Technical architect assistant that helps design robust, scalable, and maintainable backend/frontend architectures...
Expert guidance for designing robust, scalable, and maintainable software architectures. Assists with architecture patterns, API design, tech stack selection, visual system diagrams, and best practices for modern application development.
When to use this skill:
Assess these factors first:
Scale Requirements
Team Structure
Business Constraints
Start here and follow the path:
Is this a new project or refactoring existing?
โ
โโ NEW PROJECT
โ โ
โ โโ Team size 1-3, MVP needed fast?
โ โ โโโ **MONOLITH** (Layered or Modular)
โ โ
โ โโ Multiple teams, different domains?
โ โ โโโ **MICROSERVICES**
โ โ
โ โโ Event-heavy, real-time processing?
โ โ โโโ **EVENT-DRIVEN ARCHITECTURE**
โ โ
โ โโ Variable workload, cost-sensitive?
โ โโโ **SERVERLESS**
โ
โโ REFACTORING EXISTING
โ
โโ Monolith too complex, teams blocked?
โ โโโ Gradually extract to **MICROSERVICES**
โ
โโ Tight coupling causing issues?
โ โโโ Introduce **EVENT-DRIVEN** patterns
โ
โโ Cost or scaling issues?
โโโ Migrate components to **SERVERLESS**
When to use:
Structure:
Layered Monolith:
โโ Presentation Layer (UI/API)
โโ Business Logic Layer
โโ Data Access Layer
โโ Database
Modular Monolith:
โโ User Module (domain-driven)
โโ Product Module
โโ Order Module
โโ Payment Module
โโ Shared Kernel
Pros:
Cons:
Example Stack:
When to use:
Structure:
API Gateway
โโ User Service (Node.js)
โโ Product Service (Go)
โโ Order Service (Python)
โโ Payment Service (Java)
โโ Notification Service (Serverless)
Each service:
โโ Own database
โโ Independent deployment
โโ RESTful/gRPC APIs
Pros:
Cons:
Key Patterns:
When to use:
Structure:
Event Producers โ Event Bus โ Event Consumers
โ
(Kafka/RabbitMQ)
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โ โ โ
Service A Service B Service C
Pros:
Cons:
Technologies:
When to use:
Structure:
API Gateway โ Lambda Functions โ Managed Services
โ
โโ Auth Function โ Cognito
โโ CRUD Function โ DynamoDB
โโ Processing Function โ S3
Pros:
Cons:
Providers:
| Factor | REST | GraphQL | gRPC |
|---|---|---|---|
| Best for | Simple CRUD, public APIs | Complex data fetching | Internal microservices |
| Performance | Moderate | Good (no over-fetching) | Excellent (binary) |
| Learning curve | Low | Medium | High |
| Tooling | Excellent | Good | Good |
| Caching | Native HTTP | Custom | Custom |
| Real-time | WebSocket add-on | Built-in subscriptions | Streaming RPC |
Resource naming:
GET /users # List users
POST /users # Create user
GET /users/{id} # Get user
PUT /users/{id} # Update user (full)
PATCH /users/{id} # Update user (partial)
DELETE /users/{id} # Delete user
# Nested resources
GET /users/{id}/orders # User's orders
POST /users/{id}/orders # Create order for user
Response structure:
{
"data": { /* response payload */ },
"meta": {
"page": 1,
"per_page": 20,
"total": 150
},
"links": {
"self": "/users?page=1",
"next": "/users?page=2",
"prev": null
}
}
Status codes:
200 OK - Successful GET, PUT, PATCH201 Created - Successful POST204 No Content - Successful DELETE400 Bad Request - Validation error401 Unauthorized - Missing auth403 Forbidden - Insufficient permissions404 Not Found - Resource doesn't exist500 Internal Server Error - Server failureSchema design:
type User {
id: ID!
name: String!
email: String!
orders: [Order!]!
}
type Order {
id: ID!
total: Float!
items: [OrderItem!]!
user: User!
}
type Query {
user(id: ID!): User
users(limit: Int, offset: Int): [User!]!
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(id: ID!, input: UpdateUserInput!): User!
}
type Subscription {
orderCreated: Order!
}
Pros:
Cons:
Stack: Next.js + Supabase + Vercel
Frontend: Next.js 15 (App Router)
Backend: Next.js API Routes + Supabase Edge Functions
Database: PostgreSQL (Supabase)
Auth: Supabase Auth
Storage: Supabase Storage
Hosting: Vercel (frontend), Supabase (backend)
Pros:
Cons:
Perfect for: SaaS products, web apps, MVPs
Stack: FastAPI + PostgreSQL + React + AWS
Frontend: React + Vite + TanStack Query
Backend: FastAPI (Python)
Database: PostgreSQL
Cache: Redis
Deployment: AWS ECS/Lambda + S3 + CloudFront
Pros:
Cons:
Perfect for: Data-intensive apps, ML integration, complex business logic
Stack: ASP.NET Core + SQL Server + Azure
Backend: ASP.NET Core Web API
Database: SQL Server / CosmosDB
Frontend: Blazor / React
Deployment: Azure App Service + Azure SQL
Pros:
Cons:
Perfect for: Enterprise applications, financial systems, compliance-heavy domains
graph TB
User[User]
Admin[Administrator]
subgraph "System"
API[API Gateway]
Auth[Auth Service]
App[Application Service]
DB[(Database)]
end
Ext1[Payment Gateway]
Ext2[Email Service]
User -->|HTTPS| API
Admin -->|HTTPS| API
API --> Auth
API --> App
App --> DB
App -->|REST| Ext1
App -->|SMTP| Ext2
graph LR
Client[Client Apps]
Gateway[API Gateway]
subgraph "Services"
US[User Service]
PS[Product Service]
OS[Order Service]
NS[Notification Service]
end
subgraph "Data"
UDB[(User DB)]
PDB[(Product DB)]
ODB[(Order DB)]
end
MQ[Message Queue]
Client --> Gateway
Gateway --> US
Gateway --> PS
Gateway --> OS
US --> UDB
PS --> PDB
OS --> ODB
OS --> MQ
MQ --> NS
sequenceDiagram
participant UI as User Interface
participant API as API Service
participant Queue as Event Queue
participant Process as Processing Service
participant DB as Database
participant Notify as Notification Service
UI->>API: Create Order
API->>DB: Save Order
API->>Queue: Publish OrderCreated
API-->>UI: 201 Created
Queue->>Process: OrderCreated Event
Process->>DB: Update Inventory
Process->>Queue: Publish OrderProcessed
Queue->>Notify: OrderProcessed Event
Notify->>UI: Send Email/Push
graph TD
subgraph "Presentation Layer"
UI[Web UI]
API[REST API]
end
subgraph "Business Logic Layer"
Service[Services]
Domain[Domain Models]
end
subgraph "Data Access Layer"
Repo[Repositories]
ORM[ORM/Query Builder]
end
subgraph "Infrastructure"
DB[(Database)]
Cache[(Cache)]
Queue[Message Queue]
end
UI --> Service
API --> Service
Service --> Domain
Service --> Repo
Repo --> ORM
ORM --> DB
Service --> Cache
Service --> Queue
1. Network Security
Internet โ WAF/CDN โ Load Balancer โ Private Network
โโ Web Tier (DMZ)
โโ App Tier (Private)
โโ Data Tier (Isolated)
2. Authentication & Authorization
3. Data Protection
Vertical Scaling (Scale Up):
Horizontal Scaling (Scale Out):
Multi-Level Cache:
Request โ CDN Cache โ Application Cache โ Database
(Static) (Redis/Memcached)
Cache Patterns:
Read Scaling:
Write Scaling:
src/
โโโ app/
โ โโโ (auth)/ # Route group
โ โ โโโ login/
โ โ โโโ register/
โ โโโ (dashboard)/
โ โ โโโ layout.tsx
โ โ โโโ page.tsx
โ โ โโโ settings/
โ โโโ api/
โ โ โโโ users/route.ts
โ โ โโโ auth/route.ts
โ โโโ layout.tsx # Root layout
โโโ components/
โ โโโ ui/ # shadcn components
โ โโโ forms/
โ โโโ layouts/
โโโ lib/
โ โโโ db/ # Database client
โ โโโ auth/ # Auth utilities
โ โโโ utils.ts
โโโ hooks/ # Custom React hooks
โโโ types/ # TypeScript types
app/
โโโ api/
โ โโโ __init__.py
โ โโโ dependencies.py
โ โโโ routes/
โ โโโ users.py
โ โโโ products.py
โ โโโ orders.py
โโโ core/
โ โโโ config.py
โ โโโ security.py
โ โโโ database.py
โโโ models/ # SQLAlchemy models
โ โโโ user.py
โ โโโ product.py
โโโ schemas/ # Pydantic schemas
โ โโโ user.py
โ โโโ product.py
โโโ services/ # Business logic
โ โโโ user_service.py
โ โโโ order_service.py
โโโ main.py
โโโ tests/
Principle: Each component has single responsibility.
Example:
รขลโฆ Good:
- UserController: Handle HTTP requests
- UserService: Business logic
- UserRepository: Database operations
รขล Bad:
- UserController: HTTP + business logic + database
Principle: Depend on abstractions, not concretions.
Example:
// รขลโฆ Good
interface IEmailService {
sendEmail(to: string, subject: string, body: string): Promise<void>;
}
class OrderService {
constructor(private emailService: IEmailService) {}
}
// รขล Bad
class OrderService {
constructor(private emailService: GmailService) {} // Concrete dependency
}
/users/123/orders/456/items/789)/getUserOrders, /createOrderForUser)When recommending architecture, consider:
Current State:
Requirements:
Trade-offs:
Future-Proofing:
Output: Clear recommendation with reasoning, diagrams, and migration path (if refactoring).
Request: "Design architecture for a SaaS product with 100K users"
Response includes:
Request: "Should I use REST or GraphQL for my e-commerce API?"
Response includes:
For detailed architectural patterns and examples, see: