|
| 1 | +--- |
| 2 | +title: Commerce Platform Modernization – Architecture Evolution Log |
| 3 | +summary: Detailed technical log of the modernization process of a legacy Yii2-based commerce platform, including modules, integrations, and architectural transformation. |
| 4 | +slug: commerce-platform-modernization-log |
| 5 | +category: architecture |
| 6 | +tags: ["legacy modernization", "yii2", "microservices", "architecture", "integration", "stateless"] |
| 7 | +--- |
| 8 | + |
| 9 | +# Architecture Evolution & Modernization Log |
| 10 | + |
| 11 | +This document provides a **detailed, technical view** of the modernization process applied to a legacy commerce platform. |
| 12 | + |
| 13 | +It reflects **real production changes**, implemented incrementally on a live system. |
| 14 | + |
| 15 | +This is not a conceptual redesign — |
| 16 | +this is an **active system transformation under real operational constraints**. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Overview |
| 21 | + |
| 22 | +The original system was a **Yii2-based monolithic platform** responsible for: |
| 23 | + |
| 24 | +- order management |
| 25 | +- marketplace integrations (eBay, Amazon, WooCommerce, Baselinker) |
| 26 | +- listings |
| 27 | +- shipping |
| 28 | +- invoicing and reporting |
| 29 | +- background job processing |
| 30 | + |
| 31 | +The modernization strategy focuses on: |
| 32 | + |
| 33 | +- introducing **clear domain boundaries** |
| 34 | +- restructuring code into **modular architecture** |
| 35 | +- replacing implicit dependencies with **explicit contracts** |
| 36 | +- preparing the system for **gradual extraction into services** |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Phase: 2026-02 |
| 41 | + |
| 42 | +### 1. Domain Modules Introduced |
| 43 | + |
| 44 | +New modules have been implemented and registered at application level: |
| 45 | + |
| 46 | +- `ebay` |
| 47 | +- `messages` |
| 48 | +- `listings` |
| 49 | +- `shipping` |
| 50 | +- `notifications` |
| 51 | + |
| 52 | +Each module introduces: |
| 53 | +- its own application layer |
| 54 | +- dedicated use cases |
| 55 | +- infrastructure repositories |
| 56 | +- integration adapters |
| 57 | +- isolated responsibility boundaries |
| 58 | + |
| 59 | +This marks a transition from a **flat monolith** to a **modular monolith with explicit structure**. |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +### 2. eBay Integration Redesign |
| 64 | + |
| 65 | +A new integration module has been implemented supporting: |
| 66 | + |
| 67 | +- eBay Trading API (legacy) |
| 68 | +- eBay REST API (modern) |
| 69 | + |
| 70 | +Key elements: |
| 71 | + |
| 72 | +- `EbayIntegrationPort` (application contract) |
| 73 | +- `LocalEbayIntegrationAdapter` |
| 74 | +- `HttpEbayIntegrationAdapter` |
| 75 | +- OAuth authorization flows |
| 76 | +- token exchange use cases |
| 77 | +- listing import use cases |
| 78 | +- messaging integration use cases |
| 79 | + |
| 80 | +Additionally: |
| 81 | +- support for account connection / disconnection |
| 82 | +- callback handling |
| 83 | +- account deletion webhook endpoint |
| 84 | + |
| 85 | +Effect: |
| 86 | +- integration logic is no longer embedded in domain models |
| 87 | +- clear separation between system and external provider |
| 88 | +- ready for extraction into standalone service |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +### 3. Messages Module (Conversation Layer) |
| 93 | + |
| 94 | +A new `messages` module has been introduced with: |
| 95 | + |
| 96 | +- thread-based message model |
| 97 | +- conversation handling |
| 98 | +- dedicated UI |
| 99 | +- REST API endpoints |
| 100 | + |
| 101 | +Capabilities include: |
| 102 | + |
| 103 | +- listing threads |
| 104 | +- fetching thread messages |
| 105 | +- sending replies |
| 106 | +- marking as read |
| 107 | +- archiving / restoring |
| 108 | +- resync and reprocess flows |
| 109 | + |
| 110 | +Architecture: |
| 111 | + |
| 112 | +- `MessagesChannelPort` |
| 113 | +- eBay adapter for messaging |
| 114 | +- raw payload repository |
| 115 | +- domain repository |
| 116 | +- use cases for sync, read, reply, reprocess |
| 117 | + |
| 118 | +Effect: |
| 119 | +- messaging becomes a **first-class domain** |
| 120 | +- replaces scattered legacy communication logic |
| 121 | +- enables future multi-channel support |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +### 4. Listings Module |
| 126 | + |
| 127 | +The `listings` module introduces: |
| 128 | + |
| 129 | +- dedicated API layer |
| 130 | +- import / upsert / reprocess endpoints |
| 131 | +- product linking |
| 132 | +- external data ingestion flow |
| 133 | + |
| 134 | +Key architectural elements: |
| 135 | + |
| 136 | +- source provider registry |
| 137 | +- external payload repository |
| 138 | +- ingestion services |
| 139 | +- separation of source data vs domain model |
| 140 | + |
| 141 | +Effect: |
| 142 | +- listings are no longer tightly coupled to integrations |
| 143 | +- clear path to extracting marketplace logic |
| 144 | +- better control over data ingestion lifecycle |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +### 5. Shipping Module (Carrier Integrations) |
| 149 | + |
| 150 | +A new `shipping` module has been implemented with: |
| 151 | + |
| 152 | +- `ShippingIntegrationPort` |
| 153 | +- local and HTTP adapters |
| 154 | +- dispatcher for label creation |
| 155 | +- provider-based architecture |
| 156 | + |
| 157 | +Supported providers: |
| 158 | + |
| 159 | +- DPD |
| 160 | +- DHL |
| 161 | + |
| 162 | +Effect: |
| 163 | +- unified integration layer for carriers |
| 164 | +- simplified extension for new providers |
| 165 | +- elimination of scattered shipping logic |
| 166 | + |
| 167 | +--- |
| 168 | + |
| 169 | +### 6. Notifications Module |
| 170 | + |
| 171 | +A new `notifications` module provides: |
| 172 | + |
| 173 | +- notification listing |
| 174 | +- counters |
| 175 | +- read / read-all |
| 176 | +- archive / unarchive |
| 177 | +- delete operations |
| 178 | + |
| 179 | +Includes: |
| 180 | +- dedicated UI |
| 181 | +- REST API endpoints |
| 182 | + |
| 183 | +Effect: |
| 184 | +- system communication becomes structured |
| 185 | +- foundation for alerts and operational signaling |
| 186 | +- separation from business workflows |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +### 7. Ports & Adapters Architecture |
| 191 | + |
| 192 | +Across modules, the system introduces: |
| 193 | + |
| 194 | +- application ports (interfaces/contracts) |
| 195 | +- infrastructure adapters (local / HTTP) |
| 196 | +- use case-driven orchestration |
| 197 | +- repository abstraction |
| 198 | + |
| 199 | +Examples include: |
| 200 | + |
| 201 | +- `EbayIntegrationPort` |
| 202 | +- `MessagesChannelPort` |
| 203 | +- `ShippingIntegrationPort` |
| 204 | + |
| 205 | +Effect: |
| 206 | +- transition from implicit dependencies to explicit architecture |
| 207 | +- strong foundation for service extraction |
| 208 | +- improved testability and maintainability |
| 209 | + |
| 210 | +--- |
| 211 | + |
| 212 | +### 8. Raw-First Ingestion Model |
| 213 | + |
| 214 | +New ingestion approach introduced: |
| 215 | + |
| 216 | +- external data stored as raw payloads |
| 217 | +- domain processing separated from fetching |
| 218 | +- reprocess capabilities implemented |
| 219 | + |
| 220 | +Present in: |
| 221 | +- listings |
| 222 | +- messages |
| 223 | + |
| 224 | +Effect: |
| 225 | +- improved resilience to integration issues |
| 226 | +- ability to replay and debug data flows |
| 227 | +- no reliance on single-pass processing |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +### 9. Stateless Artifact Handling (Object Storage) |
| 232 | + |
| 233 | +System has been partially migrated to stateless model: |
| 234 | + |
| 235 | +- courier labels stored in object storage (S3-compatible) |
| 236 | +- reports generated as downloadable artifacts (signed URLs) |
| 237 | +- local filesystem used only as temporary workspace |
| 238 | + |
| 239 | +Effect: |
| 240 | +- removal of persistent local storage dependency |
| 241 | +- readiness for containerized / distributed environments |
| 242 | +- alignment with cloud-native patterns |
| 243 | + |
| 244 | +--- |
| 245 | + |
| 246 | +### 10. Job Runtime Stabilization |
| 247 | + |
| 248 | +Background processing redesigned using: |
| 249 | + |
| 250 | +- Docker-based job containers |
| 251 | +- shared runtime wrapper |
| 252 | +- MySQL advisory locks (distributed locking) |
| 253 | +- timeout control |
| 254 | +- structured logging |
| 255 | +- jitter (startup and iteration) |
| 256 | + |
| 257 | +Effect: |
| 258 | +- elimination of duplicate executions |
| 259 | +- reduced race conditions |
| 260 | +- improved observability |
| 261 | +- safer batch processing |
| 262 | + |
| 263 | +--- |
| 264 | + |
| 265 | +### 11. Runtime & Configuration Cleanup |
| 266 | + |
| 267 | +System runtime updated and stabilized: |
| 268 | + |
| 269 | +- PHP upgraded to 8.1 (with preparation for newer versions) |
| 270 | +- environment-based configuration (.env) |
| 271 | +- removal of hardcoded credentials |
| 272 | +- improved dependency management |
| 273 | + |
| 274 | +Effect: |
| 275 | +- modernized execution environment |
| 276 | +- reduced technical debt |
| 277 | +- better deployment consistency |
| 278 | + |
| 279 | +--- |
| 280 | + |
| 281 | +### 12. UI Improvements |
| 282 | + |
| 283 | +New UI introduced for: |
| 284 | + |
| 285 | +- messages module |
| 286 | +- notifications module |
| 287 | + |
| 288 | +Additionally: |
| 289 | +- legacy views simplified |
| 290 | +- frontend structure partially cleaned up |
| 291 | + |
| 292 | +Effect: |
| 293 | +- improved usability for operational users |
| 294 | +- more consistent interaction patterns |
| 295 | +- groundwork for future SPA/BFF architecture |
| 296 | + |
| 297 | +--- |
| 298 | + |
| 299 | +### 13. CI/CD & Delivery Improvements |
| 300 | + |
| 301 | +Delivery process improved with: |
| 302 | + |
| 303 | +- CI pipelines |
| 304 | +- versioned releases |
| 305 | +- container image builds |
| 306 | +- structured runtime environments |
| 307 | + |
| 308 | +Effect: |
| 309 | +- repeatable deployments |
| 310 | +- better control over releases |
| 311 | +- preparation for scalable environments |
| 312 | + |
| 313 | +--- |
| 314 | + |
| 315 | +### 14. Documentation & Ongoing Evolution |
| 316 | + |
| 317 | +The modernization is supported by: |
| 318 | + |
| 319 | +- evolving technical documentation |
| 320 | +- architecture notes |
| 321 | +- runtime specifications |
| 322 | +- migration planning |
| 323 | + |
| 324 | +This log will be extended with future phases. |
| 325 | + |
| 326 | +--- |
| 327 | + |
| 328 | +## Future Phases |
| 329 | + |
| 330 | +Planned areas of further transformation: |
| 331 | + |
| 332 | +- extraction of selected modules into services |
| 333 | +- further isolation of integrations |
| 334 | +- replacement of legacy job model with event-driven architecture |
| 335 | +- deeper separation of frontend (SPA/BFF) |
| 336 | + |
| 337 | +--- |
| 338 | + |
| 339 | +## Related Resources |
| 340 | + |
| 341 | +- Main case study: `/case-studies/commerce-platform-modernization` |
| 342 | +- Architecture showcase (GitHub): |
| 343 | + https://github.com/rocketdeploy-dev/showcase-commerce-platform-modernization |
| 344 | + |
| 345 | +--- |
| 346 | + |
| 347 | +This document reflects **real system evolution**, not a theoretical redesign. |
0 commit comments