Skip to main content

Software Sushi JournalArchitecture & cloud modernization

Modernize a Legacy Platform for AI Without a Full Rewrite

Attach AI behind clean read seams, async queues, and VPC data boundaries so your working core keeps shipping while you prove value.

Weathered dark-slate stone joined through a copper and terracotta architectural seam to a matte verdigris-teal modular block on warm limestone.

Interactive architecture path

Four steps from a legacy core to a safe AI slice

Select each stage to inspect how writes, permissions, latency, and spend stay isolated from your core platform. The stages show a reference architecture.

Modernization seam stage

Leave the transactional core intact

Keep billing, auth, and primary tables inside the existing application. Expose one read-only view, replica, or outbox table where the new capability attaches without schema risk.

Control boundary
Legacy system owns all core writes
Artifact passed forward
Versioned read contract or outbox event

You do not need to rewrite a working platform before you add AI to it. Most teams stall when they tie a new AI capability to a full schema, framework, and cloud migration. A faster, safer path is to cut one narrow seam beside the existing core, isolate reads and inference behind a boundary, and prove the workflow on real traffic before touching critical transactions.

Teams running established products in healthcare, insurance, payments, or field operations rarely have the option to freeze the roadmap for a year. Customers rely on the existing billing rules, integrations, and reports. When you treat AI adoption as a full platform replacement, you inherit every legacy edge case before the first model output reaches a user.

Why full rewrites stall AI roadmaps

A big-bang rewrite mixes two separate kinds of uncertainty. Software migration risk comes from undocumented business rules, partner webhooks, and hidden data invariants built up over years. AI product risk comes from retrieval quality, model accuracy, latency, and whether users trust the output.

When both risks sit in the same project plan, neither can be measured early. Engineering spends months rebuilding auth, admin screens, and billing parity while the AI use case stays on a slide deck. If the model misses the accuracy bar at cutover, the team has already spent the budget on infrastructure parity.

The alternative follows Martin Fowler's strangler fig pattern (and AWS Prescriptive Guidance's transform, coexist, and eliminate lifecycle): place a clean boundary around one high-friction workflow, build the new service behind that seam, and expand only after production evidence justifies the next slice.

Pick one narrow seam in the existing stack

Start with the workflow that slows operators down today, not the oldest codebase in the repository. Good first seams produce drafts, classifications, triage tags, or structured extractions that a person or an existing rule checks before acting.

The diagrams trace three handoffs from the existing core to the sidecar. Choose a seam based on what the legacy system can expose safely.

Seam architecture

Three ways to attach an AI sidecar

Read replica / SQL view architectureThe legacy core owns SQL and billing. Scoped read view feeds the isolated async AI sidecar. The worker writes a versioned draft for feature-flagged review. The core keeps its manual fallback.Read scopePoll / fetchWrite draftManual pathExisting platformLegacy coreSQL, billing, core writesNarrow boundaryScoped read viewScoped rows & columnsIsolated computeAsync AI sidecarQueue, timeout, evalVersioned returnDraft reviewSeparate store + flagFallbackExisting rulesManual workflow stays liveRead replica / SQL view architectureThe legacy core owns SQL and billing. Scoped read view feeds the isolated async AI sidecar. The worker writes a versioned draft for feature-flagged review. The core keeps its manual fallback.Read scopePoll / fetchWrite draftExisting platformLegacy coreSQL, billing, core writesNarrow boundaryScoped read viewScoped rows & columnsIsolated computeAsync AI sidecarQueue, timeout, evalVersioned returnDraft reviewSeparate store + flagFallbackExisting rulesManual workflow stays live
Latency isolation
Run bounded reads on a replica to isolate query load. A view on the primary still shares its capacity.
Credential and data scope
Grant SELECT on the scoped view. Apply caller authorization again before retrieval.
Rollback
Hide drafts with the flag and stop polling. The core keeps its existing read and write paths.
The core owns transactions across all three designs. The sidecar returns proposals for review.
  • Read replica or SQL view: expose only the columns needed for retrieval or scoring. Grant the AI service read access to the view only. Use a replica to move query load off the primary.
  • Transactional outbox or event queue: when the legacy app saves a ticket, claim, or document, write a small event row in the same database transaction. A relay publishes the committed event. The worker processes it and stores a versioned draft.
  • API gateway or reverse proxy route: route one new endpoint or document path to a containerized sidecar service while legacy endpoints stay untouched.

