Skip to content

yagnesh44/Legis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏢 Legis

A comprehensive, full-stack AI-powered platform that helps US businesses understand and comply with federal, state, and local regulations. Legis features an interactive React frontend, a real-time conversational AI Voice Assistant, and a Node.js/Firebase backend that pulls live rules from government databases.

🚀 Features

  • Real-Time Voice Assistant: Features an integrated Vapi AI Voice Assistant powered by Deepgram Nova-2 transcription and OpenAI GPT-4. Talk to the assistant to automatically fill out your business profile!
  • AI-Powered Rule Generation: Uses OpenAI gpt-5-nano to summarize and structure comprehensive compliance rules.
  • Multi-Level Coverage: Fetches data from Regulations.gov, SBA, and IRS APIs.
  • Smart Business Matching: Matches rules to specific business profiles (LLC, Corp, Industry, State).
  • Modern React Frontend: A beautiful, responsive, Tailwind CSS-powered UI that displays rules and AI reports.
  • Node.js Backend: An Express server handling real-time API aggregation and Firebase Firestore storage.

🏗️ Architecture

Frontend (React + Vapi AI) ↔ Backend (Node.js + Express) ↔ External APIs
      ↓                             ↓                            ↓
Voice Data / Form Data        Data Processor            Regulations.gov
      ↓                             ↓                   SBA API / IRS
Real-Time State Auto-Fill     OpenAI GPT-5-nano         Firebase Firestore

📋 Tech Stack

  • Frontend: React, TypeScript, Tailwind CSS, Vite, Lucide Icons
  • Voice AI: Vapi AI Web SDK, Deepgram Nova-2
  • Backend: Node.js, Express, TypeScript
  • Database: Firebase Firestore (Admin SDK)
  • AI Processing: OpenAI API (gpt-5-nano / gpt-4)
  • External Data: Regulations.gov, SBA API

🔧 Setup Instructions

1. Prerequisites

  • Node.js 18+ installed
  • Firebase project with Firestore Database enabled
  • OpenAI API Key
  • Vapi AI Account (for voice functionality)
  • Government API Keys (Regulations.gov)

2. Installation

# Clone the repository
git clone <your-repo-url>
cd legis

# Install backend dependencies
npm install

# Install frontend dependencies
cd frontend
npm install
cd ..

3. Environment Configuration

Backend .env (Root Directory):

FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_KEY\n-----END PRIVATE KEY-----\n"
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxxxx@your-project.iam.gserviceaccount.com

OPENAI_API_KEY=your-openai-api-key
REGULATIONS_API_KEY=your-regulations-gov-key
SBA_API_KEY=your-sba-api-key
NODE_ENV=development

Frontend .env (/frontend/.env):

VITE_VAPI_PUBLIC_KEY=your-vapi-public-key

4. Running the Application

We've provided a simple shell script to launch both the React frontend and the Node backend simultaneously.

# Make the script executable
chmod +x start-servers.sh

# Run the platform!
./start-servers.sh
  • Frontend: http://localhost:5173
  • Backend: http://localhost:3001

🗂️ Project Structure

legis/
├── frontend/                   # React Frontend App
│   ├── src/
│   │   ├── components/         # React Components
│   │   │   ├── VoiceAssistant.tsx # Vapi AI integration
│   │   │   └── ComplianceResults.tsx
│   │   ├── config/             # Frontend Configurations
│   │   ├── services/           # Frontend API Services
│   │   ├── types/              # Frontend TypeScript Interfaces
│   │   ├── App.tsx             # Main React Application
│   │   ├── index.css           # Tailwind directives
│   │   └── main.tsx            # React Entry Point
│   ├── package.json            # Frontend Dependencies
│   └── .env                    # Frontend environment variables
├── src/                        # Backend Services (TypeScript)
│   ├── config/                 # Firebase and App Config
│   ├── services/               # Core Backend Logic
│   │   ├── RealTimeComplianceSearch.js
│   │   ├── AIRuleGenerator.ts
│   │   └── FirestoreService.ts
│   ├── types/                  # Backend TypeScript Interfaces
│   └── test-*.ts               # Testing Scripts (E2E, Firebase, OpenAI)
├── scripts/                    # Utility Scripts
├── server.js                   # Node.js Express API Server
├── start-servers.sh            # Launch script for both servers
├── package.json                # Backend Dependencies
└── .env                        # Backend environment variables

🔍 Troubleshooting

  1. Voice Assistant Infinite Buffering / Timeout

    • Ensure your browser has Microphone permissions allowed for localhost.
    • Ensure VITE_VAPI_PUBLIC_KEY is set correctly in frontend/.env and restart the servers.
  2. Backend 500 Error / Firebase Denied

    • Ensure Firestore Database is actively created and enabled in your Firebase console.
    • Verify that your FIREBASE_PRIVATE_KEY has correct \n newline formatting in your .env file.
  3. OpenAI Quota Error (429)

    • Ensure you have active billing credits in your OpenAI account, as the AI report generation requires API credits.

📄 License

MIT License

About

A comprehensive, full-stack AI-powered platform that helps US businesses understand and comply with federal, state, and local regulations. Legis features an interactive React frontend, a real-time conversational AI Voice Assistant, and a Node.js/Firebase backend that pulls live rules from government databases.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors