Case study · Software Development
ProSpeak
English training SaaS with real-time voice AI, a sales CRM and automated billing.
ProSpeak teaches English to Spanish-speaking professionals through levelled lessons (A1–B2) and real-time voice simulations in which the student interviews an AI character, such as a patient. Around the learning product I built the full business layer: a CRM for the sales team, an automated acquisition funnel, Stripe billing, channel analytics, a certification system and a Claude integration that answers questions about the business from live data.
- Role
- Founder and sole engineer
- Scope
- Business logic, architecture, backend, frontend, AI integration, payments, CRM, admin, deployment
- Status
- In production, early stage
Contents
What you will find here
In action
See it working
Claude integration in action
01 · The flow
How a customer moves through the system
Two entry channels, a sales rep's trial link or a self-serve landing page, lead to the same pipeline. Every step below is a rule I defined and then implemented.
- 01Automated
Landing page
One per profession, or a sales rep's trial link
- 02Automated
Placement test
Audio questions, level assigned
- 03AI
Trial lesson
8 blocks with a voice simulation
- 04AI
AI report
Level and performance written to the CRM
- 05Sales rep
Sales call
Rep calls knowing the result
- 06Automated
Payment
Stripe or approved manual method
- 07Automated
Active student
Account, AI access, commission, email
- 08Automated
Certificate
Exam graded on the server
02 · Architecture
One backend owns everything of value
The Next.js frontend talks to a FastAPI backend over REST and, during AI practice, over a bidirectional audio WebSocket. The backend is fully asynchronous (FastAPI + SQLAlchemy 2.0 async), so real-time voice sessions, AI calls and payment webhooks never block the API.
The backend is the only authority over anything with economic or academic value: AI usage, grades, certificates, prices and account state.
Persistence runs on SQLite behind SQLAlchemy, with chained Alembic migrations applied automatically on every deploy. Moving to PostgreSQL is a configuration change plus a data migration; the driver is already included.
Deployment is split by layer: the Next.js frontend runs on Vercel, and the FastAPI backend runs on a DigitalOcean server managed with Coolify. Production has monitoring and logging in place.
Frontend
Backend
AI & voice
Payments & email
Infrastructure
03 · Systems
What I designed and built
Grouped by the part of the business they serve.
Product
What the student uses.
01Conversational simulation engine
The core of the product: voice interviews with characters that behave in a believable and pedagogically useful way.
+
Conversational simulation engine
The core of the product: voice interviews with characters that behave in a believable and pedagogically useful way.
- Prompts built per level, using a “theatre rehearsal” frame, turn examples calibrated to each level, and a one-fact-per-turn rule so the student has to keep asking.
- Real-time character supervision: a detector reads the transcript and, if the model breaks character, the system sends a silent stage direction mid-session without interrupting the conversation (capped per session). Subtitles and transcripts are stripped of meta-text.
- Stage-style, no-scroll interface: objectives bar, central avatar with status ring, live subtitles, a current-objective card that ticks itself when met, support phrases graded by level (always, on demand or none), a “lifeline” after 8 seconds of silence, and tap, hold or spacebar microphone control.
- Audio orchestration: tutor narration, the character's turn and the timer are chained so voices never overlap and the clock starts at the right moment.
- Automatic evaluation at the end: a second model writes a performance report and assigns a level. The result is stored and shown in the CRM.
02Real-time voice gateway with usage metering
AI usage is the main variable cost of the business, so the server controls it from start to finish.
+
Real-time voice gateway with usage metering
AI usage is the main variable cost of the business, so the server controls it from start to finish.
- Custom WebSocket proxy between the browser and Gemini Live. Authentication travels in the first frame instead of the URL, so tokens never reach the logs. Two credential types: student or public trial link.
- The server rewrites every session config: fixed model, audio only, an allowlist of voices, a prompt size limit and no tools. The provider only receives PCM audio and short, validated text.
- Audio seconds are measured in both directions and balance is debited atomically every 5 seconds and on close. Free trials have their own cap per link.
- Controlled lifecycle: authentication deadline, idle disconnect, maximum session length, and automatic close when the balance reaches zero or access is revoked.
- Custom close-code protocol (4400–4502) that the frontend maps to user-facing messages, plus live remaining-balance updates.
- Migration without breaking cached clients: the old client-side debit endpoint still responds but no longer debits, which prevents double charging during the transition.
03Declarative content engine and generation pipeline
Adding a new profession is content work, not engineering work.
+
Declarative content engine and generation pipeline
Adding a new profession is content work, not engineering work.
- Lessons are JSON documents made of reusable blocks: vocabulary, matching with translation, grammar, listening, gap-fill, pronunciation, simulation and AI consultation.
- Professions, courses and levels are discovered from the content structure at runtime, with no hard-coded lists.
- Python generators produce each profession's lesson JSON and its placement test.
- Pronunciation is checked with speech recognition and tolerant matching; speech synthesis runs on Deepgram.
- Current output: 6 professions with a trial lesson at 4 levels, 24 paths with their own pedagogical progression.
04WebGL particle avatars
A custom renderer built for mid-range Android phones.
+
WebGL particle avatars
A custom renderer built for mid-range Android phones.
- Own engine on WebGL 1 with GLSL shaders, no Three.js: about 10 KB and no dependencies.
- Animated states: breathing, a 68 bpm heartbeat for the patient, assembly vortex, listening, counter-rotating “thinking” rings, speech driven by the real audio signal (low frequencies move the equator, attacks move the poles) and an error state.
- Pauses when off-screen, recovers from WebGL context loss, and falls back to 2D when WebGL is unavailable or the user enables reduced motion.
Sales and growth
How students are acquired, and how the team sells.
05Automated acquisition funnel
A self-serve channel that runs without a sales rep.
+
Automated acquisition funnel
A self-serve channel that runs without a sales rep.
- A general landing page plus one per profession, generated dynamically.
- Sign-up with consent. The trial link is sent by email only and expires in 72 hours, which also validates the contact.
- Layered anti-abuse: one trial per email and per WhatsApp number, per-IP limits and a honeypot against bots.
- Automatic leads enter without a rep or commission and are handled directly by the admin.
06Conversion-oriented trial funnel
The trial lesson is designed as a sales funnel, not just a demo.
+
Conversion-oriented trial funnel
The trial lesson is designed as a sales funnel, not just a demo.
- Placement test with audio questions, a question bank per profession and no answers exposed to the client. Users can change level afterwards and the choice is saved.
- Full 8-block lesson with an AI consultation at the assigned level.
- Personalised closing screen with the level achieved, objectives met, next step, price and a WhatsApp call to action that names the assigned advisor.
07Sales CRM
The internal tool for the sales team.
+
Sales CRM
The internal tool for the sales team.
- Lead management with funnel stage and origin (sales rep or automatic).
- Trial links generated per sales rep, so every sale can be attributed.
- Each lead's trial result, level and AI report, so the rep calls knowing exactly how the prospect performed.
- Sales logging and manual approval of alternative payment methods (Binance, PayPal) for markets where cards are not viable.
- Commissions calculated automatically, only when the sale was originated by a rep.
- Internal chat between reps and admin, with messages that reference specific leads.
08Admin panel and channel analytics
Built to decide, with data, which acquisition channel to scale.
+
Admin panel and channel analytics
Built to decide, with data, which acquisition channel to scale.
- Sales-rep funnel and automated funnel compared side by side.
- Sales by rep and by payment method (card or manual).
- Rep activity: calls made and notes left on each lead.
- Unfinished payments and funnel leads with direct WhatsApp contact.
09Claude integration: MCP connector to live business data
I can ask Claude how the business is doing in plain language and get answers from live production data, without opening the admin panel.
+
Claude integration: MCP connector to live business data
I can ask Claude how the business is doing in plain language and get answers from live production data, without opening the admin panel.
- Remote MCP server mounted inside the existing FastAPI backend over Streamable HTTP. It is stateless with JSON responses, so it runs behind any proxy without session affinity.
- 11 tools: business overview, metric series, rep vs self-serve channels, the automated funnel, sales reps, rep performance, trial lessons, lead search, the full lead record, call priorities and unfinished payments.
- Where the admin panel already computes a figure, the tool calls the same function, so Claude and the dashboard always show the same numbers.
- Rep performance analysis: calls per day against the daily quota, weekdays without calls, how many hours the rep takes to call after a completed trial and which leads were never called, compared with the previous period and the team average, plus the call notes for review.
- Call priority ranking: open leads scored by urgency (payment started but not finished, completed trial with no follow-up, marked as interested), with the reasons behind each score.
- Server instructions give the model the domain rules: sales days on the Venezuela clock, lead statuses, channels and what a trial report contains.
- Off by default: without a configured token of at least 32 characters the endpoint returns 404. Requests need a bearer token checked in constant time, rejected attempts are logged and every tool call is audited.
- Every tool is read-only and declared as such. Date ranges and result sizes are capped, and notes and AI reports written by other people are passed to the model as data, never as instructions.
Money and trust
Payments, grades and anything that must not be tampered with.
10Stripe billing
Payments, account activation and attribution in a single flow.
+
Stripe billing
Payments, account activation and attribution in a single flow.
- Checkout with inline prices from a single source of truth in the backend, which also serves those prices to the frontend. The price on the site and the price charged cannot drift apart.
- One webhook flow creates or activates the account, unlocks AI access, records the payment, attributes the commission, marks the lead as converted, sends the access email and notifies the admin.
- Abandoned payments detected through Stripe's session-expired event, with an admin alert and a follow-up list.
- Enrolment offer tied to each trial link, valid for 30 days.
11Server-graded certification
Grades and certificates are never decided by the client.
+
Server-graded certification
Grades and certificates are never decided by the client.
- Exam bank stored in the backend, organised by language, profession, level and lesson. The client only receives questions, never answers.
- Timed attempts, resume of an open attempt, level-unlock checks, a maximum of 3 attempts per 24 hours (with retry time) and a latency grace margin.
- Atomic, single-use grading. A pass is never downgraded, and certificate issuance and level-up run in a dedicated backend service.
12Security audit and hardening
A full review of the platform, followed by hardening.
+
Security audit and hardening
A full review of the platform, followed by hardening.
- Onboarding with signed, short-lived, single-use tokens, and responses that do not allow account enumeration.
- JWTs typed by context (access, onboarding, email) that cannot be reused outside their purpose, with backward compatibility.
- Passwords hashed with bcrypt and Pydantic validation on every endpoint.
- Upload validation (type and size) and internal errors never leaked to the client.
- All logic with economic or academic value (usage, grades, certificates, prices) runs on the server.
04 · Decisions
Engineering trade-offs
Plain WebGL instead of Three.js
Performance on mid-range phones and minimal bundle weight.
Server-side metering instead of client-side
Turns AI cost into something controllable and billable.
Declarative content instead of code
Scaling to new professions is a content task, not an engineering one.
One source of truth for prices, no Stripe price IDs
Prices change in one place without redeploying configuration.
Two funnels measured in parallel
The architecture supports both assisted sales and self-serve, and the admin panel compares them.
A read-only Claude integration instead of another dashboard
Ad-hoc questions about sales and reps get answered in a conversation, reusing the admin logic, with no way to change data.
SQLite in production during validation
Zero operating cost, single-server deploys and trivial backups, with the data layer ready to move to PostgreSQL when volume justifies it.
Work with me
Need a system like this?
CRMs, sales funnels, payment flows and internal tools, built around how your business actually works.



