AI-Powered Philippine Legal Compliance Assistant
LexInSight is an intelligent, AI-powered chat application designed to help individuals, businesses, and organizations navigate the complex landscape of Philippine legal compliance. Through advanced document analysis and conversational AI, LexInSight makes legal compliance accessible, understandable, and actionable.
- Overview
- Key Features
- Tech Stack
- Getting Started
- Installation
- Usage Guide
- Project Structure
- Database Schema
- API Documentation
- Security
- Performance
- Testing
- Deployment
- Contributing
- Roadmap
- FAQ
- Support
- License
LexInSight is a comprehensive legal compliance platform that combines:
- AI-Powered Chat - Natural language interface for legal queries
- Document Analysis - Automated compliance checking for uploaded documents
- Knowledge Base - Extensive Philippine legal and regulatory information
- Real-time Assistance - Instant answers to compliance questions
- Small Businesses - Navigate regulatory requirements
- Compliance Officers - Streamline compliance workflows
- Legal Professionals - Quick reference and document analysis
- Government Agencies - Assist constituents with compliance
- Students & Researchers - Learn about Philippine law
- β Accessible - Complex legal language made simple
- β Fast - Instant answers, no waiting for consultations
- β Comprehensive - Covers major Philippine laws and regulations
- β Secure - Enterprise-grade security and privacy
- β Affordable - Cost-effective compliance solution
- Ask questions about Philippine laws and regulations
- Get explanations of legal requirements
- Learn about compliance procedures
- Receive step-by-step guidance
- Access to extensive legal knowledge base
Example Queries:
- "What are the requirements for RA 10173 Data Privacy Act?"
- "How do I register a business in Manila?"
- "What permits do I need for construction?"
- Upload documents for automated analysis
- Check compliance against Philippine legal standards
- Receive detailed compliance reports
- Identify gaps and recommendations
- Generate compliance checklists
Supported Documents:
- PDF files
- Word documents (.doc, .docx)
- Markdown files (.md)
- Text files (.txt)
- Multi-Document Support - Analyze up to 3 documents simultaneously
- File Size Limit - 5MB per file
- Real-time Processing - Instant analysis results
- Detailed Reports - Comprehensive compliance assessments
- Actionable Insights - Clear next steps and recommendations
- Authentication - Secure email/password authentication via Supabase
- Row-Level Security - Database-level access control
- Encrypted Storage - Files encrypted at rest and in transit
- User Isolation - Complete data separation between users
- Audit Trails - Track all document access and modifications
- Centralized Dashboard - View all uploaded documents
- Download & Delete - Full control over your files
- Metadata Tracking - File size, type, upload date
- Search & Filter - Find documents quickly
- Version History - Track document changes (coming soon)
- Responsive Design - Works on desktop, tablet, and mobile
- Dark Mode - Eye-friendly interface (coming soon)
- Smooth Animations - Polished, professional feel
- Accessibility - WCAG 2.1 compliant
- Fast Loading - Optimized performance
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.0.1 | React framework with App Router |
| React | 19.0 | UI library |
| TypeScript | 5.0+ | Type-safe development |
| Tailwind CSS | 3.4+ | Utility-first styling |
| Framer Motion | 11.0+ | Smooth animations |
| Zustand | 4.5+ | State management |
| Lucide React | Latest | Icon library |
| Technology | Purpose |
|---|---|
| Supabase | Backend as a Service |
| PostgreSQL | Relational database |
| Supabase Auth | User authentication |
| Supabase Storage | File storage |
| Row Level Security | Data access control |
| Real-time | Live updates |
| Technology | Purpose |
|---|---|
| RAG (Retrieval-Augmented Generation) | Document analysis |
| WebSocket | Real-time AI responses |
| Vector Search | Semantic document search |
| Tool | Purpose |
|---|---|
| ESLint | Code linting |
| Prettier | Code formatting |
| Git | Version control |
| npm | Package management |
Before you begin, ensure you have:
- Node.js 18.0 or higher (Download)
- npm 9.0 or higher (comes with Node.js)
- Git (Download)
- Supabase Account (Sign up)
- Code Editor (VS Code recommended)
# Clone the repository
git clone https://github.com/KpG782/lexiph.git
# Navigate to project directory
cd lexiph/lexiph
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your Supabase credentials
# Run development server
npm run devOpen http://localhost:3000 in your browser.
git clone https://github.com/KpG782/lexiph.git
cd lexiph/lexiphnpm installThis will install all required packages including:
- Next.js and React
- Supabase client
- Tailwind CSS
- Framer Motion
- And more...
- Go to Supabase Dashboard
- Click "New Project"
- Fill in project details
- Wait for project to be created
- Go to Settings β API
- Copy Project URL
- Copy anon/public key
Create .env.local in the project root:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
# Optional: Service Role Key (for admin operations)
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key- Open Supabase Dashboard β SQL Editor
- Click New Query
- Copy contents of
supabase-setup.sql - Click Run
This creates:
profiles- User profileschats- Chat conversationsmessages- Chat messagesdocuments- File metadatacompliance_reports- Analysis reportssearch_history- Search queries
-
Go to Storage β New Bucket
-
Name:
documents -
Public: OFF
-
File size limit:
5242880(5MB) -
Allowed MIME types:
application/pdf application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document text/plain text/markdown -
Run
supabase-storage-setup.sqlin SQL Editor
# For testing, insert sample data
# Run in SQL Editor:
supabase-insert-data-ken.sqlnpm run devVisit http://localhost:3000
npm run build
npm start- Navigate to
/auth/signup - Enter email and password
- Click "Sign Up"
- Verify email (if enabled)
- Login at
/auth/login
-
Ask a Question
- Type your legal question in the chat input
- Press Enter or click Send
- Receive AI-powered response
-
Example Questions
- "What are the requirements for RA 10173?"
- "How do I get a business permit in Manila?"
- "What is the process for SEC registration?"
-
Follow-up Questions
- Continue the conversation
- Ask for clarification
- Request more details
-
Switch to Compliance Mode
- Toggle the mode switch at bottom of chat
-
Upload Documents
- Drag and drop files onto the chat area
- Or click to browse and select files
- Up to 3 files, 5MB each
-
Add Query (Optional)
- Type specific questions about your documents
- Example: "Check compliance with RA 10121"
-
Analyze
- Click Send button
- Wait for analysis to complete
- View detailed compliance report
-
Review Results
- Read compliance score
- Check compliant sections
- Review recommendations
- Download report (coming soon)
-
View All Documents
- Click "Uploaded Files" button
- Or navigate to
/documents
-
Download Documents
- Click download icon next to file
- File downloads to your computer
-
Delete Documents
- Click delete icon
- Confirm deletion
- File removed from storage and database
-
Create New Chat
- Click "New Chat" button
- Start typing to create chat
-
View Chat History
- All chats listed in sidebar
- Click to open any chat
-
Delete Chat
- Hover over chat in sidebar
- Click delete icon
- Confirm deletion
lexiph/
βββ app/ # Next.js App Router
β βββ auth/ # Authentication pages
β β βββ login/ # Login page
β β βββ signup/ # Signup page
β β βββ callback/ # Auth callback
β β βββ verify-email/ # Email verification
β βββ chat/ # Chat interface
β β βββ page.tsx # Main chat page
β β βββ [chatId]/ # Individual chat
β βββ documents/ # Document management
β β βββ page.tsx # Documents page
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
β
βββ components/ # React components
β βββ auth/ # Auth components
β β βββ login-form.tsx
β β βββ signup-form.tsx
β βββ chat/ # Chat components
β β βββ chat-container.tsx
β β βββ chat-input.tsx
β β βββ chat-messages.tsx
β β βββ message-bubble.tsx
β β βββ empty-state.tsx
β β βββ centered-input.tsx
β β βββ uploaded-files-list.tsx
β β βββ uploaded-files-dialog.tsx
β β βββ user-documents-list.tsx
β β βββ ...
β βββ layout/ # Layout components
β β βββ chat-header.tsx
β β βββ user-menu.tsx
β βββ navigation/ # Navigation
β β βββ app-sidebar.tsx
β βββ ui/ # Reusable UI
β βββ button.tsx
β βββ input.tsx
β βββ dialog.tsx
β βββ toast.tsx
β
βββ lib/ # Utilities & services
β βββ store/ # Zustand stores
β β βββ auth-store.ts
β β βββ chat-store.ts
β β βββ chat-mode-store.ts
β β βββ file-upload-store.ts
β β βββ rag-store.ts
β β βββ sidebar-store.ts
β βββ services/ # API services
β β βββ rag-api.ts
β β βββ deep-search-api.ts
β βββ supabase/ # Supabase client
β β βββ client.ts
β β βββ README.md
β βββ utils.ts # Utility functions
β
βββ types/ # TypeScript types
β βββ index.ts
β
βββ public/ # Static assets
β βββ logo/
β βββ ...
β
βββ styles/ # Global styles
β βββ globals.css
β
βββ supabase-setup.sql # Database schema
βββ supabase-storage-setup.sql # Storage policies
βββ supabase-insert-data-ken.sql # Sample data
βββ supabase-insert-data-mark.sql # Sample data
β
βββ .env.local # Environment variables
βββ .gitignore # Git ignore rules
βββ next.config.ts # Next.js config
βββ tailwind.config.ts # Tailwind config
βββ tsconfig.json # TypeScript config
βββ package.json # Dependencies
βββ README.md # This file
| Table | Purpose | Rows (Est.) |
|---|---|---|
profiles |
User profiles | 1 per user |
chats |
Chat conversations | ~10 per user |
messages |
Chat messages | ~100 per chat |
documents |
File metadata | ~20 per user |
compliance_reports |
Analysis reports | ~10 per user |
search_history |
Search queries | ~50 per user |
CREATE TABLE profiles (
id UUID PRIMARY KEY REFERENCES auth.users(id),
email TEXT UNIQUE NOT NULL,
full_name TEXT,
avatar_url TEXT,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);CREATE TABLE chats (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL REFERENCES auth.users(id),
title TEXT NOT NULL,
mode TEXT NOT NULL DEFAULT 'general',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);CREATE TABLE messages (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
chat_id UUID NOT NULL REFERENCES chats(id) ON DELETE CASCADE,
role TEXT NOT NULL CHECK (role IN ('user', 'assistant', 'system')),
content TEXT NOT NULL,
metadata JSONB DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ DEFAULT NOW()
);CREATE TABLE documents (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL REFERENCES auth.users(id),
chat_id UUID REFERENCES chats(id),
file_name TEXT NOT NULL,
file_size INTEGER NOT NULL,
file_type TEXT NOT NULL,
storage_path TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending',
metadata JSONB DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);-- Performance indexes
CREATE INDEX idx_chats_user_id ON chats(user_id);
CREATE INDEX idx_messages_chat_id ON messages(chat_id);
CREATE INDEX idx_documents_user_id ON documents(user_id);
CREATE INDEX idx_chats_created_at ON chats(created_at DESC);All tables have RLS enabled with policies:
- Users can only SELECT their own data
- Users can only INSERT their own data
- Users can only UPDATE their own data
- Users can only DELETE their own data
POST /auth/signup
Body: { email: string, password: string, full_name?: string }
Response: { user, session }POST /auth/login
Body: { email: string, password: string }
Response: { user, session }POST /auth/logout
Response: { success: boolean }POST /api/chats
Body: { title: string, mode: 'general' | 'compliance' }
Response: { chat: Chat }GET /api/chats
Response: { chats: Chat[] }DELETE /api/chats/:id
Response: { success: boolean }POST /api/documents
Body: FormData { file: File, chat_id?: string }
Response: { document: Document }GET /api/documents
Response: { documents: Document[] }DELETE /api/documents/:id
Response: { success: boolean }- Supabase Auth - Industry-standard authentication
- JWT Tokens - Secure session management
- Password Hashing - bcrypt with salt
- Email Verification - Optional email confirmation
- Session Expiry - Automatic token refresh
- Row Level Security - Database-level access control
- Encrypted Storage - AES-256 encryption at rest
- HTTPS Only - TLS 1.3 for data in transit
- Signed URLs - Temporary file access
- Input Validation - Prevent injection attacks
- Type Validation - Only allowed file types
- Size Limits - 5MB maximum per file
- Virus Scanning - (Coming soon)
- User Isolation - Files stored per user
- Access Logs - Track all file access
- β
Never commit
.env.local - β Use environment variables for secrets
- β Enable email verification in production
- β Regular security audits
- β Keep dependencies updated
- β Monitor for suspicious activity
- Code Splitting - Lazy load components
- Image Optimization - Next.js Image component
- Caching - Browser and CDN caching
- Database Indexes - Fast query performance
- Connection Pooling - Efficient database connections
| Metric | Target | Current |
|---|---|---|
| First Contentful Paint | < 1.5s | ~1.2s |
| Time to Interactive | < 3.0s | ~2.5s |
| Largest Contentful Paint | < 2.5s | ~2.0s |
| Cumulative Layout Shift | < 0.1 | ~0.05 |
- Vercel Analytics - Real-time performance monitoring
- Supabase Logs - Database query performance
- Error Tracking - Sentry integration (coming soon)
# Unit tests
npm test
# Integration tests
npm run test:integration
# E2E tests
npm run test:e2e
# Coverage report
npm run test:coveragetests/
βββ unit/ # Unit tests
βββ integration/ # Integration tests
βββ e2e/ # End-to-end tests
- Jest - Test runner
- React Testing Library - Component testing
- Playwright - E2E testing
- MSW - API mocking
-
Connect Repository
# Install Vercel CLI npm i -g vercel # Deploy vercel
-
Configure Environment Variables
- Add
NEXT_PUBLIC_SUPABASE_URL - Add
NEXT_PUBLIC_SUPABASE_ANON_KEY
- Add
-
Deploy
vercel --prod
# Build
npm run build
# Start production server
npm start# Production
NODE_ENV=production
NEXT_PUBLIC_SUPABASE_URL=your_production_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_production_keyWe welcome contributions! Here's how:
- Fork the repository
- Clone your fork
git clone https://github.com/your-username/lexiph.git
- Create a branch
git checkout -b feature/amazing-feature
- Make changes
- Commit
git commit -m 'Add amazing feature' - Push
git push origin feature/amazing-feature
- Open Pull Request
- Follow TypeScript best practices
- Use Prettier for formatting
- Write meaningful commit messages
- Add tests for new features
- Update documentation
- Clear description of changes
- Link related issues
- Include screenshots for UI changes
- Ensure tests pass
- Update documentation
- User authentication
- Chat interface
- Document upload
- Compliance analysis
- Document management
- Multi-language support (Filipino, English)
- Advanced document comparison
- Compliance templates
- Export reports to PDF
- Email notifications
- Mobile app (iOS, Android)
- API access for developers
- Batch document processing
- Compliance calendar
- Team collaboration
- SSO integration
- Custom branding
- Advanced analytics
- Audit logs
- SLA guarantees
Q: Is LexInSight free to use? A: Currently in beta, free for all users.
Q: What Philippine laws are covered? A: Major laws including RA 10173 (Data Privacy), RA 10121 (Disaster Risk Reduction), RA 9003 (Solid Waste Management), Labor Code, and more.
Q: Can I use this for legal advice? A: LexInSight provides information and guidance but is not a substitute for professional legal advice.
Q: What file types are supported? A: PDF, Word (.doc, .docx), Markdown (.md), and Text (.txt) files.
Q: What's the file size limit? A: 5MB per file, up to 3 files at once.
Q: Is my data secure? A: Yes, we use enterprise-grade security with encryption and Row Level Security.
Q: Can I delete my data? A: Yes, you can delete individual documents or your entire account.
- Documentation: Check our guides
- Issues: GitHub Issues
- Email: support@lexinsight.ph (coming soon)
- Discord: Join our community (coming soon)
- Check existing issues
- Create new issue with:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- Screenshots if applicable
This project is licensed under the MIT License - see the LICENSE file for details.
![]() Ken Patrick Garcia Full Stack Developer GitHub |
Jam Villarosa AI/ML Engineer GitHub |
Mark Siazon UI/UX Designer GitHub |
Ashlyn Torres Project Manager |
- Frontend development (Next.js, React, TypeScript)
- Backend integration (Supabase, API design)
- Database architecture and optimization
- State management and data flow
- Performance optimization
- Code review and quality assurance
- RAG (Retrieval-Augmented Generation) implementation
- Document analysis algorithms
- AI model integration and optimization
- Natural language processing
- Vector search and embeddings
- ML pipeline development
- User interface design
- User experience research
- Design system creation
- Wireframing and prototyping
- Accessibility compliance
- Visual design and branding
- Project planning and coordination
- Sprint management and agile methodology
- Stakeholder communication
- Requirements gathering
- Timeline and milestone tracking
- Team collaboration facilitation
Thanks to all contributors who have helped make LexInSight better!
Want to contribute? Check out our Contributing Guidelines.
- Philippine Government - For making legal information accessible and promoting digital transformation
- Department of Justice (DOJ) - For comprehensive legal resources
- National Privacy Commission (NPC) - For Data Privacy Act guidance
- Supabase - For excellent backend infrastructure and real-time capabilities
- Next.js Team - For the amazing React framework and developer experience
- Vercel - For seamless hosting, deployment, and edge network
- Tailwind Labs - For the utility-first CSS framework
Special thanks to the maintainers and contributors of:
- React and React ecosystem
- TypeScript
- Framer Motion
- Zustand
- Lucide Icons
- And countless other open source projects
- Legal Tech Community - For pioneering accessible legal solutions
- Philippine Startup Ecosystem - For fostering innovation
- Our Beta Testers - For valuable feedback and suggestions
- University of Makati - For academic support and resources
Built with β€οΈ for Philippine Legal Compliance
Team LexInSight
- Ken Patrick Garcia (Full Stack Developer)
- Jam Villarosa (AI/ML Engineer)
- Mark Siazon (UI/UX Designer)
- Ashlyn Torres (Project Manager)
Website β’ Documentation β’ Report Bug β’ Request Feature
Β© 2025 LexInSight. All rights reserved.
