Building a website has traditionally meant wrestling with complicated code, hosting setups, and layout design — a barrier that keeps local micro-merchants and non-technical creators offline entirely.
But what if you could spin up a fully responsive, custom website just by having a normal conversation on your phone?
That's the idea behind Chat2Site — a conversational micro-SaaS platform that turns natural language into a fully deployed, edge-hosted website.
To avoid the usual "AI code hallucinations" — broken layouts, missing tags, malformed CSS — I built it around Google's open-weights model, Gemma 2 9B. Here's how the project came together, how the architecture works, and why Gemma 2 9B turned out to be the right choice for it.
The Challenge: Structural Coherence in LLM Code Generation
Ask a standard LLM to generate frontend code straight from a chat conversation, and two problems show up fast:
Structural hallucinations — LLMs are good at writing prose, but they struggle to hold rigid syntax together over long context windows. One unclosed or one malformed JSON string, and the whole layout falls apart.
Resource and latency constraints — running a large model for real-time chat-to-code generation is slow and too expensive to make sense for a micro-SaaS product.
What the project actually needed was a model that was efficient, tuned well for code, and reliable at producing tightly structured output.
Enter Google's Gemma 2 9B 🧠
Built on the same underlying research as Google's Gemini models, Gemma 2 9B is a small but genuinely capable open-weights model.
Trained on roughly 8 trillion tokens, much of it web documents and code, and shaped further through knowledge distillation from larger teacher models, it performs well above what you'd expect from its size. Its reasoning and its ability to parse structured text made it a natural fit for schema-constrained generation.
How Chat2Site Works: The Dual-Stage Pipeline
Rather than asking Gemma 2 9B to write raw HTML and CSS from scratch, which introduces too much room for error, Chat2Site runs a two-stage compilation pipeline designed to keep structure intact.
Stage 1: Schema-Constrained Information Extraction
The user talks to a conversational client, whether that's a Telegram bot or a web chat interface. Gemma 2 9B reads through that multi-turn conversation and maps it into a structured JSON schema:
json{
"business_name": "Bayside Bakery",
"hero_headline": "Artisanal Sourdough Baked Daily",
"primary_color": "#D2B48C",
"services": [
{"name": "Croissants", "price": "$4.50"},
{"name": "Sourdough Boule", "price": "$8.00"}
]
}
Because Gemma 2 9B follows instructions closely, the output format stays consistent. The model pulls out the relevant variables cleanly, which is a big part of why completeness and correctness improved so much.
Stage 2: Template Compilation and Edge Deployment
Once that JSON is validated, the structured data gets injected into pre-built, responsive HTML/CSS template grids. That's what removes the risk of a broken div or a faulty script — the layout was never generated freehand in the first place. The final static bundle then deploys directly to global edge hosting, and the vendor is live in under a minute.
Why Gemma 2 9B Shined in This Project
Reliable JSON generation — it followed the system prompt closely and consistently produced valid, parsable JSON without drifting off track.
Genuine efficiency — its Grouped-Query Attention and optimized architecture kept inference fast, so the conversation stayed real-time and fluid.
Low operational overhead — as a 9B-parameter open model, it's cheap and easy to host, which matters a lot for keeping a micro-SaaS product financially sustainable.
The Big Picture: Digital Inclusion
Pairing Google's open-weights models with a straightforward, chat-based interface lets local merchants get online in minutes, skip expensive agency fees, and connect directly with their local digital economy.
A big thank-you to the Google Cloud Gen AI Academy APAC community for the tools, resources, and encouragement to push what's possible with open-weights LLMs.
💡 Live MVP prototype: cha2site.streamlit.app
Top comments (0)