LLM-Driven Vibe Coding: From Architecture Planning to Full-Stack Delivery

    This article explains why generating working code is not the same as delivering a complete system, and how LLM-driven Vibe Coding can be organized into a reusable engineering workflow. It covers the shift from snippet generation to architecture collaboration, a case study of an image community app with waterfall feeds, upload management, and AI creation, plus context engineering, quality gates, common pitfalls, and cost governance needed to move from demo to production.

    1. The Problem: Why “Writing Code” Is Not the Same as “Delivering a System”

    After AI coding tools became part of everyday development, a common pattern emerged: a model can quickly produce function-level implementations, yet it still struggles to independently support the delivery of a complete application. The reason is not mysterious—function-level generation solves local correctness, while system delivery solves constraint satisfaction: whether data structures are extensible, whether interface boundaries are clear, whether failure paths are handled, and whether permissions and quotas are controlled. Locally correct pieces assembled together often do not add up to global consistency.

    Therefore, the maturity of a model in coding scenarios should not be judged only by whether it can “write code that runs.” It should be judged by three capabilities: first, whether it can clarify requirements and plan the architecture before writing code; second, whether it can maintain consistent abstractions and naming across multiple modules; third, whether it can self-correct against constraints when deviations appear. This article focuses on LLM-driven Vibe Coding practices and discusses how to organize these capabilities into a reusable engineering process.

    2. Role Shift: From Code Snippet Generator to Architecture Collaborator

    The traditional usage can be summarized as “ordering-from-a-menu collaboration”: a human gives fine-grained instructions, the model returns an implementation, and the human assembles, debugs, and patches the gaps. This works efficiently for small scripts, but once you move into applications with multiple pages, multiple roles, and multiple external dependencies, communication costs quickly exceed the coding gains.

    A more mature approach is “delegated collaboration”: a human provides the goal, constraints, and acceptance criteria, and the model first produces a plan, then implements it module by module. The planning stage should cover at least the following:

    • Client-side choices: page structure, navigation patterns, and state management;
    • Server-side shape: responsibilities of the managed runtime, managed database, and object storage;
    • External capability integration: which types of model services handle visual understanding, text optimization, and image generation;
    • Data model: core entities, indexes, and pagination and filtering strategies;
    • Delivery boundaries: which capabilities come first and which are left for later iterations.

    A sample plan skeleton can be written as structured text for easier retrieval and reuse:

    1. Goal: lightweight image community app
    2. Client: native mini program, three main pages (Home / Create / Profile)
    3. Server: managed cloud functions + managed database + object storage
    4. External capabilities: visual understanding model / text optimization model / image generation model
    5. Core entities: wallpaper, album, artwork, user
    6. Key constraints: pagination limit, upload size limit, no keys shipped to the client

    When the plan is written down explicitly, every piece of code the model generates afterward has an “alignment anchor,” and cross-file consistency improves significantly.

    3. Case Breakdown: An App with Waterfall Feed, Upload Management, and AI Creation

    3.1 Requirement Clarification

    Raw requirements often mix functional and experience descriptions and must first be turned into verifiable items. For example, “wallpaper waterfall feed” should be broken down into: data source, sorting rules, pagination cursor, multiple image sizes, lazy loading and placeholders, and retry on failure; “upload management” should be broken down into: temporary credential acquisition, client-side compression, resumable uploads, content safety checks, and quota limits; “AI creation” should be broken down into: input capture, structured analysis, prompt editing, generation parameters, and result saving and re-editing.

    3.2 Architecture and Data Model

    Under a managed backend, it is recommended to put “read-heavy, write-light” content in the managed database, binary resources in object storage, and logic that requires authentication and external calls into managed cloud functions. The core collections can be abstracted as:

    1. wallpaper(id, title, albumId, tags[], width, height, storageKey, createdAt)
    2. album(id, name, coverKey, sort)
    3. artwork(id, ownerId, sourceKey, prompt, model, params, resultKey, createdAt)

    For indexing, the home waterfall feed usually runs a combined query on “creation time + category,” so a composite index should be created; pagination should prefer a cursor over large offsets to avoid performance degradation from deep paging.

    3.3 Cloud Function Responsibilities

    Cloud functions should be divided by “change boundaries” rather than “number of files.” A common split is:

    1. auth.issueUploadTicket() // issue a restricted temporary upload credential
    2. content.listWallpapers() // category + cursor pagination
    3. content.getAlbumDetail() // aggregated album read
    4. artwork.analyze() // call visual understanding to produce structured tags
    5. artwork.generate() // assemble prompt and call image generation
    6. artwork.save() // persist and bind the storage key

    On security, two bottom lines must be followed: temporary credentials must have least privilege and short validity; all external model calls must be initiated only on the server side, and the client must not hold any long-term keys.

    3.4 Key Flow: Upload, Analysis, Generation

    The recommended creation flow is “compress—upload—analyze—edit—generate—save.” The client first performs proportional compression and format normalization to reduce bandwidth and storage pressure; after the server receives the storage key, it calls visual understanding to output three types of tags: subject, style, and atmosphere; then a text model organizes the tags into a controllable prompt, highlights key elements, and allows the user to manually add or remove them; finally, it requests generation with parameters such as size and style strength, and the result is uniformly transferred to object storage before returning a reference.

    The skeleton expressed in pseudocode:

    1. ticket = auth.issueUploadTicket(scope="artwork", ttl=600s)
    2. key = client.upload(compressedImage, ticket)
    3. tags = artwork.analyze(key) // {subject, style, atmosphere}
    4. prompt = buildPrompt(tags, userEdits) // structured assembly + constraint terms
    5. result = artwork.generate(prompt, params)
    6. artwork.save(ownerId, key, prompt, result)

    4. Context Engineering: The Invisible Variable That Determines Success

    The same model can perform very differently under different context organization. In practice, four rules can be followed:

    1. First lock down the “project contract”: write the tech stack, directory structure, naming conventions, and error-handling conventions into long-term context;
    2. Advance only one module at a time, avoiding large-scale cross-module rewrites;
    3. Have the model restate the constraints before acting to reduce “understanding drift”;
    4. After changes, require an impact list and confirm it manually before merging.

    A reusable prompt template:

    1. Constraints: native mini program + managed cloud functions + managed database + object storage
    2. Prohibited: long-term keys on the client; large-offset pagination
    3. Output: first give interface signatures and data structures, then the implementation, and finally a self-test checklist

    5. Quality Assurance: Turning “It Runs” into “It Is Maintainable”

    A typical risk of LLM-generated code is “the happy path is complete, but the exception paths are missing.” It is recommended to establish four gates:

    • Static checks: unified formatting and rule validation to intercept obvious defects;
    • Contract tests: assert on cloud function inputs and return structures to prevent field drift;
    • Capacity and quota checks: explicit validation of upload size, pagination limits, and concurrency limits;
    • Observability: structured logs + key-path tracing + failure-rate alerts to help locate jitter in external model calls.

    In addition, cost governance should be moved earlier: set daily quotas and cache-reuse strategies for image generation, and short-term caching of results for identical prompts and parameters can significantly reduce repeated consumption.

    6. Common Pitfalls and How to Avoid Them

    • Pitfall 1: Skipping the planning stage and having the model write pages directly. The result is rework costs higher than design costs.
    • Pitfall 2: Stuffing all logic into a single cloud function. Once responsibilities bloat, it becomes hard to test and evolve.
    • Pitfall 3: Over-trusting the “runnability” of generated results. Without contract tests, field inconsistencies often erupt all at once during integration.
    • Pitfall 4: Ignoring the permission model. If temporary credentials are too broadly scoped, it is equivalent to making storage write access public.

    7. Conclusion

    The value of LLMs in coding scenarios is shifting from “how fast it writes” to “how stable the structure is.” When a model can complete technology selection before acting, maintain abstraction consistency during the process, and correct against constraints when deviations appear, it is no longer a snippet generator but a collaborator that can share design responsibility. It is worth emphasizing that tool capability is only the ceiling; process and constraints determine the actual output: writing the contract clearly, drawing the boundaries explicitly, and making acceptance automated are the key steps to move Vibe Coding from demo to production.