Igor Kordaczuk

Igor Kordaczuk

My GitHub Projects

LAiW

Custom legal-tech platform developed for scalable generation and distribution of legal documents, initiated by baitlaw.com.

MedusaJS_logo TS_logo MedusaJS_logo TS_logo React_logo Railway_logo Postgresql_logo Postgresql_logo

Overview

Laiw is a backend-driven system designed to automate the creation, customization, and sale of legal agreements for individual clients. The platform enables users to purchase legally reviewed, AI-assisted contracts at a significantly lower cost compared to traditional legal services.

Traditionally, preparing legal documents required direct interaction with a lawyer, leading to higher costs and limited scalability. Laiw addresses this by combining automation with legal oversight— documents are generated using OpenAI API and optionally reviewed or refined by legal professionals.

The goal of this project was to create a system that:

  • enables scalable distribution of legal documents
  • automates document generation using AI
  • integrates e-commerce workflows for contract sales
  • supports legal review and editing processes
  • maintains context-aware document generation history

Business Context

The startup operates in the legal-tech space, focusing on:

  • standardized legal agreements for individuals
  • cost-efficient alternatives to traditional legal services
  • digital distribution of contracts via an online store

The business model is based on high-volume sales of legal templates enhanced with AI-generated personalization. Each purchased document is tailored to the customer’s input and optionally verified by a lawyer.

Key Features

1. Automated Contract Generation

The system automatically generates legal documents immediately after order completion.

Workflow:

  • customer selects a contract product
  • fills out a structured form with required legal data
  • completes payment
  • backend processes the order
  • contract is generated using OpenAI API

Key capabilities:

  • dynamic prompt generation based on product type
  • injection of user-provided data into contract templates
  • context-aware AI generation per document
  • instant contract creation after purchase

Each product (contract type) has a predefined prompt template that guides the AI in generating the appropriate document structure and content.

2. Document Output and Editing Pipeline

Generated contracts are produced in multiple formats to support both automation and manual review.

Formats:

  • .docx (editable format)
  • .pdf (finalized document)

The system uses LibreOffice for document conversion, enabling:

  • seamless transformation between formats
  • easy editing by legal staff
  • compatibility with standard legal workflows

Lawyers can review, adjust, and finalize documents before delivery if required.

The person responsible for preparing the document has the ability to re-prompt it or manually upload a revised version.

3. Admin Dashboard and Document Lifecycle

The platform includes a management interface for handling contracts and their lifecycle.

Core functionalities:

  • uploading new contract templates
  • editing and refining generated documents
  • managing product-specific prompts
  • tracking order-related document generation

Each contract instance is treated as a separate conversational thread with AI, meaning:

  • the system preserves generation context
  • subsequent edits or regenerations are context-aware
  • the AI "understands" the history of the document

This enables iterative refinement rather than one-off generation.

4. E-commerce Integration

Laiw operates as an online store for legal documents.

  • product catalog of legal agreements
  • order processing and payment handling
  • automatic backend triggers after purchase
  • seamless connection between checkout and document generation

The system ensures that every completed order results in an immediately generated, personalized legal document.

5. AI Contract Builder (Standalone Tool)

In addition to predefined products, the platform offers a flexible contract creation tool.

  • free-form contract generation using OpenAI API
  • user-driven input without fixed templates
  • rapid prototyping of custom agreements

This feature extends the platform beyond structured products into a general-purpose legal document generator.

System Architecture

Laiw is built as a modular backend system integrating:

  • AI generation via OpenAI API
  • document processing using LibreOffice
  • e-commerce order handling
  • custom domain logic for legal products and documents

Core components:

  • order processing pipeline
  • prompt management system
  • document generation engine
  • admin dashboard
  • AI conversation context layer

The backend acts as the central orchestration layer connecting payments, AI generation, and document management.

Benefits

  • significant cost reduction for end users
  • scalable legal document generation
  • automation of repetitive legal drafting tasks
  • streamlined workflow for legal review
  • centralized management of contracts and orders
  • improved turnaround time for document delivery

Future Improvements

  • customer self-service panel for document access and edits
  • automated legal validation checks
  • versioning and audit trails for contracts
  • advanced prompt customization per user segment
  • analytics on document usage and demand
  • deeper human-in-the-loop review workflows

Client

Developed for: baitlaw.com
Legal-tech initiative focused on scalable delivery of legal services for individual clients.