Skip to content

Repository files navigation

Lawgenix AI

AI-powered legal case management platform built with Next.js, Supabase, and advanced AI technologies.

πŸš€ Features

  • AI-Powered Document Analysis: Advanced document analysis and legal research powered by cutting-edge AI
  • Case Management: Organize and manage all your legal documents in one secure platform
  • Secure & Compliant: Enterprise-grade security with full compliance for legal professionals
  • Team Collaboration: Work seamlessly with your team on cases and document analysis
  • Lightning Fast: Get instant insights and analysis with optimized AI processing
  • User Authentication: Secure login/signup with Supabase authentication
  • Modern UI: Clean, professional light theme interface

πŸ› οΈ Tech Stack

  • Frontend: Next.js 14 with App Router
  • Styling: Tailwind CSS v4 with custom design system
  • Authentication: Supabase Auth with Row Level Security (RLS)
  • Database: PostgreSQL via Supabase
  • AI Services:
    • Anthropic Claude for conversational AI
    • Voyage AI for text embeddings
    • DataStax Astra DB for vector storage
  • UI Components: Custom component library with Radix UI primitives
  • Deployment: Vercel-ready configuration

πŸ“‹ Prerequisites

  • Node.js 18+
  • npm or yarn
  • Supabase account
  • Anthropic API key
  • Voyage AI API key
  • DataStax Astra DB account

πŸš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd LawGenix-AI

2. Install Dependencies

npm install
# or
yarn install

3. Environment Configuration

Create a .env.local file in the root directory:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

# Database URLs (for Prisma)
DATABASE_URL=your_supabase_database_url
DIRECT_URL=your_supabase_direct_url

# AI Services
ANTHROPIC_API_KEY=your_anthropic_api_key
VOYAGE_API_KEY=your_voyage_api_key

# Astra DB Configuration
ASTRA_DB_APPLICATION_TOKEN=your_astra_db_token
ASTRA_DB_ID=your_astra_db_id
ASTRA_DB_REGION=your_astra_db_region
ASTRA_DB_KEYSPACE=your_keyspace

# Application
NEXT_PUBLIC_BASE_URL=http://localhost:3000

4. Database Setup

Run the Supabase setup script in your Supabase SQL editor:

-- Enable Row Level Security
ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;
ALTER TABLE "Case" ENABLE ROW LEVEL SECURITY;
ALTER TABLE "Document" ENABLE ROW LEVEL SECURITY;
ALTER TABLE "Conversation" ENABLE ROW LEVEL SECURITY;
ALTER TABLE "Message" ENABLE ROW LEVEL SECURITY;
ALTER TABLE "LinkedImage" ENABLE ROW LEVEL SECURITY;

-- Create trigger for automatic profile creation
CREATE OR REPLACE FUNCTION public.handle_new_user()
RETURNS TRIGGER AS $$
BEGIN
  INSERT INTO public.profiles (id, email, display_name)
  VALUES (NEW.id, NEW.email, COALESCE(NEW.raw_user_meta_data->>'full_name', NEW.email));
  RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER on_auth_user_created
  AFTER INSERT ON auth.users
  FOR EACH ROW EXECUTE FUNCTION public.handle_new_user();

-- Add RLS policies (see supabase-setup.sql for complete setup)

5. Start Development Server

npm run dev
# or
yarn dev

Open http://localhost:3000 to view the application.

πŸ—οΈ Project Structure

