Overview
Migrated a Swedish marketplace platform from Vercel to Kubernetes, eliminating vendor lock-in and reducing monthly infrastructure costs from 10,000 SEK to 2,000 SEK—an 80% cost reduction.
Industry
E-Commerce & Marketplace
Offering
Cloud Migration & Infrastructure Cost Optimization
Business Challenges
A rapidly growing Swedish marketplace company was facing unsustainable infrastructure costs that threatened profitability:
- Excessive Cloud Costs: Paying 10,000 SEK (~$950 USD) monthly for Vercel alone, with costs increasing by 30% month-over-month
- Unoptimized Bundles: Frontend applications had massive JavaScript bundles (3-5MB) causing slow load times and high bandwidth costs
- Expensive Serverless Functions: Node.js APIs deployed as Vercel serverless functions with high invocation costs
- Cache Storage Explosion: Poor caching strategies generated terabytes of unnecessary cache data at premium Vercel storage rates
- Vendor Lock-in: Heavy dependency on Vercel-specific libraries made migration seem impossible to internal team
- Scalability Concerns: As traffic grew, costs were scaling linearly without business justification
- Limited Control: Lack of infrastructure control made optimization and custom configurations difficult
Business Requirements
The client needed immediate cost reduction without compromising performance or availability:
- Reduce Infrastructure Costs: Cut Vercel costs by at least 60-70% within 2 months
- Maintain Performance: Ensure migration doesn't negatively impact page load times or API response times
- Remove Vendor Lock-in: Eliminate dependency on Vercel-specific libraries for future flexibility
- Zero Downtime: Execute migration without service interruption to customers
- Optimize Applications: Fix bundle sizes and caching issues as part of migration
- Leverage Existing Infrastructure: Utilize their existing Kubernetes cluster already running some services
- Enable Team Independence: Provide documentation and training so internal team can manage infrastructure
The Challenge
The client approached us in a difficult position. Their CFO had flagged infrastructure costs as unsustainable, but their technical team had attempted migration for 6 weeks without success:
The Problem:
- Multiple frontend applications (React/Next.js) and Node.js backends all tightly coupled with Vercel
- Vercel-specific libraries deeply integrated throughout the codebase:
- `@vercel/build-utils` for build processes
- `@vercel/node` for serverless function handling
- Vercel Edge Functions for some API routes
- Vercel-specific environment variable handling
- Custom Vercel routing configurations
- Internal team lacked expertise in Kubernetes deployment for frontend applications
- No proper build optimization - bundles included unused dependencies, duplicate code, and unminified assets
- Caching configuration generated excessive edge cache data (100GB+ monthly)
- Serverless functions were triggering millions of cold starts monthly
Business Impact:
- 10,000 SEK/month was 15% of their entire operational budget
- Costs projected to reach 20,000 SEK/month within 6 months at current growth rate
- Pressure from investors to achieve profitability requiring aggressive cost cutting
- Engineering team morale affected by failed migration attempts
- Fear of downtime preventing aggressive action
Technical Complexity:
- 5 separate frontend applications with shared dependencies
- 8 Node.js API services with varying traffic patterns
- Complex CI/CD pipelines built around Vercel's deployment model
- No containerization experience for frontend applications
- Kubernetes cluster existed but only used for backend databases
Our Solution
We executed a systematic migration and optimization strategy over 8 weeks:
Phase 1: Analysis & Audit (Week 1)
- Conducted comprehensive cost analysis of Vercel usage across all services
- Identified main cost drivers:
- Bandwidth: 40% of cost (due to large bundles)
- Serverless invocations: 35% of cost
- Edge cache storage: 20% of cost
- Build minutes: 5% of cost
- Analyzed bundle sizes and identified optimization opportunities
- Mapped Vercel library usage across all applications
- Assessed existing Kubernetes cluster capacity and requirements
Phase 2: Bundle Optimization (Weeks 2-3)
- Implemented webpack bundle analysis for all frontend apps
- Removed unused dependencies reducing bundle sizes by 60-70%
- Implemented code splitting and lazy loading for routes
- Configured tree shaking to eliminate dead code
- Set up proper minification and compression (Brotli/Gzip)
- Optimized image assets with Next.js Image Optimization alternatives
- Results: Bundle sizes reduced from 3-5MB to 800KB-1.2MB
Phase 3: Vercel Library Decoupling (Weeks 3-4)
- Replaced Vercel-specific build tools with standard Webpack/Babel configurations
- Created custom Babel presets replicating Vercel's React optimization
- Converted Vercel serverless functions to standard Express.js applications
- Replaced `@vercel/node` with native Node.js HTTP handling
- Implemented custom routing to replace Vercel Edge Network routing
- Standardized environment variable handling with dotenv
- Created deployment scripts independent of Vercel CLI
Phase 4: Containerization (Week 5)
- Created optimized Docker images for all frontend applications
- Multi-stage builds for minimal image sizes (from 1.2GB to 180MB)
- NGINX as static file server for production builds
- Proper layer caching for faster builds
- Containerized Node.js services with PM2 for process management
- Established Docker registry on existing infrastructure
- Implemented health check endpoints for container orchestration
Phase 5: Kubernetes Deployment (Weeks 6-7)
- Created Kubernetes manifests (Deployments, Services, Ingress) for all applications
- Configured NGINX Ingress Controller with proper SSL/TLS termination
- Implemented Horizontal Pod Autoscaler (HPA) based on CPU/memory metrics
- Set up proper resource limits and requests for cost control
- Configured persistent volumes for shared assets
- Implemented blue-green deployment strategy for zero-downtime migrations
- Deployed to staging environment and conducted thorough testing
Phase 6: Migration & Monitoring (Week 8)
- Executed gradual traffic migration using DNS-based routing (10% → 50% → 100%)
- Monitored performance metrics, error rates, and user experience continuously
- Fine-tuned Kubernetes configurations based on real traffic patterns
- Decommissioned Vercel services after successful validation
- Set up cost monitoring and alerting for new infrastructure
- Documented entire infrastructure and trained internal team
Actinode Solution Approach
Our approach combined DevOps expertise with practical cost optimization strategies:
Vendor Lock-in Elimination:
- Systematically identified and replaced every Vercel-specific dependency
- Created migration playbook reusable for future platform changes
- Implemented industry-standard tools ensuring portability
Smart Optimization:
- Bundle analysis revealed 60% of code was unused libraries
- Implemented aggressive code splitting reducing initial load by 70%
- Custom Babel configuration matched Vercel's optimization without vendor lock-in
Kubernetes Expertise:
- Designed production-grade Kubernetes architecture
- Implemented auto-scaling preventing over-provisioning
- Zero-downtime migration strategy with gradual traffic shifting
Cost Consciousness:
- Every decision evaluated for cost impact
- Right-sized resources based on actual usage patterns
- Eliminated unnecessary caching overhead
Knowledge Transfer:
- Comprehensive documentation of entire infrastructure
- Hands-on training sessions for internal DevOps team
- Created runbooks for common operations and troubleshooting
Conclusion
This migration project transformed an unsustainable cost structure into a lean, efficient infrastructure while simultaneously improving performance and eliminating vendor lock-in. The 80% cost reduction directly contributed to the company's path to profitability and demonstrated that smart architecture decisions can deliver immediate business value.
Future Enhancements
Planned enhancements include implementing CDN for static assets, exploring spot instances for additional cost savings, and setting up multi-region Kubernetes clusters for global expansion.