LLM-Driven Mini-Program Development: From Requirements to Deployment

    This article explores the paradigm shift in software development assisted by Large Language Models (LLMs), moving from generating isolated code snippets to acting as comprehensive software engineering collaborators. Through a practical project involving a wallpaper mini-program with AI image generation and analysis capabilities, the article details how to leverage LLMs for requirement analysis, system architecture design, database modeling, and modular code generation. It also highlights engineering edge cases, effective prompt strategies, and the critical boundary between what LLMs excel at and what still requires human judgment, ultimately arguing that true efficiency gains come from changing the collaborative workflow rather than merely generating code.

    In the past, common ways of using LLMs for programming assistance often involved asking the model to generate a specific button, an API call, or fix a bug. While this approach does speed up coding, developers still have to handle the overall design, module integration, data planning, and troubleshooting themselves.

    The truly noteworthy shift is that LLMs are transitioning from “code snippet generators” to “software engineering collaborators.” In a development practice for a wallpaper and AI image processing mini-program, the LLM did not just output a massive amount of scattered code. Instead, it first broke down features around business objectives, planned the system architecture, and then progressively generated runnable modules. This workflow offers strong reference value for individual developers, small teams, and enterprise users needing rapid idea validation.

    1. The Core Conclusion: Value Beyond Writing Code

    From practical experience, the core value of LLMs in such projects manifests in four key areas.

    First, it helps developers translate vague requirements into clear functional boundaries. For instance, “build a wallpaper mini-program that supports AI image generation” is not a complete requirement. It needs further clarification on homepage display, image categories, user navigation paths, generation processes, data storage, and management capabilities.

    Second, it participates in system architecture design. Structured suggestions can be applied early on regarding frontend page division, backend service responsibilities, database fields, file storage strategies, and asynchronous task processing.

    Third, it can continuously complete multiple modules according to the established architecture, maintaining consistency across pages, data, and services, rather than just solving isolated problems—provided the context is sufficient.

    Fourth, it handles engineering tasks like input validation, pagination loading, image compression, error prompts, empty state displays, and basic logging. These details may seem trivial but determine whether a project is genuinely runnable or just停留在 a demo stage.

    Therefore, the LLM’s role should not be viewed merely as “typing code for developers,” but rather as a technical assistant participating in analysis, design, implementation, and review.

    2. Project Requirements: A Wallpaper App with AI Capabilities

    This practice revolves around a typical mini-program scenario, primarily including the following capabilities:

    • Wallpaper Homepage: Display images by category, supporting pagination and waterfall layout.
    • Wallpaper Details: View full image, favorite, save, and continue editing.
    • User Management: Maintain user uploads and personal operation history.
    • AI Generation: Generate images based on text descriptions.
    • Image Analysis: Upload an image to identify the subject, style, composition, and atmosphere.
    • Prompt Editing: Modify, supplement, and optimize analysis results.
    • Image Recreation: Generate new images based on the original image and edited descriptions.
    • Basic Management: Maintain categories, review images, and handle anomalous data.

    Directly asking the model to “write out these features” easily results in disorganized code. A better approach is to first ask the model to summarize the requirements, then output the page structure, data flow, and API boundaries.

    3. Start with Requirements Analysis, Not Code

    In the early stages of a project, instruct the LLM to analyze in the following order:

    1. Identify user roles.
    2. Outline core user journeys.
    3. Distinguish between mandatory and optional features.
    4. Define navigation relationships between pages.
    5. Design data entities and their associations.
    6. Plan file upload, image processing, and AI invocation workflows.
    7. List potential exceptions and security risks.

    For example, a user uploading an image for analysis involves at least the following steps:

    1. Select Image
    2. ↓
    3. Client-side compression and format check
    4. ↓
    5. Upload to object storage
    6. ↓
    7. Retrieve image access URL or temporary credentials
    8. ↓
    9. Invoke image analysis capability
    10. ↓
    11. Return structured analysis results
    12. ↓
    13. User edits prompt
    14. ↓
    15. Initiate image generation task
    16. ↓
    17. Save and display generated results

    Such a flowchart is more important than directly generating code. It first answers “how the system should work,” providing a clear basis for subsequent coding.

    4. Rational System Architecture Design

    For small to medium-sized mini-programs, the frontend can utilize native mini-program technologies, divided into three main areas by business domain:

    1. Homepage Module

    Handles wallpaper browsing, category filtering, and pagination. To avoid loading too many images at once, combine paginated queries with load-on-scroll. The waterfall layout must carefully consider image aspect ratios. If image sizes vary, the backend can return width and height info, allowing the frontend to calculate display heights based on container width, thereby reducing layout shifts.

    2. AI Creation Module

    This module can be further split into:

    • Text-to-image generation;
    • Image analysis;
    • Image editing;
    • Style transfer;
    • Result saving;
    • History queries.

    It is best to host different capabilities through independent services or cloud functions to avoid concentrating all logic in a single API. This facilitates debugging and provides flexibility when swapping models or adding new processing workflows later.

    3. Personal Center Module

    Displays user uploads, generation records, favorites, and account status. For features involving user content, consider deletion, retraction, moderation, and access control.

    The backend can utilize general capabilities like cloud databases, cloud functions, and object storage. The database stores structured information; file storage saves original images and generated results; cloud functions execute paginated queries, permission checks, file processing, and AI task invocations.

    5. Database Design Determines Maintenance Costs

    A viable data structure must consider at least the following entities:

    Wallpaper Table

    Main fields include:

    • Image title
    • Image URL
    • Thumbnail URL
    • Category ID
    • Image width and height
    • Uploading user
    • Moderation status
    • Creation time
    • Usage count or favorites count

    Generation Record Table

    Can store:

    • User ID
    • Original image URL
    • User input description
    • Automated analysis result
    • Final prompt used
    • Task status
    • Generated result URL
    • Failure reason
    • Creation time

    Category Table

    Used to maintain wallpaper categories, sort weights, enabled status, and display names.

    When designing the database, avoid putting all information into a single large object. Separate basic wallpaper info, generation tasks, and user behavior. This reduces coupling during updates and makes it easier to add search, statistics, and moderation features later.

    6. Modular Generation is More Reliable Than One-Shot Generation

    In actual development, asking the model to generate the entire project at once may seem highly efficient, but carries clear risks:

    • File references might be inconsistent.
    • Page fields might mismatch database fields.
    • Exception handling might be omitted.
    • Issues in generated code can be hard to locate.
    • Context can easily be lost during subsequent modifications.

    A more reliable approach is to proceed module by module:

    1. Generate the project directory and page skeleton first.
    2. Then generate the database access layer.
    3. Implement homepage pagination and category filtering.
    4. Implement image upload and compression.
    5. Integrate the image analysis workflow.
    6. Finally, complete generation records, saving, and history queries.

    After completing each module, ask the model to explain:

    • Which files were modified.
    • What new fields were added.
    • What prerequisites are needed.
    • How to run and verify.
    • What exceptions might occur.

    This approach keeps developers in control of the project rather than facing a batch of incomprehensible code.

    7. Engineering Details in AI Image Workflows

    Image features are not just about calling a model; real projects require handling many edge cases.

    Image Upload

    The client should restrict file size and format, and compress the image before uploading. For mobile devices, large original images increase wait times and network consumption. Compression should retain main subject clarity while avoiding files that exceed backend processing capabilities.

    Image Analysis

    Analysis results are best returned in a structured format, for example:

    1. {
    2. "subject": "Subject description",
    3. "style": "Visual style",
    4. "composition": "Composition features",
    5. "background": "Background atmosphere",
    6. "keywords": ["Keyword 1", "Keyword 2"]
    7. }

    Structured output facilitates frontend display and user editing, while reducing the complexity of subsequent processing.

    Generation Tasks

    Image generation may not be instantaneous. Design task statuses such as “Pending”, “Processing”, “Completed”, and “Failed”. The frontend should retrieve results via polling or push notifications, and must not assume the API will immediately return the final image.

    Failure Handling

    Common failure reasons include image inaccessibility, incomplete input, temporary service unavailability, task timeouts, and duplicate user submissions. Provide understandable prompts for each scenario and retain necessary error logs to help developers troubleshoot.

    8. What LLMs Excel At and What They Don’t

    In practice, LLMs are particularly suited for:

    • Outlining requirements and user journeys.
    • Designing module boundaries.
    • Generating base pages and common components.
    • Writing data access logic.
    • Adding parameter validation and exception handling.
    • Explaining error causes.
    • Generating test cases.
    • Providing refactoring suggestions for existing code.

    However, it cannot replace human judgment. The following still require manual confirmation:

    • Authentication and permission control.
    • User data and image access permissions.
    • File upload security.
    • Content moderation strategies.
    • Sensitive information protection.
    • Performance in real-world environments.
    • Whether generated results meet product expectations.
    • Costs, resources, and concurrency limits.

    Especially when dealing with user images and AI-generated content, don’t just focus on “whether it runs.” Pay attention to whether data is accidentally exposed, whether resource URLs remain valid long-term, whether users can delete their own content, and whether anomalous tasks continuously consume resources.

    9. Designing Effective Prompts

    A high-quality prompt should not just state a requirement; it should include background, goals, constraints, and acceptance criteria.

    For example, describe it using the following structure:

    1. Project Background: This is a mini-program for browsing and generating wallpapers.
    2. Current Goal: Implement the image upload and analysis page.
    3. Existing Conditions: The project has completed user login and object storage configuration.
    4. Feature Requirements: Support selecting, compressing, uploading, and analyzing images, then displaying results.
    5. Exception Requirements: Handle oversized files, upload failures, analysis timeouts, and duplicate submissions.
    6. Output Requirements: List the files to be modified and explain each file's responsibilities.
    7. Acceptance Criteria: The page completes the full operational chain, displaying clear prompts on failure.

    Compared to “Help me write an image analysis page,” such instructions are more likely to yield executable results.

    10. Final Assessment: Efficiency Gains Come from Changing Collaboration Methods

    The most noticeable takeaway from this practice is not how many files the LLM can generate at once, but that it now participates in the entire software development lifecycle. From requirement breakdown and architecture planning to module implementation, bug fixing, and feature completion, the model undertakes an increasing amount of assistance.

    However, the developer’s role has not disappeared; it has become more important. Developers must confirm business goals, evaluate technical solutions, review code quality, verify security boundaries, and decide which suggestions can actually be implemented.

    To be precise, the change brought by LLMs is not that “programmers no longer write code.” Instead, it frees programmers from repetitive coding, allowing them to dedicate more energy to system design, product trade-offs, and quality assurance.

    For teams looking to rapidly prototype or build small to medium-sized applications, it is recommended to use LLMs with a “architecture first, then modules; flow first, then code; validation first, then expansion” approach. Only by combining human judgment with model generation can AI truly become a reliable technical collaborator rather than just a tool for generating scattered code.