LawGenix-AI/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/                   # Authentication routes
β”‚   β”‚   └── auth/
β”‚   β”‚       β”œβ”€β”€ login/           # Login page
β”‚   β”‚       β”œβ”€β”€ signup/          # Signup page
β”‚   β”‚       β”œβ”€β”€ callback/        # OAuth callback
β”‚   β”‚       └── actions.ts       # Auth server actions
β”‚   β”œβ”€β”€ (dashboard)/             # Protected dashboard routes
β”‚   β”‚   └── dashboard/           # Main dashboard
β”‚   β”œβ”€β”€ api/                     # API routes
β”‚   β”‚   β”œβ”€β”€ conversations/       # Chat API
β”‚   β”‚   β”œβ”€β”€ health/             # Health check
β”‚   β”‚   └── agent/              # AI agent endpoints
β”‚   β”œβ”€β”€ globals.css              # Global styles
β”‚   β”œβ”€β”€ layout.tsx               # Root layout
β”‚   └── page.tsx                 # Landing page
β”œβ”€β”€ components/                   # React components
β”‚   β”œβ”€β”€ ui/                      # UI component library
β”‚   β”œβ”€β”€ app-sidebar.tsx          # Main sidebar
β”‚   β”œβ”€β”€ login-form.tsx           # Login form
β”‚   β”œβ”€β”€ signup-form.tsx          # Signup form
β”‚   └── nav-user.tsx             # User navigation
β”œβ”€β”€ utils/                       # Utility functions
β”‚   β”œβ”€β”€ supabase/                # Supabase client setup
β”‚   └── ragFunctions/            # AI/RAG functions
β”œβ”€β”€ prisma/                      # Database schema
β”‚   └── schema.prisma            # Prisma schema
β”œβ”€β”€ middleware.ts                 # Next.js middleware
β”œβ”€β”€ tailwind.config.ts           # Tailwind configuration
└── package.json                 # Dependencies

πŸ”§ Configuration

Supabase Setup

  1. Create a new Supabase project
  2. Enable Row Level Security (RLS)
  3. Run the SQL setup script from supabase-setup.sql
  4. Configure authentication settings:
    • Disable email confirmation requirement
    • Set up OAuth providers (GitHub, Google)
  5. Get your database URLs:
    • Go to Settings > Database
    • Copy the connection strings for DATABASE_URL and DIRECT_URL

AI Services Configuration

Anthropic (Claude)

Voyage AI

  • Sign up at Voyage AI
  • Generate API key for embeddings
  • Add to environment variables

DataStax Astra DB

  • Create account at DataStax Astra
  • Create a new database
  • Generate application token
  • Configure keyspace and region

🎨 UI/UX Features

  • Light Theme: Clean, professional white background with dark text
  • Responsive Design: Works on desktop, tablet, and mobile
  • Modern Components: Custom UI component library
  • Accessibility: WCAG compliant design
  • Loading States: Smooth loading animations
  • Error Handling: User-friendly error messages

πŸ” Authentication Flow

  1. Signup: Users create accounts with email/password or OAuth
  2. Profile Creation: Automatic profile creation in profiles table
  3. Login: Secure authentication with Supabase
  4. Session Management: Automatic session handling with middleware
  5. Logout: Complete session clearing and redirect

πŸš€ Deployment

Vercel Deployment

  1. Connect your GitHub repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy automatically on push to main branch

Environment Variables for Production

Ensure all environment variables are set in your deployment platform:

NEXT_PUBLIC_SUPABASE_URL=your_production_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_production_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_production_service_role_key
DATABASE_URL=your_production_database_url
DIRECT_URL=your_production_direct_url
ANTHROPIC_API_KEY=your_production_anthropic_key
VOYAGE_API_KEY=your_production_voyage_key
ASTRA_DB_APPLICATION_TOKEN=your_production_astra_token
ASTRA_DB_ID=your_production_astra_db_id
ASTRA_DB_REGION=your_production_region
ASTRA_DB_KEYSPACE=your_production_keyspace
NEXT_PUBLIC_BASE_URL=https://your-domain.com

πŸ§ͺ Testing

# Run tests
npm run test

# Run linting
npm run lint

# Type checking
npm run type-check

πŸ“ Recent Updates

  • βœ… Branding Update: Changed from "Legal Assist AI" to "Lawgenix AI"
  • βœ… Light Theme: Complete transition from dark to light theme
  • βœ… Navigation Cleanup: Removed "Data Library", "Document Assistant", "Reports"
  • βœ… Authentication Fixes: Improved login/signup flow and session management
  • βœ… User Profile: Fetch and display correct user data from profiles table
  • βœ… Logout Functionality: Proper session clearing and redirect
  • βœ… CSS Fixes: Resolved Tailwind CSS v4 configuration issues
  • βœ… Vercel Deployment: Fixed build conflicts and added proper configuration

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support, email support@lawgenix.ai or create an issue in this repository.


Lawgenix AI - Empowering legal professionals with intelligent AI solutions.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages