AI-Powered Legal Strategy Architect
LegalLens is a full-stack AI application designed to help legal professionals and individuals act as an intelligent co-pilot for structuring complex legal strategies. It features a split-view interface with a context-aware AI chat on the left and a live, structured plan document on the right.
Try the app here: https://legal-lens-ruby.vercel.app/
- Dual-Pane Workflow: Seamlessly switch between chatting and viewing your structured plan.
- Context-Aware AI: The AI "sees" your plan live. Ask "Change step 3" and it knows exactly what to do.
- Persistent Sessions: Your strategies and chat history are saved automatically.
- Secure Authentication: User registration and login with JWT and BCrypt security.
- Modern UI: Built with Svelte and Tailwind CSS for a premium, fast, and responsive experience.
- Scalable Backend: Powered by FastAPI and MongoDB (Motor/Beanie) for high performance.
- API Framework: FastAPI (Python 3.10+)
- Database: MongoDB Atlas
- ODM: Beanie (Async MongoDB ODM)
- AI: OpenAI GPT-4o (via streaming API)
- Testing:
pytest+httpx - Deployment: Render
- Framework: Svelte + Vite
- Styling: Tailwind CSS
- State Management: Svelte Stores (built-in)
- Node.js (v18+)
- Python (v3.10+)
- MongoDB Cluster (Free M0 Tier on Atlas is perfect)
- OpenAI API Key
-
Clone the repository
git clone https://github.com/yourusername/legallens.git cd legallens -
Setup Backend
cd backend python -m venv venv source venv/bin/activate # or venv\Scripts\activate on Windows pip install -r requirements.txt
-
Configure Environment Create a
.envfile in thebackend/directory:OPENAI_API_KEY=your_openai_key MONGODB_URL=your_mongodb_connection_string SECRET_KEY=your_random_secret_string DATABASE_NAME=legal_lens
-
Run Backend
uvicorn main:app --reload # Server running at http://localhost:8000 -
Setup Frontend Open a new terminal:
cd frontend npm install npm run dev # App running at http://localhost:5173
You can see the running application here: https://legal-lens-ruby.vercel.app/
We recommend a Split Deployment strategy for the best free-tier performance:
- Frontend: Deploy on Vercel (Free).
- Backend: Deploy on Render (Free).
- Database: Host on MongoDB Atlas (Free).
Read the Full Deployment Guide
Run the backend test suite to verify API and DB logic:
cd backend
pytest -vMIT License.
