Frontend Code Generation with LLMs: Testing Login, List, and Form Pages

    This article presents a practical observation of an LLM generating a complete React frontend application for three common page types: login, list, and form. It examines where the generated code was directly usable, where it failed, and what developers should review before production. It also includes a page acceptance checklist, considerations for comparisons with closed-source models, implications for the open-source ecosystem, and risk checks before use.

    Large language models have attracted considerable developer attention for frontend code generation. Many evaluations report high scores, but results that are detached from real business scenarios are often difficult to use when judging practical usability. This article therefore uses a business requirement containing three typical page types—login, list, and form—to observe where the model can deliver directly and where human intervention is still required.

    1. Test Conditions and Scope

    This test did not restrict the programming language, and the model chose its own technology stack. It ultimately selected React. The requirement was not a code snippet but a directly accessible frontend application with a complete project structure.

    During the test, there was a queue for compute resources; the waiting time was not included in the recorded duration. Once resources were available, the model took about half an hour in total from requirement parsing to outputting the complete project. The output included an address for an independently runnable development environment, indicating that the model has some capability in project scaffolding and basic environment configuration.

    This test was a single observation, not a controlled benchmark. The original notes did not provide the model version, parameters, or runtime environment, so the conclusions below apply only to the conditions of this test. Readers who wish to reproduce it should fix the prompt, run it multiple times, and record the model version, elapsed time, and differences between outputs.

    2. Can the Login Page Be Used Directly?

    The login page required a carousel, basic form validation, and redirect logic after login. In this observation, the model implemented all three with no obvious omissions.

    For pages with fixed structure and simple interactions, the model was able to correctly call a common UI component library and combine form and routing logic. From a code-quality perspective, the output in this test could enter a production environment with minor modifications.

    However, login functionality involves authentication, so the following items still require manual review before release:

    • Where the token is stored, avoiding locations that are easy for scripts to read.
    • Whether APIs are accessed only over HTTPS.
    • Whether form submission has protection against duplicate submission and cross-site request forgery (CSRF).
    • Whether error messages reveal information such as whether an account exists.

    3. Why Did Multi-Criteria Filtering on the List Page Fail?

    The list page was the most problematic part of this test. The requirement called for multi-dimensional filtering, pagination interactions, and data-driven list rendering. The model built the page skeleton, but multi-dimensional filtering was not implemented at all; the page rendered only a static list and a simple search box.

    The reason for this type of problem is that list pages usually contain implicit rules:

    • Multiple filter conditions have cascading relationships. For example, the status options may change only after a category is selected.
    • The return order of multiple asynchronous requests is uncertain, and the result of an older request may overwrite the result of a newer one.
    • Filter conditions need to be synchronized bidirectionally with URL parameters, and state should be restored after a page refresh.

    In the generated code, the search handler passed only the keyword and ignored other conditions, which indicates that the model did not model these rules as a unified state.

    A more reasonable approach is to manage all conditions with a unified filter state object, initiate requests when conditions change, and cancel stale requests:

    1. const [filters, setFilters] = useState({ category: '', status: '', dateRange: [] });
    2. useEffect(() => {
    3. const controller = new AbortController();
    4. fetchList(filters, { signal: controller.signal });
    5. return () => controller.abort();
    6. }, [filters]);

    In this way, all filter conditions originate from the same state, and request timing is easier to control. Developers can add URL synchronization and pagination reset logic on this basis, for example resetting the page number to the first page when filter conditions change.

    4. What to Watch for in Linked Form Validation

    The form page best reflects how deeply the model understands business logic. This requirement included a typical rule: when type A is selected, field B is required and must validate a phone number format; when type B is selected, field B is hidden.

    The generated code implemented only basic non-empty validation. It did not switch validation rules based on type, and it did not remove validation when the field was hidden. This can lead to two types of problems: a hidden required field still blocks submission, or data that does not match the expected format is submitted to the backend.

    There are three practical recommendations for handling this type of linked rule:

    1. Derive validation rules from the “type” field rather than hard-coding them in the form.
    2. When a field is hidden, clear both its value and its validation rules.
    3. Perform a complete validation before submission and repeat validation on the server side; frontend validation cannot be the only line of defense.

    Debounced submission also needs attention. The submit button should be disabled while a request is pending to prevent duplicate data caused by repeated clicks.

    5. Page Acceptance Checklist

    The table below organizes the results observed in this test into acceptance items that readers can use to check similar generated results. “Not recorded” means that the original observation did not contain relevant information.

    Function item Expected Observed in this test Gap Recommended fix
    Login carousel Normal carousel Implemented No obvious missing Check fallback for image load failures
    Login form validation Required and format validation Implemented No obvious missing Add server-side validation
    Login redirect Enter target page after login Implemented No obvious missing Check permission check before redirect
    Multi-dimensional filtering Linked multi-condition filtering Not implemented Severe Unify filter state and request based on state
    Pagination Page through while preserving filters Not recorded Unknown Preserve filter parameters when paging
    URL parameter sync State restored after refresh Not recorded Unknown Bidirectionally sync query parameters
    Dynamic field add/remove Fields can be added and removed Not recorded Unknown Manage fields as an array and generate unique IDs
    Conditional validation Different validation rules by type Non-empty validation only Obvious Derive rules from type; clear validation when hidden
    Submit debounce Prevent duplicate submission during request Not recorded Unknown Disable button and show loading state during submit
    Visual style Meets design guidelines Usable, somewhat simple Gap vs mature templates Apply component library theme or design system

    6. What to Consider When Comparing with Closed-Source Models

    Some views hold that top closed-source models can complete similar projects in about 3 minutes and perform better on list pages and form pages. This observation did not measure these claims, and the original notes did not include the closed-source model version, test conditions, or timing methodology, so these numbers cannot be used as reliable conclusions.

    The comparison conclusion that can be confirmed from this test is that the two were similar on basic pages such as the login page, but this test did not conduct a same-condition horizontal test on list pages and form pages. For a formal comparison, the same requirements document and the same acceptance checklist should be used, and elapsed time and completion status for each item should be recorded separately.

    7. Impact on the Open-Source Ecosystem and Developers

    Open-source large models lower the threshold for experimentation. Teams can deploy models in their own environments and fine-tune them with internal code, reducing concerns about handing code and data to external services. However, deployment costs, compute resources, data governance, and compliance requirements still depend on the team’s actual conditions and do not automatically disappear because a model is open source.

    For developers’ work, the impact of such tools is mainly in two areas. First, the time needed to build basic pages and scaffolding may be shortened, allowing developers to focus on page architecture, state design, and performance optimization. Second, developers need to take on more code review work, including checking whether business rules are complete, whether security measures are in place, and whether tests cover critical paths.

    From this observation, code generated by the model requires more human judgment, not less.

    8. Risk Checklist Before Use

    Before using frontend code generated by a model, the following checks should be completed:

    • Manually review business logic, especially rules for filtering, validation, permissions, and amount calculations.
    • Add unit tests and end-to-end tests covering main interaction paths.
    • Check whether authentication, input validation, and sensitive information handling meet security requirements.
    • Check the versions and licenses of introduced dependency packages.
    • Verify in a staging environment before release; do not publish directly to production.

    Conclusion

    This observation shows that current large models already have some usability for generating basic pages and are suitable for scaffolding, prototype validation, and first drafts of simple pages. When faced with multi-condition state management and complex form linkage rules, the model’s output has obvious gaps and requires developers to verify each item.

    Future changes in model capability and engineering standards may allow such tools to play a more important supporting role in frontend development. However, this outcome depends on model capability, the team’s engineering standards, and the strength of human review. Without sufficient testing, generated results should not be used directly in production.