Back to Blog
ArchitectureMigrationWordPressMicroservicesDevOps

Migrating from WordPress to Microservices: Lessons Learned

Our experience migrating Prima Bilvård from a monolithic WordPress site to a modern microservices architecture, and the lessons we learned along the way.

Retro87 Team
January 10, 2025

Migrating from WordPress to Microservices: Lessons Learned

WordPress powers over 40% of the web, but as businesses scale, its monolithic architecture can become a bottleneck. We recently migrated Prima Bilvård from WordPress to a modern microservices architecture, supporting multiple service verticals while improving performance and maintainability.

Why Migrate from WordPress?

WordPress is excellent for content-heavy sites, but struggles with:

  • Complex business logic - PHP templating doesn't scale for sophisticated applications
  • Performance bottlenecks - Database queries become expensive with custom post types
  • Scalability limitations - Vertical scaling has limits, horizontal scaling is complex
  • Integration challenges - Third-party services require plugins or custom code
  • Developer experience - Modern frameworks offer better tooling and workflows

The Challenge

Prima Bilvård's WordPress site handled:

  • Car care bookings
  • B2B wheel sales
  • B2C wheel marketplace
  • Roadside assistance dispatch
  • Customer membership management

This complexity in WordPress led to:

  • 5+ second page load times
  • Frequent plugin conflicts
  • Difficult-to-maintain custom code
  • Scaling issues during peak traffic

Migration Strategy

Phase 1: Assessment & Planning

Audit existing functionality:

  • Document all WordPress features
  • Identify custom post types and taxonomies
  • Map database schema
  • Catalog integrations and plugins

Define target architecture:

  • Separate services by business domain
  • Choose technology stack per service
  • Plan data migration strategy
  • Design API contracts

Phase 2: Build Parallel System

Rather than migrating in place, we built a new system alongside WordPress:

WordPress (legacy) ← Still serving traffic
     ↓
Migration Layer ← Data sync
     ↓
Microservices (new) ← Gradual rollout

Benefits of parallel systems:

  • Zero downtime migration
  • Easy rollback if issues arise
  • Gradual feature migration
  • A/B testing capabilities

Phase 3: Service-by-Service Migration

We migrated one service at a time, validating before moving to the next:

Service 1: Booking System

Tech stack:

  • Node.js + Express for API
  • PostgreSQL for relational data
  • Redis for caching and sessions
  • React for admin interface

Migration steps:

  1. Export WordPress booking data
  2. Transform to new schema
  3. Deploy new booking service
  4. Route new bookings to new system
  5. Monitor for issues
  6. Decommission WordPress booking code

Service 2: Payment Processing

Tech stack:

  • Stripe API integration
  • Event-driven architecture
  • Webhook handling
  • Automated invoicing

Key improvements:

  • Native Stripe integration (vs WordPress plugin)
  • Tap to Pay on iPhone support
  • Automated subscription management
  • Better error handling and logging

Phase 4: Data Migration

Challenge: Migrating years of WordPress data without downtime.

Solution:

// Incremental migration script
async function migrateData() {
  const batches = splitIntoBatches(wordpressData, 1000);
  
  for (const batch of batches) {
    await transformAndInsert(batch);
    await validateDataIntegrity(batch);
    logProgress(batch);
  }
}

Validation strategy:

  • Compare record counts
  • Spot-check random samples
  • Verify foreign key relationships
  • Test critical user journeys

Phase 5: Frontend Migration

Moved from WordPress themes to modern frontends:

  • Customer App: SwiftUI (iOS native)
  • Admin Portal: React + TypeScript
  • Public Website: Next.js for SEO

Technical Architecture

Before (WordPress):

┌─────────────────────┐
│   WordPress Core    │
├─────────────────────┤
│  Custom Plugins     │
│  - Bookings         │
│  - Payments         │
│  - Memberships      │
│  - B2B Portal       │
├─────────────────────┤
│   MySQL Database    │
└─────────────────────┘

After (Microservices):

┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│   Booking    │  │   Payment    │  │  Membership  │
│   Service    │  │   Service    │  │   Service    │
│  (Node.js)   │  │  (Node.js)   │  │  (Node.js)   │
├──────────────┤  ├──────────────┤  ├──────────────┤
│ PostgreSQL   │  │ PostgreSQL   │  │ PostgreSQL   │
└──────────────┘  └──────────────┘  └──────────────┘
       │                 │                  │
       └─────────────────┴──────────────────┘
                         │
                  ┌──────────────┐
                  │  API Gateway │
                  └──────────────┘

Performance Improvements

Before Migration:

  • Average page load: 5.2 seconds
  • Database queries per page: 80+
  • Time to first byte: 1.8 seconds
  • Concurrent users: ~200

After Migration:

  • Average API response: 120ms
  • Database queries per request: 2-3
  • Time to first byte: 180ms
  • Concurrent users: 2000+

Lessons Learned

1. Don't Migrate Everything

WordPress is still excellent for:

  • Blog/content pages
  • Marketing sites
  • SEO-focused landing pages

We kept WordPress for the public blog, only migrating application logic.

2. Plan for Data Inconsistencies

WordPress data is often messy:

  • Inconsistent custom field naming
  • Missing foreign key constraints
  • Duplicate records
  • Orphaned meta data

Build robust data cleaning into your migration scripts.

3. Service Boundaries Matter

Bad service split:

- Frontend Service
- Backend Service

Good service split:

- Booking Service
- Payment Service
- Notification Service
- User Service

Domain-driven design prevents tight coupling.

4. Invest in Monitoring

Before migrating, implement:

  • APM (Application Performance Monitoring)
  • Error tracking (Sentry, Rollbar)
  • Logging infrastructure (ELK stack)
  • Uptime monitoring

5. Automate Everything

Manual deployments don't scale with multiple services:

# CI/CD pipeline
- Run tests
- Build Docker images
- Push to registry
- Deploy to staging
- Run integration tests
- Deploy to production
- Monitor for errors

6. Plan for Rollback

Every migration step needs a rollback strategy:

const migrationSteps = [
  {
    forward: () => migrateBookings(),
    backward: () => rollbackBookings(),
  },
  {
    forward: () => migratePayments(),
    backward: () => rollbackPayments(),
  },
];

Cost Comparison

WordPress Infrastructure:

  • Managed WordPress hosting: $200/month
  • Plugin licenses: $500/year
  • Developer maintenance: 20 hours/month
  • Total monthly cost: ~$1,800

Microservices Infrastructure:

  • AWS/DigitalOcean hosting: $400/month
  • Monitoring tools: $100/month
  • Developer maintenance: 10 hours/month
  • Total monthly cost: ~$1,500

Plus improved:

  • Scalability
  • Developer velocity
  • System reliability
  • Feature development speed

Migration Timeline

Total duration: 4 months

  • Month 1: Planning, architecture design, infrastructure setup
  • Month 2: Build booking service, begin data migration
  • Month 3: Build payment service, migrate integrations
  • Month 4: Frontend development, testing, gradual rollout

Conclusion

Migrating from WordPress to microservices is not trivial, but for complex applications, the benefits are substantial:

  • 10x performance improvement
  • 50% reduction in maintenance time
  • Unlimited scalability
  • Better developer experience

The key is careful planning, incremental migration, and maintaining the ability to rollback at every step.


Considering a WordPress migration? Let's discuss your requirements and create a migration strategy that minimizes risk while maximizing ROI.

Need help with your project?

We solve complex technical challenges in production. Let's discuss how we can help.

Start a Conversation