Skip to content

Commit add5135

Browse files
authored
Update commerce-platform-modernization-log.mdx
1 parent a1d52ff commit add5135

1 file changed

Lines changed: 266 additions & 4 deletions

File tree

src/content/en-case-studies/commerce-platform-modernization-log.mdx

Lines changed: 266 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ New modules have been implemented and registered at application level:
5050
- `notifications`
5151

5252
Each module introduces:
53+
5354
- its own application layer
5455
- dedicated use cases
5556
- infrastructure repositories
@@ -78,11 +79,13 @@ Key elements:
7879
- messaging integration use cases
7980

8081
Additionally:
82+
8183
- support for account connection / disconnection
8284
- callback handling
8385
- account deletion webhook endpoint
8486

8587
Effect:
88+
8689
- integration logic is no longer embedded in domain models
8790
- clear separation between system and external provider
8891
- ready for extraction into standalone service
@@ -116,6 +119,7 @@ Architecture:
116119
- use cases for sync, read, reply, reprocess
117120

118121
Effect:
122+
119123
- messaging becomes a **first-class domain**
120124
- replaces scattered legacy communication logic
121125
- enables future multi-channel support
@@ -139,6 +143,7 @@ Key architectural elements:
139143
- separation of source data vs domain model
140144

141145
Effect:
146+
142147
- listings are no longer tightly coupled to integrations
143148
- clear path to extracting marketplace logic
144149
- better control over data ingestion lifecycle
@@ -160,6 +165,7 @@ Supported providers:
160165
- DHL
161166

162167
Effect:
168+
163169
- unified integration layer for carriers
164170
- simplified extension for new providers
165171
- elimination of scattered shipping logic
@@ -177,10 +183,12 @@ A new `notifications` module provides:
177183
- delete operations
178184

179185
Includes:
186+
180187
- dedicated UI
181188
- REST API endpoints
182189

183190
Effect:
191+
184192
- system communication becomes structured
185193
- foundation for alerts and operational signaling
186194
- separation from business workflows
@@ -203,6 +211,7 @@ Examples include:
203211
- `ShippingIntegrationPort`
204212

205213
Effect:
214+
206215
- transition from implicit dependencies to explicit architecture
207216
- strong foundation for service extraction
208217
- improved testability and maintainability
@@ -218,10 +227,12 @@ New ingestion approach introduced:
218227
- reprocess capabilities implemented
219228

220229
Present in:
230+
221231
- listings
222232
- messages
223233

224234
Effect:
235+
225236
- improved resilience to integration issues
226237
- ability to replay and debug data flows
227238
- no reliance on single-pass processing
@@ -237,6 +248,7 @@ System has been partially migrated to stateless model:
237248
- local filesystem used only as temporary workspace
238249

239250
Effect:
251+
240252
- removal of persistent local storage dependency
241253
- readiness for containerized / distributed environments
242254
- alignment with cloud-native patterns
@@ -255,6 +267,7 @@ Background processing redesigned using:
255267
- jitter (startup and iteration)
256268

257269
Effect:
270+
258271
- elimination of duplicate executions
259272
- reduced race conditions
260273
- improved observability
@@ -272,6 +285,7 @@ System runtime updated and stabilized:
272285
- improved dependency management
273286

274287
Effect:
288+
275289
- modernized execution environment
276290
- reduced technical debt
277291
- better deployment consistency
@@ -286,10 +300,12 @@ New UI introduced for:
286300
- notifications module
287301

288302
Additionally:
303+
289304
- legacy views simplified
290305
- frontend structure partially cleaned up
291306

292307
Effect:
308+
293309
- improved usability for operational users
294310
- more consistent interaction patterns
295311
- groundwork for future SPA/BFF architecture
@@ -306,6 +322,7 @@ Delivery process improved with:
306322
- structured runtime environments
307323

308324
Effect:
325+
309326
- repeatable deployments
310327
- better control over releases
311328
- preparation for scalable environments
@@ -325,14 +342,259 @@ This log will be extended with future phases.
325342

326343
---
327344

