Frontend Development 9 min read

Challenges and Solutions in AI‑Generated Front‑End Code for Admin Panels

After six months of using AI to generate front‑end code for internal admin panels, the team found API typings perfect but UI components frequently flawed, leading them to adopt a key‑based modular strategy that replaces code‑subtraction with code‑addition, leverages reusable component libraries, and uses regex/AST fixes to reliably meet internal standards.

37 Interactive Technology Team
37 Interactive Technology Team
37 Interactive Technology Team
Challenges and Solutions in AI‑Generated Front‑End Code for Admin Panels

The article reports on a half‑year experience of using AI to generate front‑end code for internal admin systems, covering 78 pages across four business back‑ends. While API interface files and TypeScript type declarations are generated with 100% accuracy, the generated UI components, interaction logic, and page structures often fall short of expectations.

It first outlines the typical structure of a generic admin page—query area, table area, and form area—and shows that a simple CRUD page can be generated with about 90% compliance to internal standards. However, variations in business requirements introduce complexity that the AI struggles to handle.

The author proposes a key‑based modular approach: each functional block (e.g., query, delete, add/edit) is tagged with a unique key. By selecting the required keys, unnecessary code can be stripped out using regular expressions or AST transformations, producing a “clean” version of the code.

To improve generation quality, the article suggests moving from a “code subtraction” model to a “code addition” model. Each feature is assigned a unique identifier; when the AI detects or the user selects a feature, the corresponding code snippets are assembled from a predefined collection.

Modularization and componentization are emphasized as essential for higher accuracy. The author demonstrates a concrete example where an Ant Design Vue date‑range picker is generated as:

const queryDate = ref([])

<a-range-picker v-model:value="queryDate"/>

Three limitations of this direct generation are identified: missing quick‑select options, mismatched date formats (timezone vs. YYYY‑MM‑DD), and output as an array instead of separate start/end strings. Consequently, a custom wrapper component is required.

The second‑generation AI code‑generation workflow (AI 2.0) introduces two main steps: (1) crawl API documentation to produce TypeScript type definitions and API functions; (2) select page templates (charts, lists) and components. Improvements include presetting all backend endpoints, preview windows for generated code, and automatic handling of add/edit/delete flags.

Handling inaccurate results is discussed in three categories: inconsistent output formats (markdown tags), deviation from example templates, and fragmented component logic. Solutions involve stripping markdown tags, using regex/AST (e.g., ts‑morph) to rename functions, and key‑based matching to assemble the correct code.

In conclusion, fully autonomous AI code creation remains difficult, but using AI to match and transform pre‑packaged, modular components can reliably produce code that conforms to internal standards. Future work will focus on extracting fixed‑process business scenarios into reusable templates, gradually replacing manual copy‑paste with AI‑driven matching.

frontendtypescriptAutomationAI code generationVueadmin panel
37 Interactive Technology Team
Written by

37 Interactive Technology Team

37 Interactive Technology Center

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.