From Idea to SaaS: The Lexio Development Story
In September 2025, a client asked a simple question: "Can AI read our contracts and tell us what's risky?" Six months later, Lexio was live in production with paying customers, 28 risk categories, and a multi-model AI engine processing contracts in seconds.
This is the full story of how we built it — architecture decisions, mistakes we made, and what we'd do differently.
The Problem
Legal contract review is expensive and slow. A lawyer charges 150-300 EUR/hour. A typical contract review takes 2-4 hours. Small businesses either pay up or skip the review entirely — and discover problems when it's too late.
Our hypothesis: AI can identify 80% of common contract risks in seconds, for a fraction of the cost. The remaining 20% still needs a human lawyer, but at least you know where to look.
Architecture Decisions
Why Cloudflare Workers (not AWS/Vercel)
We needed 0ms cold starts. Lambda cold starts (100-500ms) add up when you're processing multi-page contracts with multiple AI calls. Workers start instantly, run at the edge, and scale to zero when idle.
The cost? Under $5/month for the entire backend at launch. Try that with AWS.
Why D1 (not PostgreSQL/Supabase)
D1 is Cloudflare's SQLite-at-the-edge database. It's free for the first 5GB, reads are instant (same datacenter as the Worker), and migrations are just SQL files. For a SaaS with user accounts, subscriptions, and document analysis results — it's more than enough.
Why Multi-Model AI (not just GPT-4o)
Different tasks need different models:
- Document parsing — Gemini 2.5 Flash (fast, cheap, handles long documents)
- Risk analysis — Gemini 2.5 Pro (better reasoning for complex clauses)
- Contract generation — GPT-4o (best at structured legal text)
- Quick chat — Gemini Flash (fastest response time)
Using one model for everything is like using a hammer for every job. Our XDA AI Engine routes requests to the optimal model based on the task.
The Tech Stack
Frontend: Next.js 16 + React 19 (static export) Styling: Tailwind CSS v4 Backend: Cloudflare Workers (TypeScript) Database: Cloudflare D1 (SQLite at edge) AI Engine: Gemini 2.5 Pro/Flash + GPT-4o Payments: Stripe (4 plan tiers + coupons) Auth: Google OAuth + email/password Email: Resend (18 automated campaigns) Analytics: PostHog Domain: lexio.lv (Cloudflare DNS) Deploy: Cloudflare Pages + Wrangler
Timeline
- Week 1-2 — Research, competitor analysis, wireframes, domain registration
- Week 3-6 — Core backend: auth, D1 schema, AI engine, document parsing pipeline
- Week 7-10 — Frontend: landing page, dashboard, contract upload flow, results UI
- Week 11-14 — Stripe integration, email campaigns (Resend), billing portal
- Week 15-18 — Legal pages, GDPR compliance, LV/EN translations, beta testing
- Week 19-24 — Public launch, cold outreach system, bug fixes, optimization
Key Metrics at Launch
- 18+ API endpoints — auth, contracts, analysis, payments, admin
- 28 risk categories — liability, termination, IP, data protection, penalties, etc.
- 4 plan tiers — Free trial, Starter, Professional, Enterprise
- 18 automated emails — onboarding, trial reminders, payment receipts, re-engagement
- <3s average analysis time — for a 10-page contract
- 99.9% uptime SLA — thanks to Cloudflare's edge infrastructure
Mistakes We Made
1. Starting with too many features
Our initial scope included contract comparison, team collaboration, and version history. We cut all of it for V1 and focused on one thing: upload → analyze → report. Everything else came later.
2. Underestimating email complexity
18 automated email campaigns with proper timing, A/B testing, and deliverability is a product in itself. We spent 3 weeks on emails alone. Next time: start with 5 essential emails, add the rest post-launch.
3. Not setting up analytics from day one
We added PostHog in week 12. The first 11 weeks of user behavior data? Gone forever. Set up analytics before your first user touches the product.
What We'd Do Differently
- Launch in 12 weeks, not 24 — We over-polished. The first paying customer doesn't care about the 18th email campaign.
- Charge from day one — Free trials attract tire-kickers. A $1 trial would have filtered for serious users.
- Build the outreach system earlier — The product was ready 6 weeks before we had a reliable lead generation pipeline.
Results
Zero external funding. One developer. 6 months from idea to live SaaS with paying customers. Total infrastructure cost: under $50/month.
Lexio proves that a solo developer with the right tools (Cloudflare, AI APIs, modern frameworks) can build and ship a production SaaS faster than a 10-person team with legacy infrastructure.
Want us to build your SaaS?
We take projects from idea to production. AI-powered, cloud-native, built to scale.
Start a Conversation