LEX — AI Legal Platform for Law Firms

AI-powered legal analysis platform for law firms and corporate counsel.

Features

Resources

Blog Articles

Technology

Built on AWS (EC2, Bedrock Claude AI, ALB, WAF, S3, ACM, KMS). PostgreSQL, Redis, Qdrant vector database. TypeScript, React, Node.js.

Start free — 50 credits on registration. Sign up

TECH 9 min

Legal Consultation Marketplace: From the Unified Attorney Registry to Monobank Payments

Attorney verification via the Unified Attorney Registry (ERAU) in 2 seconds. 3-step onboarding. Consultation request with documents from the vault. Real-time chat between client and attorney. Escrow payment via Monobank. 10% platform commission. Full cycle — from "I need a lawyer" to a paid consultation.

Legal Consultation Marketplace: From the Unified Attorney Registry to Monobank Payments

How we built a complete legal consultation ordering cycle — from attorney verification to escrow payments.


The Problem: Finding a Lawyer Is Harder Than It Seems

A client needs a lawyer. What do they do? Google it. Ask friends. Visit law firm websites. There is no single place to find verified attorneys, compare specializations, read reviews, and immediately book a consultation.

From the attorney's side, it's painful too: they need a website, SEO, manual request handling, scheduling, invoicing. Instead of legal work — administration.

Architecture: 6 Components

| Component | What It Does | |———–|————-| | ERAU Integration | Verification via the Unified Attorney Registry (ERAU) | | Onboarding | 3-step profile creation modal | | Attorney Search | Filters by specialization, region, price | | Consultation Request | 4-step flow with documents | | Real-time Chat | SSE-based messaging | | Escrow Payment | Monobank with hold until completion |

Step 1: Verification via ERAU

ERAU (Unified Attorney Registry of Ukraine) is the official registry of licensed attorneys. Our integration works as follows:

  1. The attorney enters their last name
  2. A request goes to erau.unba.org.ua/search
  3. The result is cached: Redis (24 hours) → PostgreSQL (indefinitely)
  4. On external API failure — fallback to PostgreSQL cache

What we get: last name, first name, patronymic, certificate number, issue date, regional bar association. This is sufficient for verification — the attorney is confirmed to be in the National Bar Association registry.

Caching is critical. The ERAU API is unstable and slow (15-second timeout). After the first lookup — response in milliseconds from cache.

Step 2: 3-Step Onboarding

Step 1 — Welcome. What a platform profile provides, how verification works.

Step 2 — ERAU Search. The attorney searches for themselves by last name, selects from the list. Data is pulled automatically: certificate number, date, regional bar association.

Step 3 — Profile completion. Specializations (up to 5), court types, region, languages, rates (consultation, hourly rate, representation), bio.

The profile is saved in the attorney_profiles table linked to users and organizations.

Pricing Tier with 30% Markup

For attorneys — a dedicated pricing plan:

| | Basic | Attorney | |—|—|—| | Price | 9/mo | 49/mo | | MCP tools markup | 0% | 30% | | Limits | ₴415/₴4150 | ₴2075/₴20750 | | Support | 48 hours | 12 hours | | Trial | 7 days | 14 days |

The 30% markup covers additional costs for deep legal analysis that attorneys use for client cases.

Step 3: Attorney Search

Clients see a catalog with filters:

Sorting: by rating, price, experience, number of consultations.

Attorney card: photo, name, specializations (tags), rating (stars + review count), consultation price, "Book Consultation" button.

Step 4: Consultation Request

4-step modal:

Details — type (consultation / representation / document analysis), title, description, urgency (low / normal / high / urgent).

Documents — DocumentPicker allows selecting documents from the vault. The attorney sees them after accepting the request.

Confirmation — review everything before submitting.

Payment — mock Monobank (currently a 2-second delay → success).

Consultation Statuses

pending → accepted → paid → in_progress → completed
           ↘ declined    ↘ cancelled      ↘ disputed

The attorney sees pending requests with an "unseen" badge. They can accept (with optional price adjustment) or decline (with a reason).

Step 5: Real-time Chat

After payment, a chat opens between the client and attorney. Implementation:

Message types: text, system (status changes), file.

Step 6: Escrow Payment

The payment model protects both parties:

  1. Client pays → funds are held
  2. Attorney conducts the consultation
  3. Consultation completed → funds released to the attorney
  4. If cancelled → refunded to the client

Split:

Matter Access

When a consultation is paid, the attorney automatically receives the consultant role on the client's matter — read-only access to documents. After completion — access is revoked.

This works through the existing matter segregation system: the attorney only sees documents from the matter the consultation was ordered for.

Reviews

After completion, the client can leave a review:

Full cycle — from "I need a lawyer" to a paid consultation with a review. No calls, no emails, no manual coordination.