If you are still deciding whether to build that slice in-house or use an off-the-shelf tool, see our comparison on custom AI versus off-the-shelf AI and our AI proof of concept guide.

Compare a strangler seam against a full rewrite

Use the conceptual planner below to inspect how blast radius, rollback paths, and the first verifiable milestone change across three common legacy constraints.

Interactive trade-off explorer

Compare a strangler seam against a full rewrite

Compare qualitative risk ratings across three synthetic scenarios. Each gauge runs from lower to higher risk.

1. Pick the legacy constraint
2. Compare delivery path
Starting system

Monolithic web app with a shared relational database

One application handles UI, billing, reporting, and customer records in a single SQL schema that cannot accept downtime.

Recommended seam: Attach a read-replica or change-data-capture feed to a separate AI worker service, and return drafts to the existing UI behind a feature flag.

Contained risk

Strangler seam + sidecar AI service

Keep the core transactional tables untouched. Feed the AI service from a read-only view or event stream, then write back only versioned suggestions.

Core blast radius
Contained read slice
Rollback complexity
Single feature flag
  • Core database blast radiusContained

    Isolated to a read replica or outbox feed; no schema rewrite on hot transactional tables.

  • Latency on user requestsContained

    Model calls run asynchronously off the request thread so core page loads stay predictable.

  • Cloud and token budgetContained

    Per-worker queue limits and right-sized compute cap spend from day one.

Protect latency, permissions, and sensitive data

Legacy systems often carry the company's real authorization rules and its most sensitive free-text fields. Two shortcuts break production deployments quickly: calling an LLM synchronously inside a web request, and copying raw records into a shared AI index without carrying forward caller permissions.

Keep model calls asynchronous whenever the user does not need a live token stream. Put explicit timeouts, bounded retries, and a dead-letter queue around every model call. If the provider slows down or returns malformed JSON, the legacy application should fall back to the existing manual or rule-based path instead of failing the transaction.

For teams handling customer PII or clinical PHI, enforce redaction and access control inside your own VPC before prompts leave the boundary. Store model outputs separately from authoritative records so reviewers can inspect what the model proposed alongside the source record. For detailed patterns, read our guides on PII and PHI redaction before the LLM and keeping model estimates distinct from recorded decisions.

The reference snippets show what the worker can read, what a reviewer can trace, and which limits to set before a rollout.

Illustrative reference schema

Inspect the contracts on both sides of the seam

These snippets use synthetic records and example limits.

triage_seam.sql
-- Assume legacy.tickets and legacy_writer exist.
CREATE SCHEMA ai_seam;
CREATE ROLE ai_worker NOLOGIN;

CREATE VIEW ai_seam.triage_input
  WITH (security_barrier = true) AS
SELECT id AS source_record_id, category, priority
FROM legacy.tickets
WHERE tenant_id = 'example_tenant'
  AND ai_triage_enabled = true;

GRANT USAGE ON SCHEMA ai_seam TO ai_worker, legacy_writer;
GRANT SELECT ON ai_seam.triage_input TO ai_worker, legacy_writer;

CREATE TABLE ai_seam.ai_outbox_events (
  event_id uuid PRIMARY KEY,
  source_record_id bigint NOT NULL,
  event_type text NOT NULL,
  occurred_at timestamptz NOT NULL DEFAULT now()
);

GRANT INSERT, SELECT (event_id)
ON ai_seam.ai_outbox_events TO legacy_writer;

-- Run inside the existing legacy writer transaction.
-- Bind $1 to the event UUID and $2 to the saved ticket ID.
INSERT INTO ai_seam.ai_outbox_events
  (event_id, source_record_id, event_type)
SELECT $1, source_record_id, 'triage.requested.v1'
FROM ai_seam.triage_input
WHERE source_record_id = $2
ON CONFLICT (event_id) DO NOTHING;

