Skip to content

Vue 3 Migration Plan - Side-by-Side Approach #725

Description

@Tim020

Vue 3 Migration Plan - Side-by-Side Approach

Overview

Migrate DigiScript's frontend from Vue 2.7.14 to Vue 3 using a side-by-side approach where we build a new client-vue3/ directory alongside the existing Vue 2 client.

Migration Strategy

Side-by-Side Benefits

  • Zero downtime: Existing Vue 2 application continues running
  • Gradual migration: Features can be migrated incrementally
  • Easy rollback: Can switch back to Vue 2 if issues arise
  • A/B testing: Users can test new UI alongside old
  • Reduced risk: No single massive migration event

Architecture

DigiScript/
├── client/          # Vue 2 (existing)
├── client-vue3/     # Vue 3 (new)
└── server/          # Backend (unchanged)

Current Vue 2 Analysis

Dependencies to Migrate

Current (Vue 2) Vue 3 Target Migration Complexity
Vue 2.7.14 Vue 3.4+ ✅ Straightforward
Vue Router 3.6.5 Vue Router 4+ ⚠️ Breaking changes
Vuex 3.6.2 Pinia (recommended) 🔄 API changes
BootstrapVue 2.23.1 PrimeVue/Quasar ⚠️ Component rewrite needed
Vuelidate 0.7.7 @vuelidate/core 2+ ⚠️ API changes
vue-native-websocket Custom composable 🔄 Custom implementation

Critical WebSocket Integration

Current implementation in main.js:30-61:

  • Custom message handler with OP/ACTION routing
  • Vuex store integration
  • Automatic reconnection
  • UUID-based client tracking

Migration Priority: WebSocket functionality is critical for live shows and must be migrated carefully.

Vuex Store Structure

Current modules requiring migration:

  • websocket - WebSocket state management (CRITICAL)
  • user - Authentication and RBAC (HIGH)
  • system - Configuration and settings (MEDIUM)
  • show - Core business logic (HIGH)
  • script - Script management (HIGH)
  • scriptConfig - Script configuration (MEDIUM)

Component Structure

  • 18 Views: Mix of simple and complex components
  • 22 Components: Reusable components with varying complexity
  • Complex Components: Script editor, live script viewer, RBAC management

Implementation Phases

Phase 1: Foundation (Week 1-2)

  • Create client-vue3/ directory structure
  • Set up Vite 5+ build system with Vue 3.4+
  • Configure TypeScript (recommended)
  • Basic app shell and routing

Phase 2: State Management (Week 3-4)

  • Set up Pinia stores
  • Migrate WebSocket integration (CRITICAL)
  • Migrate user authentication store
  • Create custom WebSocket composable

Phase 3: Core Components (Week 5-8)

  • Choose UI framework (PrimeVue recommended)
  • Migrate layout components (App.vue, navigation)
  • Migrate authentication views
  • Implement Vue Router 4 with guards

Phase 4: Show Management (Week 9-12)

  • Migrate show configuration views
  • Implement RBAC permission system
  • Migrate cast, characters, acts, scenes views
  • Test complex permission logic

Phase 5: Advanced Features (Week 13-16)

  • Migrate script editor components
  • Implement cue management system
  • Migrate live show functionality
  • Real-time script following with WebSocket

Phase 6: Testing & Deployment (Week 17-20)

  • Comprehensive testing (unit, integration, e2e)
  • Performance optimization
  • Production deployment setup
  • Gradual user migration

Technical Considerations

WebSocket Migration

Current pattern requires careful migration:

// Vue 2 (current)
Vue.use(VueNativeSock, websocketURL, {
  store,
  passToStoreHandler(eventName, event, next) {
    // Custom OP/ACTION message routing
  }
});

// Vue 3 (target)  
const useWebSocket = () => {
  // Custom composable with Pinia integration
  // Maintain OP/ACTION routing compatibility
};

RBAC Complexity

Complex bitwise permission checking in store getters:

  • IS_ADMIN_USER, IS_SHOW_EDITOR, IS_SHOW_READER
  • IS_SHOW_EXECUTOR, IS_SCRIPT_EDITOR, IS_CUE_EDITOR
  • Nested permission logic with show-specific access

Router Guards

Complex authentication logic in router/index.js:125-235:

  • Multi-level permission checking
  • RBAC integration
  • Show access validation
  • WebSocket health verification

Risk Mitigation

Critical Risks

  1. WebSocket Integration: Core to live show functionality
    • Mitigation: Prioritize WebSocket migration, extensive testing
  2. RBAC Permissions: Complex business logic
    • Mitigation: Comprehensive permission testing, user acceptance testing
  3. Real-time Features: Script synchronization across clients
    • Mitigation: Multi-client testing scenarios

Deployment Strategy

  • Serve both versions from server
  • URL routing: / (Vue 2), /v3/ (Vue 3)
  • Feature flags for gradual rollout
  • Rollback capability maintained

Success Criteria

  • 100% feature parity with Vue 2 version
  • All WebSocket functionality working correctly
  • RBAC permissions identical to current system
  • Performance ≥ current Vue 2 application
  • Zero data loss during migration
  • Successful multi-client live show testing

Next Steps

  1. Get stakeholder approval for side-by-side approach
  2. Set up development environment with client-vue3/
  3. Begin Phase 1: Foundation setup
  4. Establish testing strategy for critical WebSocket features

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions