March 2026 8 min read

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.

Client
Industry
LegalTech
Timeline
6 Months
Result
Live SaaS

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:

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

<3s
Average analysis time per contract
28
Risk categories covered
99.9%
Platform uptime SLA
4
Subscription plan tiers
18
API endpoints built

Technology Stack

Next.js 16 React 19 Cloudflare Workers Cloudflare D1 Stripe Gemini Pro/Flash Resend PostHog Tailwind CSS v4 TypeScript

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.

  1. 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.
  2. 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.
  3. 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.
  4. Business Logic (Weeks 11-14) - Stripe integration with 4 plan tiers, coupon system, billing portal, and 18 automated email campaigns via Resend.
  5. Compliance & Localization (Weeks 15-18) - GDPR compliance, privacy policies, cookie consent, Latvian and English translations, and security hardening.
  6. 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:

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.

- Lexio.lv Founding Team

Key Takeaways

This project validated several important principles:

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