๐Ÿ“… let's chat! explore the endless possibilities creating industries that don't exist. click here

windsurf-architecture-variants

Choose and implement Windsurf validated architecture blueprints for different scales. Use when designing new Windsurf integrations, choosing between monolith/service/microservice architectures, or planning migration paths for Windsurf applications. Trigger with phrases like "windsurf architecture", "windsurf blueprint", "how to structure windsurf", "windsurf project layout", "windsurf microservice". allowed-tools: Read, Grep version: 1.0.0 license: MIT author: Jeremy Longshore <jeremy@intentsolutions.io>

Allowed Tools

No tools specified

Provided by Plugin

windsurf-pack

Claude Code skill pack for Windsurf (30 skills)

saas packs v1.0.0
View Plugin

Installation

This skill is included in the windsurf-pack plugin:

/plugin install windsurf-pack@claude-code-plugins-plus

Click to copy

Instructions

# Windsurf Architecture Variants ## Overview Three validated architecture blueprints for Windsurf integrations. ## Prerequisites - Understanding of team size and DAU requirements - Knowledge of deployment infrastructure - Clear SLA requirements - Growth projections available ## Variant A: Monolith (Simple) **Best for:** MVPs, small teams, < 10K daily active users ``` my-app/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ windsurf/ โ”‚ โ”‚ โ”œโ”€โ”€ client.ts # Singleton client โ”‚ โ”‚ โ”œโ”€โ”€ types.ts # Types โ”‚ โ”‚ โ””โ”€โ”€ middleware.ts # Express middleware โ”‚ โ”œโ”€โ”€ routes/ โ”‚ โ”‚ โ””โ”€โ”€ api/ โ”‚ โ”‚ โ””โ”€โ”€ windsurf.ts # API routes โ”‚ โ””โ”€โ”€ index.ts โ”œโ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ windsurf.test.ts โ””โ”€โ”€ package.json ``` ### Key Characteristics - Single deployment unit - Synchronous Windsurf calls in request path - In-memory caching - Simple error handling ### Code Pattern ```typescript // Direct integration in route handler app.post('/api/create', async (req, res) => { try { const result = await windsurfClient.create(req.body); res.json(result); } catch (error) { res.status(500).json({ error: error.message }); } }); ``` --- ## Variant B: Service Layer (Moderate) **Best for:** Growing startups, 10K-100K DAU, multiple integrations ``` my-app/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ services/ โ”‚ โ”‚ โ”œโ”€โ”€ windsurf/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ client.ts # Client wrapper โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ service.ts # Business logic โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ repository.ts # Data access โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ types.ts โ”‚ โ”‚ โ””โ”€โ”€ index.ts # Service exports โ”‚ โ”œโ”€โ”€ controllers/ โ”‚ โ”‚ โ””โ”€โ”€ windsurf.ts โ”‚ โ”œโ”€โ”€ routes/ โ”‚ โ”œโ”€โ”€ middleware/ โ”‚ โ”œโ”€โ”€ queue/ โ”‚ โ”‚ โ””โ”€โ”€ windsurf-processor.ts # Async processing โ”‚ โ””โ”€โ”€ index.ts โ”œโ”€โ”€ config/ โ”‚ โ””โ”€โ”€ windsurf/ โ””โ”€โ”€ package.json ``` ### Key Characteristics - Separation of concerns - Background job processing - Redis caching - Circuit breaker pattern - Structured error handling ### Code Pattern ```typescript // Service layer abstraction class WindsurfService { constructor( private client: WindsurfClient, private cache: CacheService, private queue: QueueService ) {} async createResource(data: CreateInput): Promise { // Business logic before API call const validated = this.validate(data); // Check cache const cached = await this.cache.get(cacheKey); if (cached) return cached; // API call with retry const result = await this.withRetry(() => this.client.create(validated) ); // Cache result await this.cache.set(cacheKey, result, 300); // Async follow-up await this.queue.enqueue('windsurf.post-create', result); return result; } } ``` --- ## Variant C: Microservice (Complex) **Best for:** Enterprise, 100K+ DAU, strict SLAs ``` windsurf-service/ # Dedicated microservice โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ”œโ”€โ”€ grpc/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ windsurf.proto โ”‚ โ”‚ โ””โ”€โ”€ rest/ โ”‚ โ”‚ โ””โ”€โ”€ routes.ts โ”‚ โ”œโ”€โ”€ domain/ โ”‚ โ”‚ โ”œโ”€โ”€ entities/ โ”‚ โ”‚ โ”œโ”€โ”€ events/ โ”‚ โ”‚ โ””โ”€โ”€ services/ โ”‚ โ”œโ”€โ”€ infrastructure/ โ”‚ โ”‚ โ”œโ”€โ”€ windsurf/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ client.ts โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ mapper.ts โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ circuit-breaker.ts โ”‚ โ”‚ โ”œโ”€โ”€ cache/ โ”‚ โ”‚ โ”œโ”€โ”€ queue/ โ”‚ โ”‚ โ””โ”€โ”€ database/ โ”‚ โ””โ”€โ”€ index.ts โ”œโ”€โ”€ config/ โ”œโ”€โ”€ k8s/ โ”‚ โ”œโ”€โ”€ deployment.yaml โ”‚ โ”œโ”€โ”€ service.yaml โ”‚ โ””โ”€โ”€ hpa.yaml โ””โ”€โ”€ package.json other-services/ โ”œโ”€โ”€ order-service/ # Calls windsurf-service โ”œโ”€โ”€ payment-service/ โ””โ”€โ”€ notification-service/ ``` ### Key Characteristics - Dedicated Windsurf microservice - gRPC for internal communication - Event-driven architecture - Database per service - Kubernetes autoscaling - Distributed tracing - Circuit breaker per service ### Code Pattern ```typescript // Event-driven with domain isolation class WindsurfAggregate { private events: DomainEvent[] = []; process(command: WindsurfCommand): void { // Domain logic const result = this.execute(command); // Emit domain event this.events.push(new WindsurfProcessedEvent(result)); } getUncommittedEvents(): DomainEvent[] { return [...this.events]; } } // Event handler @EventHandler(WindsurfProcessedEvent) class WindsurfEventHandler { async handle(event: WindsurfProcessedEvent): Promise { // Saga orchestration await this.sagaOrchestrator.continue(event); } } ``` --- ## Decision Matrix | Factor | Monolith | Service Layer | Microservice | |--------|----------|---------------|--------------| | Team Size | 1-5 | 5-20 | 20+ | | DAU | < 10K | 10K-100K | 100K+ | | Deployment Frequency | Weekly | Daily | Continuous | | Failure Isolation | None | Partial | Full | | Operational Complexity | Low | Medium | High | | Time to Market | Fastest | Moderate | Slowest | ## Migration Path ``` Monolith โ†’ Service Layer: 1. Extract Windsurf code to service/ 2. Add caching layer 3. Add background processing Service Layer โ†’ Microservice: 1. Create dedicated windsurf-service repo 2. Define gRPC contract 3. Add event bus 4. Deploy to Kubernetes 5. Migrate traffic gradually ``` ## Instructions ### Step 1: Assess Requirements Use the decision matrix to identify appropriate variant. ### Step 2: Choose Architecture Select Monolith, Service Layer, or Microservice based on needs. ### Step 3: Implement Structure Set up project layout following the chosen blueprint. ### Step 4: Plan Migration Path Document upgrade path for future scaling. ## Output - Architecture variant selected - Project structure implemented - Migration path documented - Appropriate patterns applied ## Error Handling | Issue | Cause | Solution | |-------|-------|----------| | Over-engineering | Wrong variant choice | Start simpler | | Performance issues | Wrong layer | Add caching/async | | Team friction | Complex architecture | Simplify or train | | Deployment complexity | Microservice overhead | Consider service layer | ## Examples ### Quick Variant Check ```bash # Count team size and DAU to select variant echo "Team: $(git log --format='%ae' | sort -u | wc -l) developers" echo "DAU: Check analytics dashboard" ``` ## Resources - [Monolith First](https://martinfowler.com/bliki/MonolithFirst.html) - [Microservices Guide](https://martinfowler.com/microservices/) - [Windsurf Architecture Guide](https://docs.windsurf.com/architecture) ## Next Steps For common anti-patterns, see `windsurf-known-pitfalls`.

Skill file: plugins/saas-packs/windsurf-pack/skills/windsurf-architecture-variants/SKILL.md