Zero Labs
Industry News / AI

The Architecture I Used to Build Speakroom, an AI Voice Language Practice App

Source · Towards AI By Kamen Zhekov

From the publisher’s feed, collected in the ZeroLabs newsroom.

I recently built and released Speakroom, a language practice app where you can choose a language, choose a theme, talk about it with an AI, and get feedback on your conversation in real time.https://medium.com/media/87bda94f01353877968abf75c03ead66/hrefThe part that looks exciting is obviously the voice interaction. You talk, the system responds, feedback shows up, marvelous. As a developer, that is also the part you expect to be the hardest, but in practice a lot of it gets carried pretty hard by the AI model you are using.The more interesting part for me was the architecture around it, because that is where the app either stays understandable or slowly turns into soup. Speakroom used a Python / React architecture I really like: FastAPI for the backend, React and Vite for the frontend, Postgres for durable state, and a worker process for background work. That shape didn’t come from nowhere. I’d built a small starter template around exactly these concerns, and its example feature happens to be document processing rather than speaking practice. Speakroom reuses the starter’s structure and seams, not its feature, which is what the template is built for.Nothing exotic, nothing that looks impressive on a conference slide, but a very nice shape if you want to build a real product without turning every feature into a small research project. The thing I liked most was that it made obvious where code goes.The app has an obvious runtime shapeThe runtime shape is pretty plain:a React frontenda FastAPI APIa Postgres databasea worker processprovider integration code behind backend seamsArchitecture Diagram | Kamen ZhekovThat sounds basic, but basic is often what you want. The frontend owns browser behavior, the API owns request handling and orchestration, the database owns durable product state, and the worker owns background work that should not block a request.The important part is that these boundaries shape the product as much as deployment: the frontend talks to the app API, the app API talks to domain services, workers open their own sessions and work from IDs, and provider adapters sit behind backend code instead of leaking into the browser.That structure helped a lot with Speakroom because the app has more around it than a voice session: accounts, credits, billing, session review, deletion, privacy boundaries, runtime checks, and a bunch of normal user behavior around the shiny part. A demo can ignore most of that, but a product has to carry it eventually. By the way, if you’re interested in testing it out, check out the link below.Speakroom - AI speaking practice in 24 languagesRoutes should stay boringOne of the fastest ways to ruin a backend is to let route handlers become the place where everything happens, because they are close to the request and they are easy to edit. This architecture pushes against that pretty directly: routes parse input, call the right service, and return a response, while the actual logic lives in feature-local domain modules.I like that split because it keeps the public API surface readable without turning the backend into a generic framework. You can open a route file and understand what resource it exposes, then open the feature service and see the actual business logic.For Speakroom, this mattered because a lot of flows are multi-step even when the user action looks simple. Starting something, charging something, saving something, reviewing something, deleting something, and recovering from failure are all different responsibilities, and if all of that ends up in route handlers, you can still ship, but every future change gets a bit worse.I care less about purity and more about being able to come back later, with or without an agent, and know where the next change belongs.Product state should belong to the appThe starter’s worked example is a document flow, which has nothing to do with talking to an AI tutor. That shape is the point, not the feature. Initially, the its frontend uploaded documents, the backend persisted app-owned records, the worker processed them, and the frontend polled a product-level job resource until the work finished.That product-level job resource is the part I care about. The queue is delivery infrastructure, while the app-owned record is the product contract. The browser should not depend on queue tables or worker internals, because those are implementation details and they will change for reasons the user does not care about.That maps nicely to AI products. There is always some tempting internal state you could leak: queue status, provider status, retry status, partial worker state, maybe some random provider response shape that seems useful for 5 minutes. Once the frontend depends on that, the implementation has become part of the product, which is something I try pretty hard to avoid, because the browser should know what the user needs to know and the backend can keep the plumbing to itself.Prompts are product codeAnother part of the architecture I liked was the LLM integration split: the feature owns the prompt and expected output shape, while the provider adapter owns transport, provider options, and error mapping.That sounds obvious, but I have seen this get messy fast. You start with a provider.py file, then suddenly that file contains the prompt, product rules, response parsing, retry behavior, and enough domain knowledge that changing the product means editing the provider integration.No thanks.For Speakroom, the provider adapter should not know what a good speaking practice session means. It should know how to talk to the provider and how to map provider errors into something the app can handle, while the feature owns the product behavior.That also makes agentic coding safer. “Change the product behavior” and “change how we call the provider” are very different tasks, and I don’t want my agent buddy mixing those up because the codebase mixed them up first.Frontend code stays near the featureThe React side follows the same taste: app-level shell at the top, pages as composition, feature code under feature folders. Again, nothing fancy, just useful.The alternative is the frontend slowly turning into global soup: shared hooks, shared components, shared state helpers, shared API helpers, all added slightly too early because they might be useful somewhere else later.I used to be more dismissive of frontend structure because I was much stronger on the backend side. In retrospect that was mostly cope, because React apps absolutely need structure if you want them to stay pleasant to change.The pattern I like here is that a page composes the feature, and the feature owns its own components, hooks, state, API helpers, and tests until there is a real cross-feature reason to move something out. I would rather keep things small, explicit, and easy to find until there is a real reason to move them somewhere shared.Operations are part of the architectureOne thing I care about more now than I did a few years ago is the command surface. The architecture uses the root Makefile as the stable local and CI entrypoint, with explicit commands for backend sync, frontend install, migrations, queue schema setup, linting, type checking, tests, build, full checks, Compose smoke tests, and image builds. This is boring, and I care about it more than I used to.I don’t want the correct way to run a project to live in someone’s memory, a Slack thread, and 3 half-stale README sections. I want a small set of commands that developers, CI, and agents can all use.The explicit setup also matters. Database migrations are a command, queue schema setup is a command, queue healthcheck is a command, and app startup avoids secretly mutating half the runtime and hoping nobody notices. That is slightly more annoying during the first 5 minutes of local setup, but it makes failures much easier to understand later.Why this works well with coding agentsThis architecture is especially nice when coding agents are part of the workflow, because agents are very good at filling empty space. If the codebase does not make the right path obvious, they will still pick a path, and sometimes the result even works at first glance, which is the dangerous bit.The architecture gives the agent fewer excuses:routes stay thinfeature services own domain logicquery code stays feature-localprompts live with the featureprovider adapters do provider workworker tasks accept IDs and open their own sessionsfrontend code stays feature-localsetup and verification commands are stableAgents can still do weird things, obviously, but this gives them fewer places to go wrong. And honestly, it gives humans the same thing, which is why I like it.Architecture with tasteThe part I probably like most is what the architecture refuses to be. It skips the generic repository layer someone added just because, the plugin system before there are plugins, the generalized workflow engine before there is a workflow problem, and the attempt to predict every future product before this one is even real. It gives you a good first shape, then expects you to adapt it.That was a good fit for Speakroom because I wanted enough structure to keep the product from turning into soup, without making every small feature feel like ceremony. I like architecture with taste. I get annoyed when it starts acting like a religion.Thanks for reading and have a great day.The Architecture I Used to Build Speakroom, an AI Voice Language Practice App was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.