Marketplace
edge-computing
Use when designing edge computing architectures, serverless at edge, or distributed compute strategies. Covers edge functions, compute placement decisions, Cloudflare Workers, Lambda@Edge, and edge-native patterns.
allowed_tools: Read, Glob, Grep
$ Installieren
git clone https://github.com/melodic-software/claude-code-plugins /tmp/claude-code-plugins && cp -r /tmp/claude-code-plugins/plugins/systems-design/skills/edge-computing ~/.claude/skills/claude-code-plugins// tip: Run this command in your terminal to install the skill
SKILL.md
name: edge-computing description: Use when designing edge computing architectures, serverless at edge, or distributed compute strategies. Covers edge functions, compute placement decisions, Cloudflare Workers, Lambda@Edge, and edge-native patterns. allowed-tools: Read, Glob, Grep
Edge Computing
Comprehensive guide to edge computing architecture - running compute closer to users for lower latency and better performance.
When to Use This Skill
- Designing edge function architectures
- Deciding where to place compute (edge vs origin)
- Implementing serverless at edge
- Understanding edge platform capabilities
- Optimizing latency-sensitive applications
- Building globally distributed applications
Edge Computing Fundamentals
What is Edge Computing?
Compute Placement Spectrum:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ User Device Edge Regional Central Origin โ
โ (Client) (CDN) (Cloud) (Cloud) (Cloud) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ โ
โ โ
โ Lowest โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Highest โ
โ Latency โ EDGE COMPUTING โ Latency โ
โ โ (This skill's focus) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Limited โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ Full โ
โ Resources Resources โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Edge = Running code on CDN/network edge servers (100s of locations)
vs Regional = Running in a few cloud regions (10-20 locations)
vs Origin = Running in one primary location (1-3 locations)
Edge vs Serverless vs Traditional
Comparison:
Edge Functions Cloud Functions Containers/VMs
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Locations 100-300+ 10-20 1-10
Cold Start <50ms 100ms-seconds N/A (always warm)
Execution Limit 10-30 seconds 15 minutes Unlimited
Memory 128MB-1GB 256MB-10GB Unlimited
CPU Limited Standard Full control
State Stateless Stateless Stateful OK
Cost Model Per request Per request Per instance
Best For Low-latency, General compute Complex apps,
simple logic long-running
Use Cases by Type:
Edge: Auth, routing, personalization, A/B tests, redirects
Cloud Functions: APIs, webhooks, background processing
Containers: Full applications, databases, ML inference
Edge Platform Architecture
Edge Platform Components:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Control Plane โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ Deploy โ โ Config โ โ Secrets โ โ Metrics โ โ
โ โ API โ โ Store โ โ Mgmt โ โ & Logs โ โ
โ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โ
โโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโ
โ โ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโงโโโโโโโโโโโโโโงโโโโโโโโโโโโโโ
โ Global Distribution โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโผโโโโ โโโโโผโโโโ โโโโโผโโโโ
โ Edge โ โ Edge โ โ Edge โ
โ POP 1 โ โ POP 2 โ โ POP N โ
โโโโโโโโโ โโโโโโโโโ โโโโโโโโโ
โโ V8 โโ โโ V8 โโ โโ V8 โโ
โโIsol.โโ โโIsol.โโ โโIsol.โโ
โโโโโโโโโ โโโโโโโโโ โโโโโโโโโ
โโโโโโโโโ โโโโโโโโโ โโโโโโโโโ
Execution Model:
- V8 Isolates: Lightweight isolation (not containers)
- Instant cold start (sub-50ms)
- Per-request execution
- Auto-scaled per POP
Edge Function Patterns
Request Interception
Request/Response Lifecycle:
User Request โโโบ Edge Function โโโบ Origin (optional)
โ
โโโโโโโโโดโโโโโโโโ
โ โ
Modify Request Short-circuit
(continue to (return response
origin) from edge)
Use Cases:
1. URL Rewriting
/old-page โ /new-page
/api/v1/* โ /api/v2/*
2. Header Manipulation
Add security headers
Add request ID
Normalize Accept-Language
3. Authentication
Validate JWT at edge
Check API key
Redirect to login
4. A/B Testing
Assign cohort
Rewrite to variant URL
5. Bot Protection
Challenge bots
Block known bad actors
6. Geolocation Routing
Route to regional origin
Apply regional rules
Response Transformation
Response Transformation Patterns:
1. HTML Injection
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Inject analytics, A/B test scripts โ
โ Add personalized content โ
โ Insert GDPR banners by region โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2. Content Optimization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Compress responses โ
โ Image optimization/resizing โ
โ Minification โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. Response Caching
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Cache API responses at edge โ
โ Assemble from cache fragments โ
โ Serve stale while revalidating โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4. Error Handling
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Fallback pages on origin error โ
โ Custom error pages per region โ
โ Retry logic with backoff โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Edge Storage Patterns
Edge Storage Options:
1. Key-Value Store (KV)
โโโ Read-heavy workloads
โโโ Eventually consistent
โโโ Low latency reads
โโโ Limited write throughput
Use: Feature flags, configuration, user sessions
2. Durable Objects (Cloudflare)
โโโ Strong consistency
โโโ Stateful edge compute
โโโ Single-instance per ID
โโโ WebSocket support
Use: Real-time collaboration, chat, gaming state
3. Edge Databases
โโโ Distributed SQL (PlanetScale, Turso)
โโโ Read replicas at edge
โโโ Low latency reads
โโโ Write to primary region
Use: User data, product catalogs, CMS
4. R2/S3-Compatible Storage
โโโ Object storage at edge
โโโ No egress fees (some providers)
โโโ Large file storage
Use: Static assets, user uploads, backups
Compute Placement Decisions
Decision Framework
Where Should This Run?
Question 1: Latency Requirements
โโโ <50ms required? โ Edge
โโโ <200ms acceptable? โ Regional cloud
โโโ Latency not critical? โ Central origin
Question 2: Compute Complexity
โโโ Simple transformations? โ Edge
โโโ Moderate logic? โ Edge or Regional
โโโ Complex processing? โ Regional or Central
Question 3: Data Dependencies
โโโ No data needed? โ Edge
โโโ Read-heavy, cacheable? โ Edge with cache
โโโ Strong consistency needed? โ Regional
โโโ Write-heavy? โ Central
Question 4: State Requirements
โโโ Stateless? โ Edge
โโโ Session state? โ Edge with KV/Durable Objects
โโโ Complex state? โ Regional or Central
Question 5: Cost Sensitivity
โโโ High request volume, simple? โ Edge (efficient)
โโโ CPU-intensive? โ Regional (cheaper)
โโโ Long-running? โ Central
Hybrid Architecture
Hybrid Edge + Origin Architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Edge Layer โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Authentication/Authorization โ โ
โ โ โข Rate limiting โ โ
โ โ โข Request routing โ โ
โ โ โข Static content โ โ
โ โ โข Simple personalization โ โ
โ โ โข Caching logic โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Only complex requests pass through
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Origin Layer โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Business logic โ โ
โ โ โข Database operations โ โ
โ โ โข Third-party integrations โ โ
โ โ โข ML inference โ โ
โ โ โข Complex computations โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Benefits:
- Offload work from origin
- Faster responses for simple requests
- Origin protected from attack traffic
- Scale each layer independently
Edge Platforms
Cloudflare Workers
Cloudflare Workers:
Execution:
- V8 isolates (not containers)
- <5ms cold start
- 200+ edge locations
- 10ms CPU time (free) / 30s (paid)
Features:
โโโ Workers KV (key-value store)
โโโ Durable Objects (stateful)
โโโ R2 (object storage)
โโโ D1 (SQLite at edge)
โโโ Queues (async processing)
โโโ Hyperdrive (database connection pooling)
Example:
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
// Simple routing
if (url.pathname.startsWith('/api/')) {
return handleAPI(request, env);
}
// Serve static
return env.ASSETS.fetch(request);
}
}
AWS Lambda@Edge / CloudFront Functions
AWS Edge Options:
CloudFront Functions:
โโโ JavaScript only
โโโ Sub-millisecond start
โโโ 2MB memory
โโโ Request/response manipulation only
โโโ Cannot make network calls
โโโ Very cheap at scale
Lambda@Edge:
โโโ Node.js, Python
โโโ 128-3008MB memory
โโโ Up to 30s execution (origin response)
โโโ Can make network calls
โโโ Access to AWS services
โโโ Higher latency than CF Functions
Use Case Mapping:
CloudFront Functions: Headers, redirects, URL rewrites
Lambda@Edge: Auth, A/B testing, dynamic responses
Lambda (Regional): Full API logic, database access
Fastly Compute@Edge
Fastly Compute@Edge:
Execution:
- WebAssembly-based (Wasm)
- Multi-language (Rust, JS, Go, etc.)
- No cold start (pre-compiled)
- 50ms-120s execution time
Features:
โโโ Geolocation data
โโโ Device detection
โโโ Real-time logging
โโโ Edge dictionaries
โโโ Origin fetch with caching
Strengths:
- Best for dynamic content
- Real-time purging
- Advanced caching control
- Strong VCL migration path
Example (Rust):
use fastly::{Request, Response};
#[fastly::main]
fn main(req: Request) -> Result<Response, Error> {
match req.get_path() {
"/api" => handle_api(req),
_ => Ok(req.send("origin")?)
}
}
Best Practices
Edge Computing Best Practices:
1. Keep It Simple
โก Edge = simple, fast operations
โก Complex logic โ origin
โก Minimize dependencies
โก Fail fast and gracefully
2. Optimize Cold Start
โก Minimize code size
โก Lazy load where possible
โก Use global scope for init
โก Avoid heavy dependencies
3. Handle Failures
โก Origin unavailable handling
โก Timeout handling
โก Fallback responses
โก Error tracking
4. Monitor Everything
โก Latency percentiles
โก Error rates
โก Cold start frequency
โก Origin fallthrough rate
5. Security
โก Validate input at edge
โก Rate limit early
โก Sanitize data
โก Use secrets management
6. Cost Optimization
โก Cache aggressively
โก Right-size execution time
โก Use appropriate tier
โก Monitor usage patterns
Anti-Patterns
Edge Computing Anti-Patterns:
1. "Everything at Edge"
โ Moving all logic to edge
โ Strategic placement based on requirements
2. "Database at Edge"
โ Complex database operations at edge
โ Read replicas or cached data at edge
3. "Ignoring Cold Starts"
โ Large bundles, heavy initialization
โ Optimize bundle size, lazy loading
4. "Origin Coupling"
โ Edge functions tightly coupled to origin
โ Edge functions should work independently when possible
5. "No Fallbacks"
โ Edge function fails = user sees error
โ Graceful degradation, cached responses
6. "Synchronous Everything"
โ Waiting for slow operations at edge
โ Async processing, fire-and-forget logging
Related Skills
cdn-architecture- CDN and caching patternsserverless-patterns- Serverless architecturelatency-optimization- End-to-end latency reductionmulti-region-deployment- Global infrastructure
Repository

melodic-software
Author
melodic-software/claude-code-plugins/plugins/systems-design/skills/edge-computing
3
Stars
0
Forks
Updated3d ago
Added1w ago