LLM-Assisted Replication of an Open-Source Chat App: Engineering Practices and Evaluation Methods

    Replicating an open-source chat application provides a practical way to evaluate LLM-assisted software development. This article outlines a two-round evaluation process, key scoring criteria, a representative implementation structure, and lessons from comparing model–execution framework combinations. It focuses on distinguishing basic code generation from reliable delivery through real API integration, testing, security checks, and meaningful product improvements.

    1. Background and Evaluation Goals

    The open-source large language model ecosystem now includes models, tools, and deployment solutions. Recreating an open-source chat application is therefore a useful test of an LLM’s engineering capabilities. The task combines requirements analysis, frontend development, API integration, credential management, and autonomous testing and repair.

    The evaluation gives several model–execution framework combinations the same requirements and asks each to produce three deliverables:

    1. A product specification and structural diagram. This tests whether the model can turn loosely defined requirements into modules, page flows, and data flows.
    2. A replicated chat application. This tests how well it reproduces core interactions, including multi-turn conversations, streaming responses, conversation history management, and syntax highlighting.
    3. An improved version based on the model’s own judgment. This tests proactive design without explicit feature requests. Possible improvements include dark mode, conversation export, prompt templates, and mobile-friendly layouts.

    2. Evaluation Design: A Two-Round Prompting Strategy

    The two-round prompting strategy is a central part of this evaluation method:

    • Round 1: Provide requirements only. The model creates the documentation, page structure, and initial implementation. Without working API credentials, this round reveals how it handles abstraction and placeholders—for example, whether it defines a unified configuration layer and uses environment variables for credentials.
    • Round 2: Provide working credentials. The model must replace simulated calls with real API calls and verify that the application works end to end.

    This separation helps reveal differences in engineering discipline:

    • Some models perform only minimal verification after receiving credentials. They stop once a single request succeeds, potentially leaving many code paths untested.
    • Others perform deeper integration testing, identify issues such as null references, streaming parser failures, or incorrect history truncation, and repair them. They may also add logging and retry handling.

    With the same prompts, these differences reflect the autonomous task-planning strategies of the model–execution framework combinations rather than differences in instructions.

    A working-looking interface is not enough. Evaluate the deliverables across the following dimensions:

    1. Requirements coverage. Does the specification cover every requirement? Does it account for edge cases such as excessively long context, network outages, and invalid credentials?
    2. Architecture. Are the UI, state management, service layer, and configuration layer separated? Are components reusable? Does the implementation avoid hardcoding?
    3. Code quality. Assess type coverage, error handling, accessibility, and responsive layout.
    4. Testing depth. Did the model write and execute tests? When tests failed, did it address the root cause or work around the failure?
    5. Quality of improvements. Does the improved version offer meaningful user value rather than cosmetic additions?
    6. Security and compliance. Are credentials supplied through environment variables? Could they still be exposed? Are sensitive values redacted from logs?

    4. Example Implementation Structure

    A well-organized chat application typically includes the following elements:

    1. src/
    2. components/ # Conversation list, input box, message bubbles, settings panel
    3. hooks/ # useChat, useStreamingMessage, useSessions
    4. services/ # chatAPI wrapper with centralized SSE parsing and retries
    5. store/ # Conversation history and user preferences
    6. config/ # Environment variables: API URL, model name, and credentials

    The following illustrates a streaming service function:

    1. export async function streamChat(messages, onDelta) {
    2. const res = await fetch(`${import.meta.env.VITE_API_BASE}/chat`, {
    3. method: "POST",
    4. headers: {
    5. "Content-Type": "application/json",
    6. Authorization: `Bearer ${import.meta.env.VITE_API_KEY}`,
    7. },
    8. body: JSON.stringify({ messages, stream: true }),
    9. });
    10. if (!res.ok) {
    11. throw new Error(`Request failed: ${res.status}`);
    12. }
    13. const reader = res.body.getReader();
    14. const decoder = new TextDecoder();
    15. let buffer = "";
    16. while (true) {
    17. const { done, value } = await reader.read();
    18. if (done) break;
    19. buffer += decoder.decode(value, { stream: true });
    20. // Split incoming data into lines and dispatch incremental content
    21. const lines = buffer.split("\n");
    22. buffer = lines.pop() ?? "";
    23. for (const line of lines) {
    24. if (line.startsWith("data: ")) {
    25. const payload = line.slice(6);
    26. if (payload === "[DONE]") return;
    27. onDelta(JSON.parse(payload).delta ?? "");
    28. }
    29. }
    30. }
    31. }

    Key review points include keeping credentials out of source code, handling stream data split across chunks, and providing clear feedback on failure paths.

    The example is illustrative, not a complete security or robustness guarantee. In particular, Vite exposes VITE_ variables to browser code: placing a secret in an environment variable does not, by itself, prevent credential leakage. Evaluation should check actual exposure as well as how credentials are configured.

    5. Observations Across Model Outputs

    Comparing the deliverables suggests several recurring patterns:

    • Documentation quality and code quality are not closely correlated. A model may produce polished documentation while implementing only the main execution path. The reverse can also occur. Documentation and implementation should therefore be assessed separately.
    • Behavior after receiving credentials is a key differentiator. Models that perform only shallow smoke tests can produce applications with cross-session interference, flickering streamed responses, or failures that provide no user feedback.
    • Proactive testing and repair matter. The strongest combinations construct failure cases after integration, including empty messages, excessively long inputs, and interrupted streaming requests. They use failure information to diagnose and fix problems. This is a core indicator of production readiness.
    • Good improvements reflect sound product judgment. Valuable enhancements address real problems such as context management, observability, and accessibility, rather than adding elaborate animations.

    6. A Reusable Evaluation Workflow

    1. Fix the requirements and both prompt templates. Keep them consistent so that the model–execution framework combination is the variable under evaluation.
    2. Create a shared acceptance checklist. Include functional requirements, code standards, and security checks.
    3. Give every combination the same time budget. Let each work autonomously, while recording the questions and assumptions it raises.
    4. Verify behavior through fault injection. Test invalid credentials, network loss, and excessively long inputs to assess error handling.
    5. Score the improved version separately. Avoid conflating faithful replication with proactive product design.
    6. Report capability differences rather than promotional rankings. The comparison should help teams select an appropriate model and execution framework.

    7. Conclusion

    Replicating an open-source product is a valuable evaluation task because it tests four capabilities together: requirements abstraction, engineering implementation, real integration, and autonomous repair.

    The two-round design—requirements first, credentials second—is particularly useful. It separates the ability to write code from the ability to deliver a working application.

    For developers, this method offers more than a way to compare models. It also provides a reusable acceptance framework for LLM-assisted development, helping teams identify weaknesses earlier and reduce rework in real projects.