Vibe Coding with LLMs: A Practical Guide to Architecture-First Development
This article explains how large language models have shifted from generating code snippets to designing system architecture, and why this change is the foundation of effective Vibe Coding. It walks through a cloud-integrated mini program project across four layers—data, services, UI, and AI capabilities—covering cursor-based pagination, a three-stage upload pipeline, and a four-step AI image generation flow with structured JSON as the intermediate contract. It also outlines the conditions that let a 30+ file project run out of the box, the engineering discipline still required, and how developers can stay relevant as models keep evolving.
1. From Writing Code to Building the Skeleton: How the Role of LLMs Has Changed
After LLMs were introduced into intelligent coding tools, one thing many developers noticed right away: the model is no longer just a snippet generator for tasks like “write me a carousel.” It has started to take on system skeleton design. The core of this shift is not that the model outputs more code, but whether it can produce an executable technical plan before any coding begins.
Take a mini program integration project as an example. The requirements usually span several relatively independent subdomains: content browsing, user uploads with admin management, and AI image capabilities. The old workflow had developers slicing requirements into fragments, requesting code piece by piece, then stitching, debugging, and patching it together themselves. A more capable model first clarifies requirements and decomposes the architecture, produces a design with clear layering, and only then moves into coding.
A typical architecture output should cover at least these dimensions:
- Frontend form and page structure: for example, native mini program development with three bottom-level entries (Home, AI Image Generation, Profile), with clear responsibility boundaries for each page.
- Backend form: cloud-integrated development (cloud database + cloud functions + object storage) to reduce the operational burden of self-hosted servers.
- Capability integration plan: image understanding, text prompt optimization, and image generation map to different model capabilities, and their input/output contracts must be defined.
- Data model: collection partitioning, index design, pagination and filtering fields.
- Engineering conventions: directory structure, naming conventions, error codes, logging, and analytics tracking.
A sample requirement description can be organized like this:
Goal: Build a mini program for image content + AI generationConstraints: No self-hosted servers; must support pagination, categorization, and permission isolationDeliverables: Architecture -> Data model -> Cloud function list -> Pages and components -> Integration notes
When the model delivers the architecture before the code, the developer’s role moves forward from “reviewing code line by line” to “reviewing the design and setting boundaries.” This is exactly where Vibe Coding gains its efficiency.
2. Module Breakdown Under a Cloud-Integrated Architecture
Once the architecture is settled, the implementation phase should proceed in the order of data layer, service layer, presentation layer, and AI capability layer. Each layer can be verified independently, which avoids generating too much coupled code in one pass.
1. Data Layer and Content Browsing
For a content waterfall, the key is not layout but query and caching strategy. A sound approach: store image metadata (category, tags, dimensions, creation time) in a collection, keep the actual files in object storage, and link the two through a unique identifier. On the query side, use a composite index on creation time plus category, combined with cursor-based pagination, to avoid the performance degradation that comes with deep page offsets.
// Cloud function: cursor-based pagination by category (illustrative)exports.main = async (event) => {const { category, cursor, size = 20 } = event;const db = cloud.database();let q = db.collection('wallpaper').where({ category }).orderBy('createdAt', 'desc').limit(size);if (cursor) q = q.where({ createdAt: _.lt(cursor) });const res = await q.get();return {list: res.data,nextCursor: res.data.at(-1)?.createdAt ?? null};};
The waterfall component should encapsulate lazy loading and placeholder logic itself: prefetch the next page as scrolling nears the bottom, and backfill real heights after images finish loading to avoid layout shift.
2. Uploads and Admin Management
The upload path works best as three stages: direct-to-object-storage upload with temporary credentials, client-side compression, and server-side validation. The client compresses to a reasonable resolution first, reducing traffic and storage costs. The server then validates file type, size, and content hash inside a cloud function, writes the metadata, and triggers downstream processing. The admin console only needs to cover three high-frequency operations: list search, bulk takedown, and category maintenance.
3. The AI Image Generation Pipeline
This is the part that best demonstrates model engineering capability. The recommended approach splits it into four steps, each with clear inputs and outputs:
- Upload and preprocessing: compression, cropping, and format normalization.
- Image understanding: produce a structured description across three dimensions—subject, style, and background atmosphere.
- Prompt optimization: a text model rewrites the structured description into a reusable generation prompt and annotates the weight of key elements.
- Generation and post-processing: call the image generation capability to produce candidates, with support for saving, regenerating, and further editing.
Structured intermediate results (JSON) are easier for downstream consumers than natural language:
{"subject": "half-body portrait","style": "low-saturation film look","background": "blurred city night scene","prompt": "cinematic portrait, film grain, bokeh city lights","tags": ["portrait", "night", "film"]}
3. Why a 30+ File Project Can Run Out of the Box
A multi-file project running out of the box is no accident. It usually meets three conditions: first, architecture comes first, so module boundaries and dependency directions are already fixed; second, engineering conventions are consistent across naming, error handling, and directory structure; third, each layer can be verified independently, so problems can be localized.
In practice, you should still maintain the necessary engineering discipline:
- Get the minimal closed loop working first (list, detail, upload), then extend the AI capabilities.
- Add unified error codes and log fields to cloud functions to make troubleshooting easier.
- Keep “review the design first” for model output, especially around permissions, quotas, and data consistency.
- Add automated tests for critical paths, or at least a repeatable manual verification checklist.
4. How Developers Can Keep Up With the Pace of Model Iteration
The anxiety that comes from continuously evolving model capabilities essentially comes from mistaking “coding speed” for the core competitive skill. A more reliable strategy is to shift focus to three capabilities that are hard to replace: problem definition and requirement clarification, system design and boundary constraints, and result validation and quality control.
Practical steps include: building up personal or team architecture templates and review checklists; handing repetitive work to intelligent coding tools while keeping judgment for yourself; and continuously practicing turning vague requirements into structured specifications. If your team already uses these capabilities in a cloud environment, you can combine them with general cloud product capabilities such as object storage, cloud functions, log services, and monitoring and alerting from Baidu AI Cloud to build a delivery process that is observable and rollback-capable.
The stronger the tools, the more human value shows up in “deciding what to build and judging whether it was built correctly.” Treating the LLM as a colleague who can help build the skeleton, rather than a faster typewriter, is where the real efficiency of Vibe Coding comes from.
