{"id":31136976,"url":"https://github.com/ab1nv/patra-saar","last_synced_at":"2026-04-28T23:37:30.768Z","repository":{"id":314146998,"uuid":"1054345635","full_name":"ab1nv/patra-saar","owner":"ab1nv","description":"Skipping legal mumbo-jumbo.","archived":false,"fork":false,"pushed_at":"2026-04-24T10:02:40.000Z","size":122455,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"v2","last_synced_at":"2026-04-28T23:37:24.818Z","etag":null,"topics":["go","golang","hackathon","indianlaw","legal","nextjs","shadcn","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ab1nv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"buy_me_a_coffee":"ab1nv"}},"created_at":"2025-09-10T17:51:23.000Z","updated_at":"2026-04-13T09:03:10.000Z","dependencies_parsed_at":"2025-09-10T22:48:53.978Z","dependency_job_id":"0fea5f0e-37e9-4f24-aefc-1dbc14585058","html_url":"https://github.com/ab1nv/patra-saar","commit_stats":null,"previous_names":["ab1nv/patra-saar"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ab1nv/patra-saar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab1nv%2Fpatra-saar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab1nv%2Fpatra-saar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab1nv%2Fpatra-saar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab1nv%2Fpatra-saar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ab1nv","download_url":"https://codeload.github.com/ab1nv/patra-saar/tar.gz/refs/heads/v2","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab1nv%2Fpatra-saar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32404340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","hackathon","indianlaw","legal","nextjs","shadcn","typescript"],"created_at":"2025-09-18T08:04:39.179Z","updated_at":"2026-04-28T23:37:30.749Z","avatar_url":"https://github.com/ab1nv.png","language":"TypeScript","funding_links":["https://buymeacoffee.com/ab1nv"],"categories":[],"sub_categories":[],"readme":"# PatraSaar\n\nPatraSaar is a web application that specializes in summarizing Indian legal documents and making complex legal jargon accessible to ordinary people. The platform provides secure document upload, automated text extraction, AI-powered summarization, and an interactive Q\u0026A interface.\n\n## Features\n\n- **Secure File Upload**: Support for .txt, .pdf, and .docx files with validation\n- **Text Extraction**: Automated extraction from various document formats\n- **AI-Powered Summarization**: Generate clear, simple summaries of legal documents\n- **Interactive Q\u0026A**: Ask questions about uploaded documents and get explanations\n- **Real-time Processing**: Background task processing with status updates\n- **Responsive Design**: Modern, mobile-friendly interface built with Next.js and shadcn/ui\n\n## Architecture\n\nPatraSaar follows a modern microservices architecture:\n\n- **Frontend**: Next.js 15 with TypeScript, Tailwind CSS, and shadcn/ui components\n- **Backend**: Go with Gin web framework for high-performance API\n- **Database**: PostgreSQL for reliable data storage\n- **Task Queue**: Redis with Asynq for background job processing\n- **AI Integration**: Fine-tuned GPT model for legal document analysis\n\n## API Endpoints\n\n### Document Management\n\n#### Upload Document\n```http\nPOST /api/upload\nContent-Type: multipart/form-data\n\nForm Data:\n- file: Document file (.txt, .pdf, .docx)\n\nResponse:\n{\n  \"document_id\": \"uuid\",\n  \"filename\": \"document.pdf\",\n  \"raw_text\": \"extracted text content\"\n}\n```\n\n#### Get Document Status\n```http\nGET /api/documents/{id}/status\n\nResponse:\n{\n  \"status\": \"PENDING|PROCESSING|COMPLETED|FAILED\",\n  \"summary\": \"generated summary (if completed)\"\n}\n```\n\n#### Get Document Details\n```http\nGET /api/documents/{id}\n\nResponse:\n{\n  \"id\": \"uuid\",\n  \"filename\": \"document.pdf\",\n  \"raw_text\": \"extracted text\",\n  \"summary\": \"generated summary\",\n  \"status\": \"COMPLETED\",\n  \"created_at\": \"2024-01-01T00:00:00Z\",\n  \"updated_at\": \"2024-01-01T00:00:00Z\",\n  \"file_size\": 1024,\n  \"content_type\": \"application/pdf\"\n}\n```\n\n### Q\u0026A Interface\n\n#### Query Document\n```http\nPOST /api/documents/{id}/query\nContent-Type: application/json\n\n{\n  \"question\": \"What are the main obligations in this contract?\"\n}\n\nResponse:\n{\n  \"answer\": \"Based on the document, the main obligations are...\"\n}\n```\n\n#### Stream Query (Real-time)\n```http\nGET /api/documents/{id}/query/stream?question=your+question\n\nResponse: Server-Sent Events stream\n```\n\n### Health and Monitoring\n\n#### Health Check\n```http\nGET /health\n\nResponse:\n{\n  \"status\": \"healthy|unhealthy\",\n  \"timestamp\": \"2024-01-01T00:00:00Z\",\n  \"version\": \"1.0.0\",\n  \"services\": {\n    \"database\": \"healthy\",\n    \"redis\": \"healthy\"\n  },\n  \"uptime\": \"1h30m45s\"\n}\n```\n\n#### Readiness Check\n```http\nGET /ready\n\nResponse:\n{\n  \"status\": \"ready|not ready\"\n}\n```\n\n#### Metrics\n```http\nGET /api/metrics\n\nResponse:\n{\n  \"RequestCount\": {...},\n  \"RequestDuration\": {...},\n  \"ErrorCount\": {...}\n}\n```\n\n## Database Schema\n\n### Documents Table\n```sql\nCREATE TABLE documents (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    filename TEXT NOT NULL,\n    raw_text TEXT NOT NULL,\n    summary TEXT,\n    status VARCHAR(20) DEFAULT 'PENDING' CHECK (status IN ('PENDING', 'PROCESSING', 'COMPLETED', 'FAILED')),\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    file_size INTEGER NOT NULL,\n    content_type VARCHAR(100) NOT NULL\n);\n```\n\n### Chat Sessions Table (Optional)\n```sql\nCREATE TABLE chat_sessions (\n    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    document_id UUID NOT NULL REFERENCES documents(id) ON DELETE CASCADE,\n    messages JSONB NOT NULL DEFAULT '[]'::jsonb,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n## Installation\n\n### Prerequisites\n\n- Node.js 18+ and pnpm\n- Go 1.21+\n- PostgreSQL 15+\n- Redis 7+\n- Docker (optional)\n\n### Local Development Setup\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/your-org/patrasaar.git\n   cd patrasaar\n   ```\n\n2. **Install dependencies**\n   ```bash\n   make install\n   ```\n\n3. **Set up environment variables**\n   ```bash\n   # Copy example environment files\n   cp frontend/.env.example frontend/.env.local\n   cp backend/.env.example backend/.env\n   \n   # Edit the files with your configuration\n   ```\n\n4. **Set up the database**\n   ```bash\n   # Start PostgreSQL and Redis (if using Docker)\n   docker-compose up -d postgres redis\n   \n   # Run database migrations\n   make db-migrate\n   ```\n\n5. **Start the development environment**\n   ```bash\n   make run\n   ```\n\n   This will start:\n   - Frontend at http://localhost:3000\n   - Backend API at http://localhost:8080\n   - Background worker for document processing\n\n### Docker Setup\n\n1. **Build and run with Docker Compose**\n   ```bash\n   docker-compose up --build\n   ```\n\n2. **Access the application**\n   - Frontend: http://localhost:3000\n   - Backend API: http://localhost:8080\n   - Health check: http://localhost:8080/health\n\n## Development\n\n### Available Commands\n\n```bash\n# Development\nmake dev-setup    # Set up development environment\nmake run          # Start all services with hot reloading\nmake restart      # Restart all services\nmake status       # Show service status\n\n# Testing\nmake test         # Run all tests\nmake test-coverage # Run tests with coverage\n\n# Building\nmake build        # Build all components\nmake clean        # Clean build artifacts\n\n# Database\nmake db-migrate   # Run database migrations\nmake db-reset     # Reset and re-migrate database\n\n# Utilities\nmake lint         # Run linters\nmake logs         # Show recent logs\nmake ps           # Show running processes\nmake kill         # Stop all development processes\n```\n\n### Project Structure\n\n```\npatrasaar/\n├── frontend/                 # Next.js application\n│   ├── src/\n│   │   ├── app/             # App Router pages\n│   │   ├── components/      # React components\n│   │   ├── lib/            # Utilities and API client\n│   │   └── stores/         # Zustand stores\n│   └── public/             # Static assets\n├── backend/                 # Go application\n│   ├── cmd/\n│   │   ├── api/            # API server\n│   │   └── worker/         # Background worker\n│   ├── internal/\n│   │   ├── handlers/       # HTTP handlers\n│   │   ├── services/       # Business logic\n│   │   ├── models/         # Data models\n│   │   └── middleware/     # HTTP middleware\n│   └── pkg/                # Shared packages\n├── database/               # Database schemas and migrations\n├── docker/                 # Docker configurations\n├── .github/workflows/      # CI/CD pipelines\n├── config/                 # Application configuration\n└── Makefile               # Development commands\n```\n\n### Configuration\n\nThe application uses a YAML configuration file at `config/app.yaml`:\n\n```yaml\napp:\n  name: \"PatraSaar\"\n  version: \"1.0.0\"\n  environment: \"development\"\n\nserver:\n  host: \"localhost\"\n  port: 8080\n  read_timeout: \"30s\"\n  write_timeout: \"30s\"\n\ndatabase:\n  host: \"localhost\"\n  port: 5432\n  name: \"patrasaar\"\n  user: \"postgres\"\n  password: \"postgres\"\n\nfile_processing:\n  max_file_size_mb: 50\n  max_pdf_pages: 100\n  allowed_extensions: [\".txt\", \".pdf\", \".docx\"]\n\nai_service:\n  endpoint: \"http://localhost:8000\"\n  timeout: \"120s\"\n  max_retries: 3\n\nsecurity:\n  cors_origins: [\"http://localhost:3000\"]\n  rate_limit_requests_per_minute: 100\n```\n\n## Testing\n\n### Frontend Tests\n```bash\ncd frontend\npnpm run test              # Run tests\npnpm run test:watch        # Run tests in watch mode\npnpm run test:coverage     # Run tests with coverage\n```\n\n### Backend Tests\n```bash\ncd backend\ngo test ./...              # Run all tests\ngo test -cover ./...       # Run tests with coverage\ngo test -v ./...           # Run tests with verbose output\n```\n\n### Integration Tests\n```bash\nmake test                  # Run all tests (frontend + backend)\n```\n\n## Deployment\n\n### Production Build\n\n1. **Build the application**\n   ```bash\n   make build\n   ```\n\n2. **Build Docker images**\n   ```bash\n   docker build -f docker/Dockerfile.frontend -t patrasaar-frontend .\n   docker build -f docker/Dockerfile.backend -t patrasaar-backend .\n   ```\n\n3. **Deploy with Docker Compose**\n   ```bash\n   docker-compose -f docker-compose.prod.yml up -d\n   ```\n\n### Environment Variables\n\n#### Frontend (.env.local)\n```env\nNEXT_PUBLIC_API_URL=http://localhost:8080/api\n\\n+# Enable runtime controls (Tweakpane) for the metaball background (optional)\n# Set to 1 to show panel in browser\nNEXT_PUBLIC_METABALL_CONTROLS=0\n```\n\n#### Backend (.env)\n```env\nDB_HOST=localhost\nDB_PORT=5432\nDB_NAME=patrasaar\nDB_USER=postgres\nDB_PASSWORD=postgres\nREDIS_HOST=localhost\nREDIS_PORT=6379\nAI_SERVICE_ENDPOINT=http://localhost:8000\n```\n\n## Security\n\nPatraSaar implements several security measures:\n\n- **Input Validation**: File type and size validation\n- **Rate Limiting**: API endpoint protection\n- **CORS Configuration**: Restricted cross-origin requests\n- **SQL Injection Prevention**: Parameterized queries\n- **Error Handling**: Secure error responses\n- **Dependency Scanning**: Automated vulnerability checks\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n### Development Guidelines\n\n- Follow the existing code style and conventions\n- Write tests for new features\n- Update documentation as needed\n- Ensure all CI checks pass\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nFor support and questions:\n\n- Create an issue on GitHub\n- Check the documentation\n- Review existing issues and discussions\n\n## Roadmap\n\\n+## Visual Background System\n\nThe hero / site background uses a performant GPU metaball ray-marched shader implemented in `MetaballBackground` (Three.js + GLSL). It replaces the older `DarkVeil` component.\n\nKey points:\n- Fully declarative React component (client-side only) – safe with Next.js App Router\n- Adaptive quality: lowers iterations on mobile / low-power devices automatically\n- Preset-based visual styles (extendable in `MetaballBackground.tsx`)\n- Optional real-time tuning panel (Tweakpane) gated by `NEXT_PUBLIC_METABALL_CONTROLS=1`\n- Cleans up WebGL resources on unmount to avoid memory leaks\n\nTo enable the control panel locally:\n```bash\necho \"NEXT_PUBLIC_METABALL_CONTROLS=1\" \u003e\u003e frontend/.env.local\n```\n\nThen restart the frontend dev server. A floating \"Metaballs\" panel will appear allowing you to tweak animation, blending, and counts.\n\nIf you need to add a new visual preset, extend the `presets` object near the top of `MetaballBackground.tsx` and ensure all uniform fields are provided.\n\n- [ ] Enhanced AI model fine-tuning for Indian legal documents\n- [ ] Multi-language support (Hindi, regional languages)\n- [ ] Document comparison features\n- [ ] Advanced search and filtering\n- [ ] User authentication and document management\n- [ ] Mobile application\n- [ ] Integration with legal databases","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fab1nv%2Fpatra-saar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fab1nv%2Fpatra-saar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fab1nv%2Fpatra-saar/lists"}