The worker can read only the scoped view in the core database. The legacy writer inserts events, and a separate relay publishes them after commit.

Architecture checklist

Keep the legacy core isolated from AI failure modes

  1. 01Read seamReplica, SQL view, or outbox
  2. 02VPC boundaryPermissions + PII redaction
  3. 03Async workerQueue, timeouts, and eval gate
  4. 04Reviewed returnVersioned draft + rollback flag
  • Grant the AI worker read-only database credentials; never let an experimental service alter core billing or customer tables.
  • Carry forward caller permissions from the legacy app into retrieval filters rather than trusting prompt instructions.
  • Put explicit timeouts, dead-letter queues, and a deterministic fallback around every external model call.
  • Write AI proposals into a separate versioned table with model ID, prompt version, and input hash so reviewers can inspect or revert cleanly.
  • Run shadow mode on read-only traffic and score against a labeled evaluation set before exposing outputs to customers.
  • Audit idle cloud spend and tag AI compute separately from legacy workloads so infrastructure economics stay visible per workflow.

Cut cloud waste to fund modernization

Legacy platforms that grew organically on AWS, GCP, or Azure almost always carry idle instances, unattached volumes, oversized databases, and unmonitored test environments. Adding GPU endpoints or high-volume LLM API calls on top of unoptimized cloud spend turns an AI pilot into a finance objection.

In one AWS cloud cost optimization engagement, Software Sushi inventoried resources across accounts, removed idle compute and redundant storage, right-sized workloads to measured usage with zero downtime, and added drift monitoring. That audit cut monthly cloud spend by 62% without rewriting the application.

Treat infrastructure hygiene as phase zero of modernization. Set per-workflow token ceilings, tag AI worker compute separately from legacy workloads, and track cost per processed document or ticket before opening traffic to all customers. You can also explore our cloud cost optimization services or our AWS Cloud Modernization offering on AWS Marketplace.

When a core replacement is justified

An incremental seam is not a permanent excuse to ignore broken foundations. Plan a targeted replacement of a legacy subsystem when one of these hard blockers holds:

  • Unsupported runtime or security exposure: the operating system, database engine, or framework no longer receives security patches and cannot be isolated inside a private segment.
  • Data model corruption: source records lack stable identifiers or audit history, making it impossible to trace which record produced a model input.
  • Hard throughput ceiling: the database or storage layer cannot sustain the read volume needed even on a replica.

Even then, replace one bounded domain at a time behind the same strangler contract rather than freezing the entire product for an all-or-nothing cutover.

Further reading

These public engineering references cover incremental system modernization, cloud reliability, and AI risk boundaries. They do not endorse Software Sushi or this article.

Frequently asked questions

Do we need microservices before adding AI to a monolith?

No. One isolated worker or sidecar service reading from a replica, view, or event queue gives you independent scaling and clean rollback without splitting the rest of your monolith.

How do we prevent LLM latency from slowing down our core application?

Keep inference off the synchronous request path. Publish an event or enqueue a background job with a strict timeout, return the existing page immediately, and deliver the AI draft asynchronously or fall back to deterministic rules when the worker is unavailable.

How do we test an AI seam safely against legacy production data?

Start with synthetic fixtures and a labeled evaluation set. Once access filters and redaction rules pass review, run the worker in shadow mode on read-only traffic so you can measure accuracy, latency, and cost before exposing outputs to users.

Can cloud cost optimization really run without rewriting the platform?

Yes. Inventorying unused assets, right-sizing compute and databases to measured usage, and adding drift alerts typically require configuration and IaC changes rather than an application rewrite, as shown in our 62% AWS spend reduction case study.

Ship the first AI seam without risking your core platform

A legacy system that serves paying customers is an asset, not a blocker. Keep the working core steady, cut one testable seam for the AI workflow, enforce data and cost boundaries inside your cloud account, and let measured results guide what you modernize next.

If you want engineers who integrate AI into live stacks without forcing a disruptive rewrite, explore our AI integration services, cloud and modernization engineering, backend development, or book a discovery call.