LLM-Driven Coding in Practice: From Architecture Design to Full-Stack Delivery

    This article examines how large language models are reshaping software development, shifting their role from generating code snippets to producing complete, reviewable technical solutions. Using a wallpaper mini-program as a running example, it walks through decomposing a one-line requirement into a five-layer architecture, defining data models and cloud function boundaries, handling waterfall layouts and upload pipelines, structuring AI image-generation output, and clarifying where human review remains essential. Readers will find a reusable checklist for getting solutions before code, encoding constraints up front, and treating security, cost, and quotas as acceptance criteria.

    1. The Real Shift: From “Giving Code” to “Giving a Solution”

    In the past, when you described a requirement to an AI coding tool, what you usually got back was a runnable fragment: a carousel, a form, a request wrapper. Developers still had to make the technology choices, assemble the pieces, and fill in the gaps themselves. The model’s actual role was closer to that of an “advanced snippet generator.”

    But when the task scales up to “a complete application with content browsing, user upload management, AI image generation, and an admin backend,” the interaction pattern changes. The model first outputs a technical plan, then produces code module by module. This difference in ordering is the key dividing line for judging whether a model has real engineering-collaboration ability: align on constraints first, then implement. Rework costs drop significantly as a result.

    2. From Requirement to Solution: Turning One Sentence into a Reviewable Architecture

    Faced with a one-line requirement like “build a wallpaper mini-program that supports waterfall browsing, upload management, AI image generation, and image editing,” a reasonable breakdown should cover five layers:

    • Frontend form: A native mini-program framework with three main tabs (content home, AI creation, personal center), reusing a unified request layer and state management.
    • Backend form: An integrated cloud approach, where a cloud database holds metadata, cloud functions carry business logic, and object storage holds image assets, avoiding the operational burden of self-hosted servers.
    • AI capability orchestration: Split into three general capabilities — a vision model for image content analysis, a text model for prompt rewriting and expansion, and an image generation model for text-to-image and image-to-image.
    • Feature list: Content library (home, album details, full-size preview, download), AI creation (upload, analysis, editing, style transfer, generation), and admin side (content moderation, category maintenance).
    • Data and deployment details: Collection and index design, cloud function responsibility boundaries, the upload compression pipeline, and how temporary credentials are obtained.

    The value of this output is not that it “guesses correctly,” but that it makes implicit decisions explicit, letting developers review and course-correct before writing the first line of code.

    3. Data Model and Cloud Function Boundaries (Illustrative)

    The core of the content library is a three-tier “category — album — image” structure. Pagination and filtering are pushed down into cloud functions to avoid the client pulling the full dataset:

    1. // Illustrative: paginated query cloud function
    2. exports.main = async (event) => {
    3. const { page = 1, size = 20, category, albumId } = event;
    4. const where = {};
    5. if (category) where.category = category;
    6. if (albumId) where.albumId = albumId;
    7. const skip = (page - 1) * size;
    8. const db = cloud.database();
    9. const [list, total] = await Promise.all([
    10. db.collection('wallpaper').where(where)
    11. .orderBy('createdAt', 'desc').skip(skip).limit(size).get(),
    12. db.collection('wallpaper').where(where).count()
    13. ]);
    14. return { list: list.data, total: total.total, hasMore: skip + size < total.total };
    15. };

    A suggested principle for splitting cloud functions is “separate reads from writes + isolate third-party calls”: content queries, upload signing, and AI orchestration each stay independent, making it easier to scale and rate-limit them individually.

    4. Two Error-Prone Points in the Waterfall Layout and Upload Pipeline

    Lazy loading and placeholders: A waterfall layout is not just a simple two-column arrangement. You need to dynamically compute the number of columns and the accumulated height of each column based on container width, and use IntersectionObserver to trigger the next page. Images should use thumbnail placeholders with lazy-loaded originals to avoid a first-screen request storm.

    1. // Illustrative: height distribution for a two-column waterfall
    2. const cols = [[], []];
    3. list.forEach(item => {
    4. const target = cols[0].reduce((a, b) => a.h <= b.h ? a : b);
    5. target.push(item);
    6. target.h += item.ratio ? 1 / item.ratio : 1;
    7. });

    Upload compression and credentials: Compressing on the client before uploading can significantly reduce traffic and storage costs. Upload credentials should use short-lived temporary keys; never hardcode long-term keys on the client. Compression parameters need fallbacks based on platform capabilities to avoid memory spikes from large images.

    5. The AI Image Generation Pipeline: Making “Analysis” a Structured Output

    A reliable creation pipeline is: upload → visual analysis → structured prompt → user editing → generation → save or retry. The key is to have the model output structured data rather than free text, so the frontend can render it and support secondary editing:

    1. {
    2. "subject": "Subject: a woman in a beige trench coat, glancing back over her shoulder",
    3. "style": "Style: Japanese film look, low saturation, soft light",
    4. "scene": "Background: a street at dusk, shallow depth of field with blur",
    5. "prompt": "cinematic film photo, beige trench coat, ...",
    6. "keywords": ["trench coat", "dusk", "film grain"]
    7. }

    Separating these dimensions has clear benefits: users can change only the style while keeping the subject, and the frontend can highlight key elements. When generation fails, retaining context for a retry is a better experience than re-uploading.

    6. The Boundary of Human-Machine Collaboration: The Model Delivers, Humans Sign Off

    Generating dozens of files that run immediately shows that generation ability is no longer the bottleneck — review ability is. Items that must be confirmed by a human include:

    1. Security: Cloud function input validation, permission rules, upload type and size limits, and keeping keys off the client.
    2. Cost: Rate limiting and result caching for AI calls, and daily quotas for image generation.
    3. Compliance: Moderation and record-keeping for user-generated content, plus privacy policy and consent flows.
    4. Maintainability: Directory structure, naming conventions, and unified error codes, avoiding code that “runs but is hard to change.”

    7. A Reusable Practice Checklist

    • Ask for the solution before the code, moving technology-choice debates to the front.
    • Include constraints in the requirement description: scale, platform, performance, and compliance.
    • Advance module by module in small steps, with each step independently verifiable.
    • Have the AI output structured data contracts rather than prose-style results.
    • Write security, cost, and quotas into the acceptance criteria.

    The conclusion is clear: the value of large language models in coding has shifted from “writing faster” to “thinking more completely.” What developers truly need to upgrade are three abilities: stating requirements clearly, evaluating solutions thoroughly, and keeping risks under control.