How shoaibkhan-sde/legallens works
LegalLens is a bilingual AI contract-auditing application for people who need to understand, compare, and act on legal documents. The primary workflow runs from document capture through the browser API and server-side audit stages to an interactive review, with separate comparison, voice-assistance, and legal-aid capabilities. The README documents pipeline stages and generated outputs; sampled source confirms key frontend calls, backend processing, and state persistence. Some subsystem links rely on README descriptions because their implementation excerpts were not included.
Main entry points: App.tsx Application shell · astraBackend.ts Audit pipeline · apiClient.ts Browser API client · DocumentCapture.tsx Document capture
Components 25
User Experience
- Application shell
src/App.tsx - Document capture
src/components/DocumentCapture.tsx - Audit dashboard
src/components/DocumentViewer.tsx - Clause review
src/components/ClauseCard.tsx - Contract comparison
src/components/ComparisonView.tsx
Contract Audit
- Audit pipeline
server/src/services/astraBackend.ts - Legal input gate
server/src/services/astraBackend.ts - Document extraction
server/src/services/astraBackend.ts - Clause taxonomy
server/src/services/astraBackend.ts - Risk and grounding
server/src/services/astraBackend.ts - Audit synthesis
server/src/services/astraBackend.ts - Actionable outputs
src/components/ActionableOutputs.tsx - Calendar export
src/utils/icalExporter.ts - Clause alignment
src/utils/clauseAlignment.ts
User Assistance
- Voice assistant
src/components/VoiceGroundedChat.tsx - Speech utilities
src/utils/speech.ts - AI chat assistant
src/components/RoboAiAssistant.tsx - Legal aid locator
src/components/LegalAidLocator.tsx
API and State
- Browser API client
src/services/apiClient.ts - HTTP API routes
server/src/index.ts - Domain schemas
src/types/schemas.ts - Bilingual support
src/context/LanguageContext.tsx - Browser persistence
src/utils/persistence.ts
Other components
- Contract user
- Groq AI service
Connections 32
- Contract user → Application shell: uses
README.md - Application shell → Document capture: presents
src/App.tsx - Application shell → Audit dashboard: presents
src/App.tsx - Application shell → Clause review: presents
src/App.tsx - Application shell → Contract comparison: presents
src/App.tsx - Document capture → Browser API client: submits document
src/components/DocumentCapture.tsx - Browser API client → HTTP API routes: requests analysis
src/services/apiClient.ts - Contract comparison → Browser API client: requests comparison
src/services/apiClient.ts - HTTP API routes → Audit pipeline: invokes audit
server/src/index.ts - Audit pipeline → Legal input gate: checks intent
server/src/services/astraBackend.ts - Audit pipeline → Document extraction: parses document
README.md - Audit pipeline → Clause taxonomy: chunks clauses
server/src/services/astraBackend.ts - Audit pipeline → Risk and grounding: tags and grounds
server/src/services/astraBackend.ts - Audit pipeline → Audit synthesis: synthesizes audit
README.md - Audit pipeline → Groq AI service: uses AI
README.md - Browser API client → Application shell: returns analysis
src/services/apiClient.ts - Application shell → Actionable outputs: displays artifacts
README.md - Actionable outputs → Calendar export: exports deadlines
README.md - Contract comparison → Clause alignment: aligns clauses
README.md - Application shell → Voice assistant: presents
src/App.tsx - Voice assistant → Browser API client: sends questions
src/components/VoiceGroundedChat.tsx - Voice assistant → Speech utilities: uses speech
src/utils/speech.ts - Application shell → AI chat assistant: presents
src/App.tsx - AI chat assistant → Browser API client: sends questions
src/components/RoboAiAssistant.tsx - Application shell → Legal aid locator: presents
src/App.tsx - Application shell → Bilingual support: provides translations
src/context/LanguageContext.tsx - Document capture → Browser persistence: saves session
src/components/DocumentCapture.tsx - Actionable outputs → Browser persistence: saves view state
src/components/ActionableOutputs.tsx - Application shell → Browser persistence: saves analysis state
src/App.tsx - Audit pipeline → Domain schemas: produces typed results
server/src/services/astraBackend.ts - Browser API client → Domain schemas: uses result types
src/services/apiClient.ts - Audit dashboard → Domain schemas: renders analysis
README.md