Inspiration
Small business owners across Africa often sign leases, supplier agreements, and service contracts without fully understanding the risk. Legal help is expensive, slow, and usually inaccessible for smaller businesses. We built LexAI to close that gap by giving SMEs a fast way to upload a contract, understand the important clauses, spot risky language, and escalate serious concerns to a human lawyer when needed.
What it does
LexAI is an AI legal assistant for contract review. A user uploads a PDF contract, and the system extracts the text, identifies risky clauses such as automatic renewals or indemnification, and lets the user ask natural-language questions about the document. The answers are grounded in the uploaded contract and returned with section-based citations, so users can see exactly where the information came from. If the user still has concerns, they can request a lawyer review directly from the app.
How we built it
We built LexAI as a full-stack RAG application. The frontend uses React, Vite, Tailwind CSS, and Framer Motion to provide a clean chat-style experience with PDF upload, cited answers, and a lawyer escalation flow. The backend uses FastAPI, Pydantic, and LangGraph to orchestrate ingestion, retrieval, and response generation. For storage and AI infrastructure, we used DigitalOcean Spaces for document storage and DigitalOcean GenAI for the language model. We used FastEmbed plus FAISS for local semantic search, section-aware chunking for better legal retrieval quality, and guardrails to redact sensitive personal information before sending content to the model.
Challenges we ran into
One challenge was handling real-world legal PDFs, especially scanned or poorly structured documents. We had to support both standard text extraction and OCR fallback so the app could work across different document types. Another challenge was getting useful legal answers without hallucination, which meant we had to focus on section-aware chunking, strong retrieval quality, and grounded citations. We also had to balance accessibility and safety: the app needs to explain contracts in plain English for SME owners, while still being careful with privacy, disclaimers, and escalation to human legal support when needed.
Accomplishments that we're proud of
We’re proud that LexAI is more than a chatbot. It performs practical legal-document analysis, flags risky clauses proactively, answers questions with citations, and supports human escalation through a lawyer review workflow. We’re also proud that the product is deployable end to end, containerized, documented, and designed around a real user problem rather than a demo-only AI feature. Most importantly, it turns legal language into something small business owners can actually use.
What we learned
We learned that RAG quality depends heavily on document preprocessing, not just model choice. In a legal workflow, chunking strategy, citation quality, and retrieval accuracy matter as much as the generation step. We also learned that trust is critical in AI products for high-stakes domains: users need transparency, grounded answers, privacy protections, and a clear path to human help. Finally, we learned that building for underserved users means simplifying the experience without oversimplifying the problem.
What's next for LexAI
Next, we want to support more contract types and more African jurisdictions, improve multilingual support, and expand the risky-clause engine into more nuanced legal reasoning. We also want to add lawyer-network integrations, better case tracking, and stronger enterprise features such as user accounts, document history, and audit logs. Longer term, we see LexAI becoming a contract intelligence platform that helps SMEs not just understand agreements, but negotiate and manage them more confidently.
Built With
- digitalocean-gradient
- digitalocean-spaces
- faiss
- fastapi
- gradient-sdk
- langgrapgh
- pydantic
- react-vite

Log in or sign up for Devpost to join the conversation.