Engineering Methods and Acceptance Practices for Recreating Chat Apps with AI Coding
This article explains how to recreate a chat application with AI coding tools so the result matches more than a screenshot. It covers requirement reports, layered architecture, streaming message states, mobile input behavior, share-link checks outside the creator’s session, and layered visual, functional, exception, and security acceptance.
From visual similarity to consistent behavior
AI coding tools can quickly produce a chat app from a reference page: a sidebar, a message list, and an input box. That only shows that the page skeleton exists. It does not prove the application is complete.
Delivery quality usually depends on details a static screenshot does not show: whether the input clears after send, whether generation can be stopped, whether long text crowds action buttons, whether the input stays visible when the mobile keyboard opens, and whether a share link works for users who are not logged in.
Recreating a chat app should therefore be split into three layers:
- Visual consistency: layout, spacing, type hierarchy, component size, and responsive behavior match the target design.
- Interaction consistency: send, stop, retry, copy, and session switching have clear, stable behavior.
- System completeness: session data, identity and permissions, service calls, error recovery, and deployment configuration form a closed loop.
These layers do not replace one another. A polished page that cannot restore history is a high-quality mock. An app with full services that is hard to type into on mobile is not a reliable product.
Work must stay within lawful authorization. Using a layout and interaction pattern as a reference does not mean copying unlicensed marks, assets, code, or proprietary content. Even when source is public, check licenses, dependency terms, and asset-use conditions. Being able to view something is not the same as being free to use it.
Write a requirements report before generating code
AI coding often fills in missing requirements on its own. Developers only discover the mismatch at acceptance.
The fix is not more prompt text. First produce an executable product and technical report that turns vague goals into explicit constraints.
1. Page scope and functional boundaries
List the pages and capabilities in this delivery—for example the main chat page, history list, read-only share page, login-state prompts, and a basic settings entry.
Mark implementation depth for each capability:
- UI only
- local interaction
- real service integration
- permissions and persistence
This prevents a button on the page from being treated as a finished feature. If an attachment control is a placeholder, state that file parsing is not provided. Do not fake completion with simulated results.
2. Write requirements as verifiable behavior
“Support sharing” is not an acceptance criterion. A complete description should answer: is the share a single message or the whole conversation? Does it include later additions? Can visitors edit? Can the link be revoked? Can unauthenticated users open it? Should attachments and sensitive data be excluded?
“Mobile-ready” also needs concrete cases: narrow layout, portrait and landscape, soft keyboard, long-content scrolling, touch targets, and the bottom safe area.
The closer requirements are to real operations, the easier generation errors are to catch.
3. Record unknowns and assumptions
Behavior that cannot be confirmed from screenshots belongs on a to-confirm list, not silent tool decisions. Cross-device history sync, whether deleted sessions can be restored, and how long share links remain valid are product and backend design choices.
For items that cannot be confirmed yet, use a conservative implementation and state the assumption and its impact. That keeps work moving and reduces scope disputes at delivery.
Use a layered architecture to limit later change cost
A chat UI has few components but lots of crossed state. Putting rendering, message handling, and network calls in one place may be faster at first and costly later, when one change regresses several features.
Organize by responsibility:
Presentation owns bubbles, the input area, the sidebar, and status cues. It should not own permission checks or persistence.
Session state owns the current session, message sequence, generation status, scroll policy, and failure information.
Service adapter owns request sending, stream parsing, cancellation, and error mapping, isolating external service differences behind one boundary.
Server business logic owns identity checks, session storage, share authorization, and access control. Those duties must not all sit on the client.
The point is not more files; it is a smaller blast radius. Replacing a generation service should ideally mean changing the adapter, not rewriting the message list and input.
The browser must not store long-lived keys that can call backend services directly. Sensitive credentials belong in a controlled server environment, with access control, rate limits, and audit to reduce leak risk.
Manage streaming chat with explicit states
Streaming is not “keep appending text.” Request setup, first content, user stop, network drop, and service completion all change message state.
A useful state sketch:
Message states:pendingrequestingreceivingcompletedstoppedfailedMain transitions:pending → requestingrequesting → receivingreceiving → completedrequesting or receiving → stoppedrequesting or receiving → failed
Transitions need clear triggers. After the first valid fragment, move from requesting to receiving. Move to completed only after an explicit end signal. An unexpected disconnect must not be treated as normal completion, or users will treat a truncated answer as finished.
1. Stop and cancel
After stop, the client should halt receiving and keep already shown text. If the server and upstream support cancel, send a cancel signal. If they do not, say that stopping the UI does not always stop backend work immediately.
Prevent late data from an old request from writing into a new session. Assign a request id per generation and check it before updating state.
2. Retry and duplicate submit
On retry, define whether you regenerate the last answer or resubmit the whole request. Rapid send clicks, refresh recovery, and timeouts can duplicate messages.
Button state and a submit lock reduce duplicates on the client. Persistent writes also need server-side deduplication, not UI limits alone.
3. Scroll behavior
Auto-scroll new content only when the user is still near the bottom. Forcing a jump after they scroll up to read history interrupts them.
A better approach is to keep position and show a “new content” cue so they choose whether to jump.
Mobile adaptation must match real input conditions
Mobile issues often cluster around the input, which is affected by content height, browser chrome, the soft keyboard, and safe areas.
Do not layout only against a fixed screen height. When the keyboard opens, the visible area changes. The input must stay visible and the list must still scroll. Validate against the real viewport, not only the first-open screenshot.
Give multiline input a reasonable max height. Grow with short text; after the cap, scroll inside the field so the message area is not fully squeezed.
Keep send, stop, and attachment controls large enough to tap. A tiny icon that looks precise but is hard to hit is still an interaction defect.
Test long paragraphs, long URLs, code, and wide tables. Narrow layouts need wrapping or local horizontal scroll so one outlier does not stretch the whole page.
Mobile acceptance is not matching pixel sizes. It is confirming users can keep working while they read, type, wait, and change state.
Share-link acceptance must leave the creator’s environment
Sharing often “works on my machine” because the creator is logged in and the browser still has session data and cache. That can hide permission and storage bugs.
Cover at least:
- open the link with no original login
- open it as another account
- open it directly on a phone
- open it after the link is revoked
- open it after the source session is changed or deleted
Cross-browser checks are not only about rendering. They prove access does not depend on the creator’s local state.
Decide snapshot versus live view. A snapshot freezes content at share time; later session changes are not published automatically. A live view needs explicit update rules and permission boundaries. Both are valid; they must not be mixed without the user knowing.
Share identifiers should be hard to guess. That is not full authorization. Sensitive content still needs identity checks, expiry, or extra access limits. A read-only share page must not expose internal session ids, sensitive prompts, or unnecessary personal data.
Layered acceptance, not a final screenshot
Split acceptance into four groups and keep results and issue logs for each.
1. Visual
Check hierarchy, placement, whitespace, truncation, and layout at different widths. Use consistent test content and display conditions so length differences do not cause false failures.
2. Functional
Cover new session, consecutive sends, stop, fail and retry, history switch, refresh recovery, copy, and share access as full paths.
Pass or fail by state after the action, not by whether an entry exists.
3. Exception
Simulate disconnects, slow responses, empty content, long replies, expired login, and duplicate submit. Check that prompts are accurate and that already typed input is kept.
Errors should help the user choose a next step and must not dump stacks, credentials, or sensitive config.
4. Security and maintainability
Check safe rendering of messages, access control, credential handling, dependency licenses, and log redaction. Rich text for user or model content must constrain dangerous markup and untrusted links; do not assume it is safe by default.
Also check that modules have clear duties, config can differ by environment, deploy steps are repeatable, and failures leave enough information to diagnose.
Delivery quality is verifiable completeness
Do not judge AI coding by generation speed or one screenshot. Use the same requirements, test data, and acceptance conditions, and record coverage, defect types, change cost, and deploy repeatability.
A delivery package should include requirements, implementation scope, start and deploy docs, an acceptance checklist, known limits, and notes on data and permissions. Unimplemented capabilities must be labeled. The UI must not imply they exist.
For developers, AI coding shortens the path from requirements to a running implementation. It does not replace requirement clarification, security judgment, or quality ownership. Closing the loop across UI, interaction, services, and acceptance is what turns a lookalike prototype into an application that can be maintained, deployed, and evolved.