345+
## Phase: 2026-03 / 2026-05
346+
347+
### 1. From modules to contract boundaries
348+
349+
After the first phase of organizing selected modules, modernization moved toward a broader contract-driven architecture.
350+
351+
More areas of the system are no longer just folders or modules inside the monolith. Selected domains now have their own APIs, read models, ports, adapters, background processes, and intermediate layers for new consumers.
352+
353+
In practice, this means new system elements can use explicit contracts instead of directly referring to older legacy models, controllers, or tables.
354+
355+
Effect:
356+
357+
- stronger separation of responsibilities
358+
- greater readiness of selected modules for extraction
359+
- ability to connect new consumers such as Core API, MCP, and AI without bypassing domain boundaries
360+
- stronger foundation for future extraction into microservices
361+
362+
---
363+
364+
### 2. Activities module and append-only audit log
365+
366+
The `activities` area was extracted as a dedicated read module with the `activities/v1` API.
367+
368+
Implemented elements:
369+
370+
- activity list
371+
- activity details
372+
- filters endpoint
373+
- read model
374+
- mapping of legacy payloads into explicit DTOs
375+
- access limiting based on seller context
376+
- moving operational history reads behind the module boundary
377+
378+
Activity storage was then refactored toward append-only behavior.
379+
380+
Instead of treating operation history as regular mutable records, the system started using a model based on event-like writes and a current-state projection (`activities_current`).
381+
382+
Effect:
383+
384+
- the activity log became a safer audit trail
385+
- activity updates and deletes were blocked
386+
- legacy data is normalized behind the module layer
387+
- the area is prepared for further use by APIs, AI, and future services
388+
389+
---
390+
391+
### 3. Orders module and external order synchronization
392+
393+
A new `orders` boundary was created to organize synchronization and read access for external orders.
394+
395+
Implemented elements:
396+
397+
- append-only order synchronization foundation
398+
- external provider port
399+
- sync run tracking
400+
- raw payload storage for external systems
401+
- order and order-item snapshots
402+
- external references
403+
- current-state read models
404+
- internal `orders/v1` API
405+
- read-only boundary in `comers-core-api`
406+
- MCP tools for orders
407+
- dedicated external orders synchronization job in the legacy runtime
408+
409+
The eBay integration was especially important here, with movement toward the Sell Fulfillment API and support for shipping-deadline data.
410+
411+
Effect:
412+
413+
- external orders have a more durable and auditable data model
414+
- synchronization no longer relies only on a single fetch of the latest records
415+
- shipping and urgency data can be used by APIs and AI
416+
- the `orders` module became one of the most important candidates for further extraction
417+
418+
---
419+
420+
### 4. Messages evolution: AI-assisted translation and replies
421+
422+
The `messages` module was extended from synchronization and thread handling toward a multilingual, AI-assisted communication center.
423+
424+
Implemented elements:
425+
426+
- translation of individual threads
427+
- translation of thread lists
428+
- translation of message titles and content
429+
- persisted user translation-language preference
430+
- background translation worker
431+
- integration with `comers-ai-gateway`
432+
- reply composer context endpoint
433+
- suggested reply draft based on thread context
434+
- improving and composing replies based on an operator draft
435+
- translating replies into the customer’s target language
436+
- keeping the final send-reply flow as a separate explicit action
437+
438+
AI was not connected directly to the view layer or database. Translation and reply generation pass through use cases, adapters, and the capability gateway.
439+
440+
Effect:
441+
442+
- operators can handle customer messages in multiple languages
443+
- AI helps prepare replies without replacing the explicit sending process
444+
- translations can run as background work
445+
- customer communication became one of the first real AI-assisted operational areas in Comers
446+
447+
---
448+
449+
### 5. Notifications extended to Core API and MCP
450+
451+
The `notifications` module already existed in the previous modernization phase.
452+
453+
In this phase, it was extended through integration with the Core API layer and MCP tools.
454+
455+
Implemented elements:
456+
457+
- notifications facade in `comers-core-api`
458+
- MCP tools for listing notifications
459+
- notification detail reads
460+
- marking notifications as read
461+
- archiving notifications
462+
- bulk operations
463+
- propagation of trusted user context (`X-Internal-User-Id`)
464+
465+
Effect:
466+
467+
- notifications can be handled by the AI assistant without direct access to legacy
468+
- operations are executed in the context of a specific user
469+
- the existing module gained new types of consumers
470+
471+
---
472+
473+
### 6. AI layer: ChatKit, MCP, Core API, and Gateway
474+
475+
The system gained its first real operational AI support layer.
476+
477+
Implemented elements:
478+
479+
- `comers-ai-webapp`
480+
- `comers-ai-bff`
481+
- `comers-ai-chatkit`
482+
- `comers-ai-mcp`
483+
- `comers-ai-gateway`
484+
- local ChatKit runtime
485+
- conversation thread history
486+
- response streaming
487+
- MCP tools for messages, notifications, and orders
488+
- MCP integration with `comers-core-api`
489+
- capability gateway for AI operations
490+
491+
The AI assistant can now use selected system data and actions through explicit domain tools.
492+
493+
It can, among other things:
494+
495+
- read message lists and details
496+
- read notifications
497+
- read order information
498+
- use activity-log data
499+
- mark messages and notifications as read
500+
- archive messages and notifications
501+
- support preparation of customer replies
502+
503+
A key architectural decision is that AI does not bypass application boundaries.
504+
505+
Execution is based on contracts:
506+
507+
AI / ChatKit
508+
→ MCP
509+
→ Core API
510+
→ internal legacy APIs and modules
511+
512+
Effect:
513+
514+
- AI operates as a controlled system consumer
515+
- tools are limited to explicitly exposed capabilities
516+
- sensitive operations are performed in user context
517+
- a foundation was created for further agentic operations without destabilizing legacy
518+
519+
---
520+
521+
### 7. AI Gateway and capability contracts
522+
523+
`comers-ai-gateway` was introduced as an internal capability layer for AI operations.
524+
525+
Implemented capabilities:
526+
527+
- `translate.v1`
528+
- `compose_reply.v1`
529+
530+
The gateway is responsible for:
531+
532+
- hiding AI provider integration details
533+
- enforcing response structure
534+
- supporting OpenAI Responses API
535+
- persistent operations for translations
536+
- idempotent operation creation
537+
- operation-status reads
538+
- background polling through a dedicated runtime container
539+
540+
Effect:
541+
542+
- the application does not depend directly on the raw AI provider API
543+
- long-running translation operations can be handled outside the UI request-response path
544+
- AI capabilities have their own contracts and can evolve independently
545+
- the gateway became the place for future controlled AI capabilities
546+
547+
---
548+
549+
### 8. Runtime and infrastructure repository separation
550+
551+
Runtime was separated more clearly from application code.
552+
553+
Created or organized repositories:
554+
555+
- `comers-infra-ai`
556+
- `comers-infra-legacy`
557+
558+
`comers-infra-ai` covers runtime for:
559+
560+
- AI webapp
561+
- BFF
562+
- MCP
563+
- AI gateway
564+
- gateway poller
565+
- ChatKit runtime
566+
567+
`comers-infra-legacy` covers the legacy runtime as a set of containers:
568+
569+
- application
570+
- web
571+
- cyclic jobs
572+
- external order synchronization
573+
- message thread synchronization
574+
- message translation worker
575+
576+
Effect:
577+
578+
- application repositories are no longer the primary place for production runtime definitions
579+
- background processes became explicitly described runtime units
580+
- deployment, configuration, and service responsibilities are easier to manage
581+
- the architecture is more ready for further containerization and service extraction
582+
583+
---
584+
328585
## Future Phases
329586

330587
Planned areas of further transformation:
331588

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)
589+
- further extraction of selected modules into independent services
590+
- development of `comers-core-api` as a stable contract layer
591+
- expansion of MCP with additional domain tools
592+
- further strengthening of trusted user context for AI-executed operations
593+
- development of `comers-ai-gateway` with additional capabilities
594+
- further separation of marketplace and shipping integrations
595+
- replacement of part of the legacy job model with event-driven architecture
596+
- deeper separation of frontend (SPA / BFF)
597+
- gradual movement of additional areas into independent runtimes
336598

337599
---
338600

0 commit comments

Comments
 (0)