Lexio.lv - AI Contract Risk Analysis Platform
A Latvian legal services firm needed a way to make contract review accessible to small and mid-sized businesses. The traditional model - hourly lawyer fees, multi-day turnaround, inconsistent quality - was locking most companies out of proper contract due diligence. We built a SaaS platform that changed that.
The Challenge
Contract review has been a bottleneck for businesses since the invention of contracts. A typical review by a legal professional costs 150-300 EUR per hour and takes 2-4 hours per document. For a company signing 20+ contracts per quarter, that adds up to thousands in legal fees - per quarter.
The consequences of skipping review are worse. Hidden liability clauses, unfavorable termination terms, missing data protection provisions, and ambiguous penalty structures have cost businesses millions in disputes they never saw coming.
The client's vision was clear: make contract risk analysis instant, affordable, and accessible to every business in Latvia - regardless of whether they have an in-house legal team.
The specific requirements were demanding:
- Analyze contracts in seconds, not hours
- Cover Latvian and EU legal frameworks comprehensively
- Support multiple document formats (PDF, DOCX, plain text)
- Provide clear, actionable risk reports - not legalese
- Scale from zero to thousands of users without infrastructure changes
- Keep operational costs low enough for aggressive SaaS pricing
Our Solution
We designed and built Lexio as a full-stack SaaS platform with an AI engine at its core. The approach was deliberate: rather than wrapping a single AI model in a basic UI, we built a multi-model orchestration engine that routes each task to the optimal model for that specific job.
Multi-Model AI Engine
Different stages of contract analysis require different capabilities. Document parsing needs speed and context length. Risk identification needs advanced reasoning. Report generation needs structured output. Our engine uses Gemini 2.5 Flash for fast document parsing, Gemini 2.5 Pro for deep risk reasoning on complex clauses, and routes requests dynamically based on task requirements.
Edge-First Architecture
Traditional cloud architectures introduce latency at every hop. We deployed the entire backend on Cloudflare Workers - zero cold starts, global edge distribution, and automatic scaling. The database (Cloudflare D1) lives in the same datacenter as the compute, eliminating network round-trips that plague centralized architectures.
Complete Business Platform
Lexio is not just an analysis tool. We built the full business stack: user authentication (Google OAuth + email/password), Stripe-powered subscription billing with four plan tiers, 18 automated email campaigns for onboarding and retention, a comprehensive analytics layer, and an admin dashboard for managing the entire operation.
Key Metrics
Technology Stack
Architecture
The platform follows a clean edge-first architecture where every component runs as close to the user as possible.
User (Browser)
|
v
+-----------------+ +------------------+
| Next.js 16 | | Cloudflare |
| Frontend |------>| Workers API |
| (Static CDN) | | (18 endpoints) |
+-----------------+ +------------------+
|
+------------+------------+
| | |
v v v
+---------+ +---------+ +-----------+
| D1 DB | | AI | | Stripe |
| (SQLite | | Engine | | Payments |
| edge) | | | | |
+---------+ +---------+ +-----------+
| |
+----+----+----+----+
| |
v v
+-----------+ +-----------+
| Gemini | | Gemini |
| 2.5 Pro | | 2.5 Flash |
| (Reason) | | (Parse) |
+-----------+ +-----------+
Request flow: A user uploads a contract through the Next.js frontend (served via Cloudflare CDN). The request hits a Cloudflare Worker endpoint, which authenticates the user against D1, then routes the document to the AI Engine. The engine selects the appropriate model based on task type, processes the contract, stores results in D1, and returns a structured risk report - all in under 3 seconds.
Development Process
The project moved through six distinct phases over 24 weeks, with each phase building on validated decisions from the previous one.
- Discovery & Design (Weeks 1-2) - Market research, competitor analysis, UX wireframes, and domain registration. We mapped 28 risk categories based on real contracts from Latvian legal practice.
- Core Backend (Weeks 3-6) - Authentication system, D1 database schema, the multi-model AI engine, and the document parsing pipeline. The hardest engineering challenge of the project.
- Frontend & UX (Weeks 7-10) - Landing page, user dashboard, contract upload flow, and the risk report interface. Focused on making complex analysis results understandable by non-lawyers.
- Business Logic (Weeks 11-14) - Stripe integration with 4 plan tiers, coupon system, billing portal, and 18 automated email campaigns via Resend.
- Compliance & Localization (Weeks 15-18) - GDPR compliance, privacy policies, cookie consent, Latvian and English translations, and security hardening.
- Launch & Growth (Weeks 19-24) - Public launch, cold outreach system, performance optimization, bug fixes, and iterative improvements based on early user feedback.
Business Results
Lexio launched as a fully operational SaaS with:
- 10-page contracts analyzed in under 3 seconds - replacing a process that previously took hours
- Infrastructure cost under $50/month - Cloudflare's edge architecture keeps costs minimal regardless of scale
- Zero downtime since launch - edge-distributed architecture eliminates single points of failure
- Full subscription revenue system - 4 plan tiers generating recurring monthly revenue from day one
- Automated user lifecycle - 18 email campaigns handling onboarding, trial conversion, and retention without manual intervention
- Complete analytics pipeline - every user action tracked for data-driven product decisions
The cost reduction for end users is significant. A contract that previously cost 300-1,200 EUR in legal review fees can now be analyzed for a fraction of the cost, with results delivered in seconds instead of days. This opens contract due diligence to businesses that previously could not afford it.
Client Feedback
We went from a rough idea to a live product with paying customers faster than we imagined possible. The platform handles everything - from the AI analysis to payments to email campaigns. We didn't need to hire a single additional developer or manage any servers.
Key Takeaways
This project validated several important principles:
- Edge-first architecture pays off. Zero cold starts, global distribution, and sub-$50/month infrastructure costs at launch. The same architecture will handle 100x the current load without changes.
- Multi-model AI is not optional. Different tasks genuinely need different models. A single-model approach would have been slower, more expensive, and lower quality.
- Ship the full business, not just the feature. The AI analysis is only 30% of the platform. Billing, email campaigns, analytics, admin tools, and GDPR compliance are the other 70% - and they're what make it a real business.
- Latvian market is underserved in LegalTech. There's enormous demand for accessible legal technology in the Baltics. First-mover advantage matters.
Want similar results for your project?
We build AI-powered SaaS platforms from concept to production. Cloud-native, scalable, and designed for real business outcomes.
Start a Conversation