AI Coding Tools for Full-Site E-Commerce Generation: A Practical Evaluation

    Choosing between AI coding tools is increasingly about more than code completion—the meaningful differences surface in medium-scale, multi-page, multi-route, multi-state applications. Using a ten-page e-commerce site as a benchmark, this article presents a reproducible way to evaluate how well AI coding tools generate complete sites. It specifies a fixed task, an implementation-agnostic constraint set, a prompt template, and a scorecard, then walks through five observations covering first-run viability, cross-page consistency, visual correctness, data-layer architecture, and interaction completeness. Readers will find a minimal acceptance pipeline they can automate, plus practical guidance: front-loading acceptance criteria into prompts, using two-phase generation to resist context decay, and measuring total cost rather than first-run success.

    Why Test with Full-Site Generation

    Single-function completion and single-file generation no longer separate one AI coding tool from another. The real differentiator is the medium-scale engineering project—one with multiple pages, multiple routes, and multiple states. Such a project tests context management, the ability to draw clean module boundaries, and the ability to keep things consistent across files, all at once.

    An e-commerce site is an ideal sample: a moderate number of pages (around ten), a complete business flow (browse → detail → order → payment result → account system), and clear implicit demands for visual consistency and data layering.

    One premise difference is worth stating up front. In traditional hand-written tasks, “the code compiles” is almost equivalent to “the task is done.” In AI-generated scenarios, there are still several layers of hidden defects between “the service starts” and “the business flow closes the loop.” So the focus of the evaluation should not be “can it write it,” but “once it is written, how much extra repair cost must the team pay.”

    Designing a Reproducible Evaluation

    Task and Page List

    The task is defined as: starting from an empty directory, generate a locally runnable front-end shopping site with the following ten pages:

    1. Home / product listing page (with filtering and pagination)
    2. Product detail page (with option selection and stock status)
    3. Checkout page (address, delivery, discounts)
    4. Order success page (order number and next-step guidance)
    5. Login page
    6. Registration page
    7. User center · Overview (Dashboard)
    8. User center · Order list
    9. User center · Coupons and wallet
    10. User center · Account settings

    State explicitly that “the difficulty lies in site completeness and overall consistency,” rather than listing technical buzzwords. The more a prompt emphasizes “completeness,” the more the model tends to pile up page count at the expense of quality. So constraints must land in a form that can be accepted and verified.

    Unified Constraints (The Key Is Not Binding to a Specific Implementation)

    The fairness of the evaluation comes from controlling variables. Use the same constraint text across all candidate tools, and describe engineering qualities rather than specific library names:

    • Tech stack: a component-based front-end framework + a type system (static typing) + single-page-application routing
    • Directory structure: layered by responsibility (page layer / component layer / data-access layer / design tokens / utilities)
    • Data source: all mock data must be injected through a unified data-access layer; business data must not be hard-coded inside page components
    • Quality baseline: basic form validation, empty states, loading states, error states, route-level permission guards
    • Accessibility: body-text contrast meets AA; interactive elements are focusable and carry semantic labels
    • Responsive: at least two breakpoints, desktop and mobile

    Prompt Template (Illustrative)

    1. Goal: Build a front-end shopping site with 10 pages; routes and page list as follows ...
    2. Engineering constraints:
    3. 1) Use static typing; no pervasive any; public data structures must be defined centrally;
    4. 2) Layering: pages / components / services / design-tokens / utils;
    5. 3) Business data must be fetched only through the services layer; no inline mock arrays in page components;
    6. 4) Every list and detail endpoint must handle the three states loading / empty / error;
    7. 5) Colors, spacing, radii, and font sizes all come from design-tokens; no magic values inside pages;
    8. 6) Form fields must have validation and error messages; submit buttons need a disabled state and protection against duplicate submission;
    9. 7) Self-check after output: list remaining placeholder content and unimplemented logic.

    The final “self-check” step is often overlooked, but it effectively lowers the delivery probability of hidden defects like “every image is a placeholder” or “the feature looks complete but is actually an empty shell.”

    Scorecard

    Dimension What to observe How to judge
    First-run viability Can dependencies be installed and the app started; console errors Automatically capture build and startup logs
    Business closure Can browse → detail → checkout → success page be walked through Manually click the key paths
    Fix rounds How many conversation rounds from first run to error-free Count + elapsed time
    Consistency Are design tokens unified, are components reused Sample and compare page implementations
    Code quality Layering, naming, types, comments, duplicate code Static checks + manual review
    Evolvability Cost to swap mocks for real APIs Estimate the number of change points

    Observation 1: First-Run Viability—From “It Starts” to “The Business Loop Closes”

    The most common pattern in the evaluation: most tools can produce a startable project within a single session, but there is a systematic gap between “startable” and “usable.” Common symptoms include:

    • Dependency versions conflict with each other, or module paths are declared that do not exist;
    • Routing is fully configured but page files are missing, so clicking leads to a blank screen;
    • After form submission there is no navigation logic, and the success page becomes an island;
    • Static asset paths are hard-coded as absolute paths, so a second deployment breaks immediately.

    Fixing these defects often does not require writing new features, but it does require a human developer to understand how the model organized things—and that cost is underestimated. The practical recommendation: define the acceptance gate as three conditions holding at once—build passes + key paths are clickable end-to-end + console is error-free—rather than “the pages open.” If a tool needs more than three or four rounds of fixes to meet the bar, its cost-effectiveness in a real project drops noticeably, because debugging in real projects is usually more complex than in a demo.

    Observation 2: Consistency Decay—The More Pages, the More the Specs Drift

    Cross-page consistency is the most easily lost aspect of a ten-page task, and the decay is usually not uniform—it tends to erupt in the middle-to-late stretch:

    • Design-token drift: the home page uses primary color A, but a near-identical color B shows up in the user center; radii, shadows, and spacing each develop their own conventions per page;
    • Component re-implementation: buttons, tables, and form controls are written once per page, with subtle styling differences;
    • Naming and structure drift: similar files mix several naming styles; the page layer references utility functions directly, breaking the layering;
    • Inconsistent business conventions: amounts are stored sometimes in “yuan,” sometimes in “cents”; time formats are inconsistent.

    The root cause is not mysterious: when the number of pages exceeds the model’s effective single-pass context, the conventions produced early get diluted by later content. A workable engineering countermeasure is a two-phase, “spec first, then fill” generation:

    Phase one produces only the design tokens and component inventory (no page business). Phase two uses phase one’s output as fixed context and generates page by page or in groups. Example tokens:

    1. :root {
    2. --color-primary: #2b5cff;
    3. --color-text-primary: #1a1a1a;
    4. --color-text-on-primary: #ffffff;
    5. --color-surface: #ffffff;
    6. --space-1: 4px; --space-2: 8px; --space-3: 16px;
    7. --radius-sm: 6px; --radius-md: 10px;
    8. --font-size-body: 15px;
    9. }

    As long as the model is required to “write no color or spacing literals inside pages,” consistency becomes markedly more controllable.

    Observation 3: Visual Correctness—Responsive Breakage and Low Contrast Are Defects You Can Catch Automatically

    The second class of high-frequency problems concentrates in the visual layer:

    • The UI is designed overall for wide desktop screens; on narrow screens there is horizontal overflow, buttons wrap, tables get squeezed;
    • Form pages like login and registration misalign on narrow screens, with labels overlapping input fields;
    • The primary button uses “white text on white background,” so users cannot see the button text at all;
    • All product images are placeholder blocks; inconsistent thumbnail ratios cause layout jitter in lists.

    What these problems have in common: almost all of them can be detected automatically and should not rely on manual eyeballing. Add at least three automated checks:

    1. Layout check: screenshot at multiple breakpoints and assert there is no horizontal scrollbar (document.documentElement.scrollWidth does not exceed the viewport width);
    2. Contrast check: compute contrast from text and background color values; fail if below threshold;
    3. Resource check: assert that no placeholder-image service URL or empty src exists in the page.
    1. // Contrast self-check (illustrative, WCAG relative luminance algorithm)
    2. function luminance(hex) {
    3. const rgb = hex.match(/\w\w/g).map((h) => {
    4. const c = parseInt(h, 16) / 255;
    5. return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
    6. });
    7. return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
    8. }
    9. function contrastRatio(fg, bg) {
    10. const a = luminance(fg), b = luminance(bg);
    11. return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
    12. }
    13. // Body text requires >= 4.5; large text requires >= 3.0

    Observation 4: Architecture and the Data Layer—Mock-Data Coupling Is the Most Typical Hidden Debt

    In demo-type tasks, the model’s easiest move is to write mock arrays directly into page components. This makes the demo look complete but requires page-by-page refactoring when connecting real APIs. To judge whether generated code is evolvable, look at just two things: where the data comes from, and how dependencies are injected.

    Recommended target layering:

    1. src/
    2. ├── pages/ # Composition and layout only
    3. ├── components/ # Reusable, business-free UI
    4. ├── services/ # Data access: interfaces + type contracts
    5. │ ├── product.ts
    6. │ ├── order.ts
    7. │ └── auth.ts
    8. ├── design-tokens/ # Colors, spacing, font sizes
    9. ├── store/ # Cross-page state such as session and cart
    10. └── utils/

    The data-access layer is organized as interface contracts + swappable implementations; mocks and real APIs are just different adapters:

    1. // services/product.ts — the stable domain contract
    2. export interface Product {
    3. id: string;
    4. name: string;
    5. priceCents: number; // Unified in cents to avoid precision issues
    6. stock: number;
    7. images: string[];
    8. }
    9. export interface Paged<T> {
    10. items: T[];
    11. total: number;
    12. page: number;
    13. }
    14. export interface ProductService {
    15. list(q: { keyword?: string; page: number; size: number }): Promise<Paged<Product>>;
    16. detail(id: string): Promise<Product | null>;
    17. }
    18. // services/adapters/mock-product.ts
    19. export const mockProductService: ProductService = { /* Implemented against a local dataset */ };
    20. // services/adapters/http-product.ts
    21. export const httpProductService: ProductService = { /* Implemented against an HTTP client */ };
    22. // services/index.ts — implementation selected via config; the page layer is unaware
    23. export const productService: ProductService =
    24. import.meta.env?.VITE_DATA_SOURCE === 'mock' ? mockProductService : httpProductService;

    As long as the generated result follows this structure, “switching from demo to production” means changing one config value; otherwise you have to rewrite the pages.

    Observation 5: Interaction and Engineering Details

    Details that are easy to overlook but directly determine whether it is “really usable”:

    • Form validation: required fields, format, length, double confirmation (e.g., two passwords match); error messages must pinpoint the specific field rather than a generic modal;
    • State completeness: loading skeleton, empty-list guidance, retry on request failure—missing any of the three makes the site look “unfinished”;
    • Amount and stock: the order button must be disabled based on stock and option selection, to avoid generating orders that cannot be fulfilled;
    • Route guards: an unauthenticated visit to the user center should redirect to login and return to the original target address after login;
    • Session security: tokens must not be written where any script can read them; sensitive config is injected via environment variables rather than hard-coded;
    • Semantics and accessibility: form controls associated with labels, modal focus management, keyboard reachability.

    Automating the Review: A Minimal Viable Acceptance Pipeline

    Manual eyeballing is not suitable for regression. Turn the criteria above into gates and run them on every generation result:

    1. {
    2. "scripts": {
    3. "check:types": "<static type-check command>",
    4. "check:lint": "<lint command>",
    5. "test:unit": "<unit test command>",
    6. "test:e2e": "<key-path end-to-end test command>",
    7. "test:a11y": "<layout and contrast check command>"
    8. }
    9. }

    The end-to-end cases only need to cover four key paths: successful login, product-list filtering, add-to-cart from the detail page, and checkout through to the success page. If these four pass, the business skeleton holds; the remaining pages are parts that can be filled in incrementally.

    For continuously hosting generation results, the cloud usually handles it with a combination of common categories: object storage for product images and build artifacts, a content delivery network for serving static assets close to users, a container platform for the runtime environment with guaranteed consistency, and log and monitoring services to surface front-end exceptions and API error rates, plus a key-management service for hosting config and credentials. Baidu AI Cloud, for example, offers these capabilities as similar general-purpose products, and teams can choose according to their existing architectural habits without designing a separate system just for AI-generated projects.

    Conclusion and Practical Recommendations

    1. The evaluation method matters more than the evaluation conclusion. Only when you use a fixed task—“ten pages + clear difficulty + unified constraints + scorecard”—to compare tools do the conclusions become reproducible; otherwise it easily degrades into a subjective description of experience.
    2. Move acceptance standards forward into the prompt. Layering, tokenization, mock isolation, three-state handling, and a self-check list—writing these five into the prompt usually pays off more than switching tools.
    3. Use two-phase generation to counter context decay. Produce the design spec and component inventory first, then fill in pages; consistency improves most noticeably this way.
    4. Do not expect “generate once and deliver.” A reasonable expectation is: AI coding tools handle 60%–80% of the boilerplate code and scaffolding, while humans handle architecture decisions, edge cases, and security review.
    5. The evaluation must count total cost. First-run viability is only the entry metric; what really determines efficiency is fix rounds, secondary-refactoring cost, and later maintainability.

    Among AI coding tools, IDEs with Agent capabilities can already produce the first-version skeleton for a medium-scale task like this. The gaps mainly show up in three dimensions: maintaining consistency, visual correctness, and architectural discipline. Bring these three into your acceptance gates, and tool selection shifts from “which one is smarter” to “which one fits my engineering constraints”—that is the reusable judgment standard.