Skip to content
Projekte

Über uns

Educational legal information and research platform focused on Bangladesh law and selected international legal materials.

Lernen und Bildung

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
Aktualisierung verzögert
in 7 days
Aktualisierung verzögert
in 15 days
Aktualisierung verzögert
in 1 month
Aktualisierung verzögert

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Nyayota

Accessible, Transparent Legal Knowledge & Research Platform

An open educational legal knowledge, statutory research, and navigation engine designed to make national and international codified laws searchable, comparable, and understandable.

Next.js React TypeScript Tailwind CSS Google Gen AI SDK License: MIT Deployment

Live Web Application • Source Repository • Bangladesh Laws • International Treaties • AI Assistant


Nyayota homepage

Screenshot of the Nyayota website homepage (https://nyayota.vercel.app).


Table of Contents


Overview

Nyayota (derived from Nyaya, the Sanskrit and Bengali concept for justice, righteousness, and logical equity) is an open-access legal information and research web platform. It structures, organizes, and explains codified statutory legislation, constitutional jurisprudence, procedural codes, and international multilateral treaties.

Legal codes are frequently published across fragmented government gazettes, written in dense statutory prose, laden with archaic phrasing, or isolated in inaccessible PDF archives. Nyayota was built to make these primary legal texts transparent, searchable, and cross-referenced with plain-language explanations, bilingual terminology (English and Bengali), and educational procedural guidance.

The Problem We Address

  1. Information Fragmentation: Official legislation is dispersed across disparate gazette archives, historical amendments, and volume collections, complicating statutory research for non-specialists.
  2. Linguistic & Conceptual Barriers: Legal maxims, Latin doctrines, and archaic statutory drafting often alienate ordinary citizens seeking to understand their basic legal rights.
  3. Absence of Unified Cross-Referencing: Constitutional safeguards, criminal provisions, procedural remedies, and international human rights conventions are rarely presented side-by-side.
  4. Lack of Transparent Source Attribution: Secondary summaries online often fail to cite the exact gazette publication, enactment year, or authoritative government portal.

Target Audience

  • Citizens & Everyday Litigants: Individuals seeking plain-language explanations of their basic legal rights, bail provisions, police procedures (FIR vs. General Diary), or family laws.
  • Law Students & Academics: Researchers requiring structured statutory sections, comparative law analysis, and citation generation across Bluebook, OSCOLA, APA, and MLA styles.
  • Legal Practitioners & Researchers: Advocates seeking quick, client-side access to section-by-section statutory text, bailability classifications, and cross-references.
  • Human Rights & Civil Society Organizations: Advocates tracking international treaty obligations (UDHR, ICCPR, CAT, CEDAW) against domestic constitutional protections.

Educational Scope & Non-Advocacy Notice

Nyayota is strictly an educational and informational knowledge platform. It is not a law firm, does not engage in the practice of law, and does not provide formal legal representation, attorney-client relationships, or judicial outcome guarantees.


Feature Matrix

The following table reflects the actual implementation status of features verified within the repository codebase:

Feature Area Key Functionality Source Reference Implementation Status
Bangladesh Statutory Catalog Section-by-section indexing of major Bangladesh statutes across British India, Pakistan, and Bangladesh eras with volume citations. /app/bangladesh-laws, /lib/bdcode-data/* Implemented
International Law Database Multilateral treaties, UN conventions, and international humanitarian laws with official UNTS citations and depositary records. /app/international-laws, /lib/international-law-data.ts Implemented
Statute Detail Engine Section navigation, bilingual Bengali/English headings, legislative history, "Explain Like I'm 15" plain summaries, and copy-section links. /app/law/[id], /lib/legal-data.ts Implemented
Global Full-Text Search Client-side search across statutes, categories, sections, Latin maxims, and keywords with recent search history caching. /components/GlobalSearch.tsx, /lib/legal-database-engine.ts Implemented
Comparative Law Matrix Side-by-side comparative analysis of two statutes or international conventions with section diffing and concept alignment. /app/compare, /lib/legal-data.ts Implemented
Legal Outcome Guide Practical citizen workflows covering arrest rights, bail, filing an FIR vs. GD, tenancy disputes, cheque dishonor, and labor claims. /app/legal-outcome-guide Implemented
AI Legal Explainer Public AI assistant temporarily suspended on /ai-assistant and /api/ai-assistant (HTTP 503 maintenance mode) while conversational grounded models undergo upgrade. /app/api/ai-assistant/route.ts, /app/ai-assistant Suspended (Under Development)
Deterministic Nyayota AI Engine Source-grounded statutory retrieval engine, 10-category intent classifier, exact provision matching, anti-substitution guards, and evaluation suite (preserved in codebase for development). /lib/nyayota-ai/*, /components/CitationCard.tsx, /components/ClarificationCard.tsx Implemented (Engine Preserved)
Bilingual Legal Glossary Jurisprudential dictionary containing English legal terms, Bengali definitions, and Latin doctrines (mens rea, habeas corpus, etc.). /app/glossary, /components/GlossaryModal.tsx Implemented
Standard Legal Citations One-click modal generating formatted citations in Bluebook, OSCOLA, APA (7th), MLA (9th), and Chicago standards. /components/CitationModal.tsx Implemented
Private In-Browser Bookmarks Client-side bookmark drawer for saving laws and individual sections directly in localStorage without telemetry or accounts. /components/BookmarkDrawer.tsx, /lib/bookmarks.ts Implemented
Source Transparency & Verification Modal displaying government source URLs, gazette references, official volumes, and SHA-256 verification hashes. /components/SourceVerificationModal.tsx Implemented
Voluntary Support & Payment Roadmap Dedicated transparent donation portal featuring operational native cryptocurrency transfers (BTC, ETH, BNB), verified copy/offline QR generator, and non-operational planned roadmaps (Binance Pay, Bank wire country selector, Local mobile payments, Online services). /app/donate, /lib/donation-config.ts Implemented
Print & Export Formatter Clean, print-optimized document view with typographic styling for academic and professional reference. /components/PrintExportModal.tsx, /components/StatutoryPrintDocument.tsx Implemented
Theme & Accessibility Dual theme (Dark/Light mode) with persistent preference detection, keyboard navigation, and responsive mobile layout. /components/ThemeProvider.tsx, /app/globals.css Implemented
Research Workspace In-browser legal research scratchpad for attaching statutory provisions, drafting notes, and compiling references. /app/research Implemented
Subordinate Legislation (SROs) Statutory Regulatory Orders, executive rules, and gazetted ministerial schedules under primary parent Acts. /app/roadmap Planned (Q3–Q4 2026)
Judicial Precedent Indexing Direct cross-linking between statutory sections and reported Supreme Court (DLR, BLC, MLR) precedent summaries. /app/roadmap Planned (2027)

Application Preview & Live Routes

The deployed web application can be accessed at https://nyayota.vercel.app. Major verified routes include:

Route Primary Purpose Live URL
/ Landing page, featured statutes, quick search, and guided legal pathways. nyayota.vercel.app/
/bangladesh-laws Chronological and categorical catalog of Bangladesh Code enactments. nyayota.vercel.app/bangladesh-laws
/international-laws Multilateral conventions, human rights charters, and environmental treaties. nyayota.vercel.app/international-laws
/law/[id] Full statute reader (e.g. /law/bd-penal-code-1860, /law/bd-constitution-1972). nyayota.vercel.app/law/bd-penal-code-1860
/compare Side-by-side statutory and international convention comparison tool. nyayota.vercel.app/compare
/legal-outcome-guide Citizen step-by-step guidance on common legal situations and procedural remedies. nyayota.vercel.app/legal-outcome-guide
/ai-assistant Educational assistant maintenance page (temporarily suspended while conversational grounded models undergo upgrade). nyayota.vercel.app/ai-assistant
/donate Voluntary open-source support page with operational Bitcoin, Ethereum, and BNB options, plus planned payment roadmap. nyayota.vercel.app/donate
/research Private client-side research workspace with notes and citation tools. nyayota.vercel.app/research
/categories Categorical legal taxonomy covering 12 distinct branches of law. nyayota.vercel.app/categories
/glossary Searchable legal terminology and Latin maxims glossary with Bengali translations. nyayota.vercel.app/glossary

Repository Screenshot: The authentic full-resolution desktop screenshot of the live homepage is stored in public/images/nyayota-homepage.png.


Technology Stack

Nyayota is constructed as a modern, type-safe Next.js application adhering to modern React paradigms:

Layer / Domain Technology Version Description & Role
Application Framework Next.js ^15.4.9 App Router architecture, React Server Components (RSC), and API route handling.
UI Library React ^19.2.1 Concurrent rendering, hooks, and component lifecycle management.
Language TypeScript 5.9.3 End-to-end static typing across statutory schemas, API requests, and UI state.
Styling & CSS Tailwind CSS 4.1.11 Utility-first styling utilizing @tailwindcss/postcss and native CSS cascade layers.
Typography Plugin @tailwindcss/typography ^0.5.19 Structured prose formatting for long statutory provisions and legal articles.
Motion & Transitions motion ^12.23.24 Smooth layout transitions, modals, and spring physics via motion/react.
Iconography Lucide React ^0.553.0 Accessible, tree-shakeable SVG icons for navigation and legal status badges.
AI SDK @google/genai ^2.4.0 Official Google Gen AI TypeScript SDK for Gemini API integration (gemini-3.7-flash).
Class Utilities clsx & tailwind-merge ^2.1.1 / ^3.3.1 Conflict-free conditional className concatenation.
Typography Styling tw-animate-css ^1.4.0 Tailwind-compatible CSS animation primitives.
Code Quality & Linter ESLint 9.39.1 Static analysis with eslint-config-next (16.0.8) enforcing clean React conventions.

Architecture & Data Flow

The platform relies on a static-first, highly scalable data architecture. Because statutory codes do not require high-frequency transactional updates, statutory data is stored directly in structured, typed TypeScript modules within the repository. This guarantees fast page loads, zero external database latency, predictable caching, and full offline search capability.

flowchart TD
    subgraph Client["User Browser (Client)"]
        UI["Next.js React 19 Client UI<br/>(Tailwind CSS v4 & Motion)"]
        Storage["Browser localStorage<br/>(Bookmarks, Notes, Theme, History)"]
        ClientSearch["Client-side Search & Filter Engine<br/>(lib/legal-database-engine.ts)"]
        UI <--> Storage
        UI <--> ClientSearch
    end

    subgraph Server["Next.js App Server (Vercel / Node.js)"]
        Routes["Server Components & App Pages<br/>(/app/*)"]
        APIRoute["API Route Handler<br/>(/app/api/ai-assistant/route.ts)"]
        StaticData["Curated Statutory Corpora<br/>(lib/bdcode-data/* & lib/legal-data.ts)"]
        Fallback["Embedded Heuristic Engine<br/>(Offline Legal Knowledge Logic)"]
        
        Routes --> StaticData
        APIRoute --> StaticData
        APIRoute --> Fallback
    end

    subgraph External["External AI Provider"]
        GeminiAPI["Google Gemini API<br/>(gemini-3.7-flash via @google/genai)"]
    end

    UI -->|"Static Page & Search Requests"| Routes
    UI -->|"POST /api/ai-assistant (Query & Context)"| APIRoute
    APIRoute -->|"Secure Server-side Call (GEMINI_API_KEY)"| GeminiAPI
    GeminiAPI -.->|"AI Statutory Analysis"| APIRoute
    Fallback -.->|"Fallback Analysis if Offline or Missing Key"| APIRoute
    APIRoute -->|"JSON Response"| UI

Architectural Key Characteristics

  1. Zero External Database Dependency: No Postgres, MySQL, or MongoDB database is required for core catalog browsing. This eliminates database connection failures, cold starts, and hosting overhead.
  2. Deterministic Statutory Storage: Every enactment has an explicit identity, volume index, enactment date, section hierarchy, and cryptographic SHA-256 hash stored in version-controlled files under /lib/bdcode-data/.
  3. Graceful Degradation: The AI Assistant API route (/api/ai-assistant) checks for GEMINI_API_KEY. If configured, it invokes gemini-3.7-flash with strict legal system instructions. If the key is absent or the external service fails, it automatically falls back to an internal heuristic legal analysis engine without breaking the user experience.
  4. Client-Side Privacy: Research notes, bookmarks, and search queries are stored purely within the user's browser localStorage. No user telemetry or tracking identifiers are collected.
  5. Dual-Track AI Strategy (Production vs. Deterministic Grounding): Production /api/ai-assistant leverages server-side Gemini (gemini-3.7-flash) with sliding-window rate limiting. In parallel, /lib/nyayota-ai/ implements an in-development, 100% deterministic, zero-cost retrieval, intent classification, query routing, and source-grounded response generation engine (Phases 2A, 3 & 4) that operates strictly over indexed primary legislation without third-party LLM hallucination risks.

Quick Start Guide

Follow these steps to run Nyayota locally on your machine.

Prerequisites

  • Node.js: Version 18.18.0 or higher (Node 20.x or 22.x recommended).
  • npm: Version 9.x or higher (or compatible package managers such as pnpm or yarn).
  • Git: Installed on your system.

Installation

  1. Clone the repository:

    git clone https://github.com/afnan0356/nyayota.git
    cd nyayota
    
  2. Install project dependencies:

    npm install
    

Local Development

  1. Configure local environment variables: Copy the example environment configuration:

    cp .env.example .env.local
    

    (Optional) Open .env.local and add your Google Gemini API key if you want to test live AI model responses:

    GEMINI_API_KEY="your-gemini-api-key-here"
    APP_URL="http://localhost:3000"
    

    Note: If you omit GEMINI_API_KEY, Nyayota will run normally and the AI Assistant will use its built-in local legal knowledge fallback engine.

  2. Launch the development server:

    npm run dev
    
  3. Access the application: Open your browser and navigate to:

    http://localhost:3000
    

Production Build

To verify that the application compiles cleanly for production:

# Build the production bundle
npm run build

# Start the production server
npm run start

Environment Variables

Nyayota is architected to keep all credentials securely on the server side. Never prefix secrets with NEXT_PUBLIC_, as this exposes them to client-side JavaScript bundles.

Variable Purpose Required? Example / Default
GEMINI_API_KEY Authenticates server-side calls from /api/ai-assistant to the Google Gemini API (@google/genai). Optional (Falls back to offline heuristic engine if omitted) AIzaSy...
APP_URL Base public canonical URL of the application. Used for metadata and self-referential links. Optional (Defaults to localhost during local dev) https://nyayota.vercel.app

Security Guidelines for Environment Files

  • Keep .env.local in .gitignore (already configured in this repository).
  • Do not commit actual API keys, service account credentials, or secrets into version control.
  • In hosting environments like Vercel, inject GEMINI_API_KEY directly via the project's Environment Variables dashboard.

Repository Directory Structure

nyayota/
├── .env.example                     # Sample template for environment variables
├── .gitignore                       # Git ignore list (node_modules, .env*, .next, .aistudio)
├── CONTRIBUTING.md                  # Contribution standards & statutory curation rules
├── SECURITY.md                      # Security disclosure policy & vulnerability contact
├── eslint.config.mjs                # Modern flat ESLint configuration (ESLint 9)
├── metadata.json                    # Application metadata & platform capabilities
├── next.config.ts                   # Next.js compiler, image, and route configuration
├── package.json                     # Package dependencies, scripts, and engine specs
├── postcss.config.mjs               # PostCSS configuration with @tailwindcss/postcss
├── tsconfig.json                    # TypeScript compiler options and path aliases (@/*)
│
├── app/                             # Next.js App Router (pages and API routes)
│   ├── layout.tsx                   # Root HTML layout, font setup, theme initialization
│   ├── page.tsx                     # Landing page with hero, search, and featured laws
│   ├── globals.css                  # Global styles, Tailwind imports, and typography
│   │
│   ├── about/                       # Platform background, mission, and editorial standards
│   ├── accessibility/               # WCAG compliance statement & accessibility guide
│   ├── ai-assistant/                # Dual-engine assistant (Deterministic + General AI)
│   ├── bangladesh-laws/             # Filterable chronological Bangladesh Code catalog
│   ├── categories/                  # 12 primary legal subject matter category indexes
│   ├── category/[slug]/             # Category-specific filtered law listings
│   ├── compare/                     # Side-by-side comparative statutory analysis engine
│   ├── concepts/                    # Jurisprudential principles, doctrines, and maxims
│   ├── contact/                     # Platform feedback and editorial inquiries
│   ├── disclaimer/                  # Legal terms of use and non-representation disclosure
│   ├── discover/                    # Exploratory thematic statute discovery
│   ├── donate/                      # Non-custodial cryptocurrency donation page
│   ├── glossary/                    # Searchable bilingual legal terms dictionary
│   ├── international-laws/          # Multilateral treaties and UN conventions catalog
│   ├── knowledge-paths/             # Guided legal learning modules
│   ├── law/[id]/                    # Full dynamic statute reader and section viewer
│   ├── legal-outcome-guide/         # Citizen step-by-step procedural outcome guides
│   ├── privacy/                     # Privacy policy (local-storage, zero telemetry)
│   ├── research/                    # Client-side legal research scratchpad workspace
│   ├── roadmap/                     # Public development and milestone roadmap
│   ├── search/                      # Advanced multi-parameter search page
│   ├── terms/                       # Terms of service and informational usage terms
│   │
│   └── api/
│       └── ai-assistant/
│           └── route.ts             # POST handler: Differentiated rate limiting, Gemini Flash + deterministic pipeline
│
├── components/                      # Reusable React UI Components
│   ├── BookmarkDrawer.tsx           # Slide-out drawer for saved client-side bookmarks
│   ├── CitationCard.tsx             # Interactive source cards for verified statutory citations
│   ├── CitationModal.tsx            # Formatter for Bluebook, OSCOLA, APA, MLA, Chicago
│   ├── ClarificationCard.tsx        # Disambiguation selection cards for multi-act sections
│   ├── Footer.tsx                   # Global footer with navigation links & disclaimers
│   ├── GlobalSearch.tsx             # Modal search dialog with keyboard shortcut (Cmd/Ctrl+K)
│   ├── GlossaryModal.tsx            # Quick modal popover for legal terms & Latin maxims
│   ├── Header.tsx                   # Main navigation header with theme toggle & links
│   ├── LegalDefinitionPopover.tsx   # Inline tooltip definition for complex legal jargon
│   ├── MotionPrimitives.tsx         # Motion wrapper components for smooth animations
│   ├── PrintExportModal.tsx         # Document print preview and plain text export modal
│   ├── SourceTransparencyPanel.tsx  # Editorial breakdown of statutory origins & authenticity
│   ├── SourceVerificationModal.tsx  # Gazette details, authentic URLs, and checksums
│   ├── StatutoryHierarchyNav.tsx    # Table of contents navigation for parts/chapters/sections
│   ├── StatutoryPrintDocument.tsx   # Print-specific styled layout for offline documentation
│   └── ThemeProvider.tsx            # Client-side Dark/Light theme state provider
│
├── lib/                             # Core Business Logic, Data Schemas & Catalogs
│   ├── ai-config.ts                 # Centralized Gemini model config, timeouts, and rate limits
│   ├── architecture.ts              # Universal data models for jurisdictions and acts
│   ├── bdcode-architecture.ts       # Bangladesh Code volumes (I–XXXVIII) and legislative eras
│   ├── bdcode-catalog.ts            # Central registry aggregating all Bangladesh laws
│   ├── bdcode-importer.ts           # Statutory ingestion helpers and validation utilities
│   ├── bdcode-search.ts             # Fuzzy and keyword search engine for Bangladesh acts
│   ├── bookmarks.ts                 # LocalStorage persistence helpers for saved sections
│   ├── donation-config.ts           # Verified cryptocurrency wallet addresses and networks
│   ├── international-law-architecture.ts # UN & multilateral treaty schemas
│   ├── international-law-data.ts    # Database of international conventions (UDHR, VCLT, ICCPR)
│   ├── legal-data.ts                # Master enriched statutory records and category mappings
│   ├── legal-database-engine.ts     # Multi-jurisdiction full-text indexing and query engine
│   ├── motion.ts                    # Framer Motion animation variant presets
│   ├── research.ts                  # Research workspace notes persistence in localStorage
│   ├── search-history.ts            # Recent search terms persistence helpers
│   ├── utils.ts                     # Utility functions (cn helper combining clsx + twMerge)
│   │
│   ├── bdcode-data/                 # Modularized Bangladesh Statutory Datasets
│   │   ├── constitutional-criminal.ts   # Constitution, Penal Code, CrPC, Children Act, etc.
│   │   ├── civil-family-property.ts     # CPC, Contract Act, Muslim Family Laws, Property Act
│   │   ├── commercial-banking-tax.ts    # Companies Act, NI Act, Banking, Customs, Tax
│   │   └── environment-admin-local-cyber.ts # Cyber Security, Environment, RTI, Labor Act
│   │
│   └── nyayota-ai/                  # Deterministic Legal Research Engine
│       ├── types.ts                 # Strongly typed intent, routing, and citation types
│       ├── intent-classifier.ts     # 10-category deterministic intent classification
│       ├── query-router.ts          # Safe routing paths & anti-hallucination barriers
│       ├── retrieval-engine.ts      # Exact provision lookup & disambiguation matching
│       ├── response-generator.ts    # Source-grounded legal explanation generator
│       ├── service.ts               # Resilient end-to-end integration boundary
│       └── index.ts                 # Public module barrel export
│
├── tests/                           # Automated Verification & Evaluation Suites (299 tests)
│   ├── nyayota-ai-retrieval.test.ts # Retrieval precision and section matching tests
│   ├── nyayota-ai-router.test.ts    # Intent classification and routing barrier tests
│   ├── nyayota-ai-generator.test.ts # Source-grounded explanation generation tests
│   ├── nyayota-ai-service.test.ts   # Service pipeline integration & timeout tests
│   ├── nyayota-ai-evaluation.test.ts# 50-query golden benchmark evaluation suite
│   ├── nyayota-ai-phase5b.test.ts   # Mode routing & deterministic execution tests
│   ├── nyayota-ai-phase5c.test.ts   # Edge security, donation safety & QA tests
│   ├── nyayota-phase5e.test.ts      # Public assistant 503 suspension tests
│   ├── nyayota-phase5f.test.ts      # Hierarchical donation architecture tests
│   ├── nyayota-ai-conversation-phase6a.test.ts # Conversational turns & memory tests
│   ├── nyayota-ai-conversation-phase6b.test.ts # Conversation history validation tests
│   ├── nyayota-ai-conversation-phase6c.test.ts # Grounded generation & injection tests
│   ├── nyayota-ai-streaming-phase8.test.ts     # Streaming SSE response architecture tests
│   └── nyayota-security-remediation.test.ts    # Repository trust, IP & security audit tests
│
└── public/                          # Static assets and repository media
    └── images/
        ├── nyayota-homepage.png     # Authentic desktop screenshot of the Nyayota homepage
        └── nyayota-homepage.jpg     # Source capture reference

Legal Content, Integrity & Verification

Because legal information directly impacts citizens' rights, procedures, and understanding of the law, Nyayota enforces strict documentation, transparency, and architectural distinctions between computational integrity and legal authenticity.

Primary Sources & Statutory Grounding

All statutory records included in Nyayota are grounded in authentic primary sources published by competent legislative bodies:

  1. Bangladesh Code & Legislation:
  2. International Conventions & Multilateral Treaties:
    • Primary Depositary: Office of Legal Affairs, United Nations (United Nations Treaty Collection — UNTS).
    • Treaty Series Reference: Certified depositary texts published in the United Nations Treaty Series (U.N.T.S.).

Data Ingestion Tracking vs. Statutory Legal Authenticity

To maintain complete transparency regarding our curation and verification processes:

Verification Layer Nature & Mechanism What It Proves What It Does NOT Prove
integrityStatus Curation status (source-linked, reviewed, unverified, independently-verified). Source Transparency: Verifies that the record is anchored to an official government repository URL (bdlaws.minlaw.gov.bd or bdcode.gov.bd). Does NOT prove court certification. Only official printed gazettes published by BG Press carry evidentiary authority in court proceedings.
lastVerifiedDate ISO timestamp recording maintainer review against the government portal. Editorial Recency: Confirms when maintainers last cross-referenced the record against bdlaws.minlaw.gov.bd. Does NOT guarantee real-time reflection of newly passed emergency ordinances or ungazetted amendments.
officialGazetteCitation Formal legislative enactment citation (e.g. Act XLV of 1860). Historical Pedigree: Identifies the formal parent Act and historical volume in The Bangladesh Code. Must be read in conjunction with subsequent amending Acts listed in lastAmendmentAct.

Curated Educational Corpus vs. Complete Statute Books

Nyayota is designed as a curated educational research platform, not an exhaustive replacement for the full archival government statute books:

  • High-impact statutes (such as the Penal Code 1860, Code of Criminal Procedure 1898, Code of Civil Procedure 1908, Contract Act 1872, and Constitution of Bangladesh 1972) are indexed with their foundational, frequently cited sections, landmark doctrines, and procedural workflows.
  • Nyayota does not claim 100% complete digital transcription of every procedural subsection or repealed schedule.
  • When a user queries a valid statute for a section that is not yet digitized in Nyayota's curated subset, the deterministic engine explicitly clarifies that the section is outside the curated database and provides an authenticated direct link to the full official statute on bdlaws.minlaw.gov.bd.

Editorial Boundaries & Content Layers

Nyayota strictly separates authoritative law from educational commentary:

[Authentic Primary Source Text] ──> Exact statutory language enacted by the legislature
             │
             ├──> [Official Translation]  ──> Official Gazette Bengali/English versions
             │
             ├──> [Editorial Summaries]   ──> Curated plain-language breakdowns ("Explain like I'm 15")
             │
             └──> [AI Explanations]       ──> Machine-generated educational explanations
  • Official Statutory Text: Exact verbatim transcriptions of codified sections, preserving section numbers, statutory headings, and original provisions.
  • Plain-Language Explanations: Non-authoritative educational paraphrasing clearly delineated from official statutory text.
  • Translations: Official Bengali titles (দণ্ডবিধি, ফৌজদারি কার্যবিধি) and provisions are drawn directly from official government gazettes or Ministry of Law publications.

Privacy, Security & Responsible AI

Zero Telemetry & Client-Side Privacy

  • No Remote User Database: Nyayota does not operate a user database or store user profiles.
  • Local Storage: Research notes, bookmarks, dark/light theme preferences, and search queries reside exclusively within the user's browser window.localStorage.
  • Zero Third-Party Ad Trackers: The platform does not incorporate commercial tracking beacons or behavioral advertising scripts.

Centralized AI Configuration & Model Architecture

All external AI integrations are centralized within lib/ai-config.ts:

  • Configured Model: Default model is set to gemini-3.8-flash via @google/genai (standard Google GenAI model in AI Studio runtime), with support for runtime override via the GEMINI_MODEL environment variable.
  • Execution Separation:
    1. Source-Grounded Legal Research Mode: Powered entirely by Nyayota's deterministic TypeScript retrieval pipeline (lib/nyayota-ai/). Executes with zero external API calls, zero token consumption, deterministic citations, and anti-hallucination barriers.
    2. General AI Assistant Mode: Powered by Google Gemini via server-side @google/genai SDK for conceptual legal explanations and comparative inquiries.

Distributed Rate Limiting & Abuse Protection (Phase 2)

The assistant API route (app/api/ai-assistant/route.ts) and security subsystem (lib/rate-limiter.ts, lib/security-validation.ts, lib/request-body-reader.ts) implement multi-layered defensive safeguards:

  • Strict Content-Type Check: Rejects non-JSON payloads with HTTP 415.
  • Stream-Level Byte Bounds (32 KB Cap): Reads incoming stream chunks via req.body.getReader(), aborting transmission immediately if total payload exceeds 32 KB (32,768 bytes) with HTTP 413.
  • Strict Input Validation: Rejects unsupported modes, languages, engines, or client-injected system roles with HTTP 400.
  • CSRF & Origin Protection: Rejects unauthorized cross-origin POST requests or cross-site fetch requests with HTTP 403.
  • Leak-Proof Public Response: Strictly returns text, engine, status, safe sources, disclaimer, timestamp, and clarification prompts. Internal retrieval structures, pipeline results, raw model outputs, tokens, and debug details are completely stripped.
  • Upstream Cancellation: Connects client AbortSignal with AbortController and a 12-second timeout to terminate upstream Google GenAI API calls upon timeout or client disconnect.
  • Distributed Sliding-Window Rate Limiter:
    • General AI Mode: 15 requests per 60 seconds per IP (Ratelimit.slidingWindow(15, "60 s")).
    • Deterministic Legal Mode: 30 requests per 60 seconds per IP (Ratelimit.slidingWindow(30, "60 s")).
    • Distributed Multi-Region Deployment: Implements @upstash/ratelimit with @upstash/redis via UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
    • Honest Architecture Status: When Upstash credentials are unconfigured, process-local in-memory rate limiting is isolated for development/test only and is never misrepresented as distributed in production.
    • Trusted IP Extraction: Prioritizes platform-authenticated x-vercel-forwarded-for on Vercel to block client IP spoofing, with strict IPv4 octet validation, IPv6 parsing, and port stripping.
  • Security Policy: For vulnerability reporting, see our SECURITY.md (contact: [email protected]).

Development Commands & Scripts

The following scripts are defined in package.json and verified to execute in this codebase:

Command Action Runtime Environment
npm run dev Starts the Next.js local development server on port 3000 (next dev -p 3000). Development
npm run build Compiles the TypeScript application and produces the optimized .next production bundle. Production / CI
npm run start Boots the compiled Next.js production server. Production
npm run lint Runs ESLint (eslint .) across all .ts, .tsx, and .mjs source files. Development / CI
npm run clean Cleans cached build artifacts via next clean. Utility

Development Roadmap

The development priorities below reflect the ongoing enhancement of Nyayota:

Phase / Milestone Objective Target Scope Status
Milestone 1 Core Statutory Library Complete section-level digitization of high-impact statutes (Penal Code, CrPC, Constitution, Cyber Security, Labour Act, UDHR, VCLT). Completed
Milestone 2 Research & Comparison Tools Side-by-side statute comparison, Bluebook/OSCOLA citation export, and client-side research workspace. Completed
Milestone 3 Expanded Bangladesh Code (Vols I–XXXVIII) Progressive ingestion of civil, commercial, banking, property, and environmental acts. Active / In Progress
Milestone 4 Subordinate Legislation (SROs) Ingestion of statutory rules, government notifications, and schedules framed under parent Acts. Planned (Q3–Q4 2026)
Milestone 5 Offline PWA Capabilities Service worker caching to enable full-text offline reading of entire statutory codifications in low-connectivity areas. Planned (Q1 2027)
Milestone 6 Judicial Precedents & Case Citations Cross-referencing landmark Supreme Court of Bangladesh judgments with specific statutory sections. Planned (2027)

Deployment & Hosting

Nyayota is optimized for cloud deployment on platforms that support modern Next.js App Router applications:

  • Production Deployment: Vercel
  • Live URL: https://nyayota.vercel.app
  • Hosting Tier Requirements: Node.js 18+ or 20+ runtime with support for dynamic API routes.
  • Continuous Deployment: Pushes to the main branch of afnan0356/nyayota trigger automated production builds.

To deploy your own fork to Vercel:

  1. Import the repository into your Vercel dashboard.
  2. In the Project Settings under Environment Variables, optionally add:
    • GEMINI_API_KEY: Your Google Gen AI API key.
    • APP_URL: Your custom domain (e.g. https://your-domain.com).
  3. Deploy. The default build command (npm run build) and output directory will be automatically configured.

Voluntary Support & Cryptocurrency Donations

Nyayota is an independent civic and educational legal research initiative. Voluntary contributions directly fund cloud server infrastructure, automated test suites, and continuous verification of codified legal records.

Donations can be sent via peer-to-peer cryptocurrency transfers directly on the dedicated donation page at /donate:

Network Supported Assets & Standard Verified Maintainer Wallet Address
Bitcoin Mainnet BTC (Native SegWit / Bech32) bc1qczt3r9yhwezgdnvdcl39d093u8ehtt37l44mj5
Ethereum Mainnet ETH, USDT, USDC, DAI (ERC-20) 0xD14b56A067Bd9B016415d32Ecc49dd846A06F91E
BNB Smart Chain BNB, USDT, USDC (BEP-20) 0xD14b56A067Bd9B016415d32Ecc49dd846A06F91E

Transparency & Non-Custodial Safety Reminders:

  • Voluntary Support: Nyayota is not a registered charity or 501(c)(3) entity under any jurisdiction. Voluntary contributions are non-refundable gifts and are not tax-deductible.
  • Maintainer Verification: Wallet addresses are maintainer-supplied configurations for direct blockchain transfers. Nyayota does not store personal financial data, track wallet identities, or use third-party payment processing intermediaries.
  • Security Notice: Nyayota will never ask for your seed phrase, private keys, or wallet passwords. Never connect your wallet to untrusted websites.

Contributing

Contributions to Nyayota are welcomed, particularly in verifying statutory accuracy, expanding codified sections, improving accessibility, and adding bilingual translations.

For full contribution standards, data verification criteria, and environment rules, see our dedicated CONTRIBUTING.md guide.

Quick Contribution Steps

  1. Fork the Repository: Create a fork on GitHub at https://github.com/afnan0356/nyayota.
  2. Create a Feature Branch:
    git checkout -b feature/amend-statute-data
    
  3. Adhere to Data Standards:
    • Always verify statutory text against the official Laws of Bangladesh or gazette records.
    • Include authentic volume references, act numbers, and enactment dates.
    • Maintain accurate bilingual titles (title in English, titleBn in Bengali).
    • Do not commit copyrighted commentary or proprietary legal textbook text.
  4. Validate Your Changes: Run the test suite, linter, and production build before submitting:
    bun test        # 299 automated tests across 13 suites
    npm run lint    # ESLint flat config
    npm run typecheck # TypeScript compiler strict verification
    npm run build   # Next.js production compilation
    
  5. Submit a Pull Request: Provide a descriptive pull request title detailing the exact statutes or components modified, along with primary source links.
  6. Security Reports: For security concerns or vulnerability disclosures, follow the instructions in SECURITY.md rather than opening public GitHub issues.

License & Intellectual Property

Nyayota maintains a strict boundary between software code and curated legal datasets:

  • Platform Source Code (MIT License): All software source code, components, layout logic, algorithms, and styling in this repository are open source and licensed under the MIT License. Copyright © 2026 Md. Afnan.
  • Curated Legal Content & Dataset Rights Register: Curated annotations, plain-language legal syntheses ("Explain Like I'm 15"), procedural guides, and bilingual cross-references are editorial works governed by the CONTENT-LICENSE.md.
  • Primary Statutory Texts: Enacted statutory legislation and international treaties are official public instruments reproduced under educational fair dealing exceptions (Section 24 & 72 of the Bangladesh Copyright Act, 2000).
  • Brand Protection & Trademark Policy: "Nyayota", "Nyayota AI", and platform logos are trademarks of Md. Afnan. See docs/LEGAL_AND_BRAND_PROTECTION_AUDIT.md and docs/TRADEMARKS_AND_THIRD_PARTY_ASSETS.md.

Legal Disclaimer

IMPORTANT NOTICE:
Nyayota is an independent educational and research platform, not a law firm or a government agency.

  1. No Legal Advice: The materials, statutory texts, plain-language summaries, comparative analyses, and AI-generated outputs available on Nyayota are provided solely for general educational, academic, and informational purposes. They do not constitute formal legal advice, legal opinions, or professional legal representation.
  2. No Attorney-Client Relationship: Using this website, browsing its statutory catalogs, or interacting with the AI Assistant does not create an attorney-client relationship between you and Nyayota or any of its contributors.
  3. Need for Independent Verification: While every effort is made to maintain statutory fidelity and record authentic gazette references, laws are subject to legislative amendment, judicial reinterpretation, administrative notifications, and gazette repeals. Readers must cross-verify provisions against the official Bangladesh Gazette, the authoritative Ministry of Law portals, or certified depositary copies.
  4. AI Output Limitations: AI-assisted explanations are generated via automated machine learning models (@google/genai). They may contain simplifications, omissions, or contextual inaccuracies and should never be relied upon for active court proceedings, contractual commitments, or strategic litigation decisions.
  5. Consult Qualified Counsel: If you are facing an active legal dispute, criminal prosecution, civil litigation, or require formal legal counsel, you must consult a licensed advocate enrolled with the Bar Council or contact the National Legal Aid Services Organization (helpline 16430 in Bangladesh).

Ähnliche Projekte entdecken

Wird geladen…