Skip to content

Repository files navigation

⚖️ Know Your Rights (KYR)

Empowering citizens with instant, intelligent legal assistance — anytime, anywhere.

License: MIT GitHub Repo


A mobile-first legal awareness platform that empowers citizens with accessible legal information, AI-assisted guidance, document automation, incident documentation, and community support.

React Native Expo Node.js Express MongoDB OpenAI Gemini


📖 Overview

Know Your Rights (KYR) is a mobile application designed to bridge the gap between citizens and legal services by making legal information understandable, accessible, and actionable.

Instead of navigating complex legal procedures or searching through lengthy regulations, users can:

  • 💬 Ask legal questions through an AI-powered assistant
  • 📄 Generate commonly used legal documents
  • 📚 Learn about fundamental legal rights
  • 📝 Maintain a secure incident diary with images
  • 🤝 Participate in legal discussion forums
  • ☎️ Access emergency and legal aid contacts

The project combines modern mobile development with AI-powered assistance to create an educational LegalTech platform suitable as an MVP for legal awareness.


✨ Features

🔐 Authentication

  • User Registration
  • Secure Login
  • JWT Authentication
  • Password Hashing using bcrypt
  • Profile Management
  • Change Password

🤖 AI Legal Assistant

Users can interact with an AI chatbot for:

  • Basic legal guidance
  • Rights awareness
  • Legal procedure explanations
  • Everyday legal questions

Powered by

  • OpenAI API

📄 Smart Document Assistant

Generate and analyze legal documents.

Features include:

  • Document Templates
  • Dynamic Form Filling
  • PDF Upload
  • AI Document Summarization
  • AI Insights
  • Document Preview
  • PDF Generation
  • Local Saving
  • Sharing Documents

Powered by

  • Google Gemini
  • pdf-parse

📚 Legal Rights Library

Provides simplified explanations of important legal rights including:

  • Constitutional Rights
  • Women's Rights
  • Consumer Rights
  • Cyber Crime Awareness
  • Emergency Information

📝 Incident Diary

Maintain detailed records of incidents.

Supports:

  • Incident Details
  • Images
  • Witness Information
  • Officer Information
  • Timeline
  • Local Storage
  • Incident History

💬 Community Forum

A simple legal discussion platform where users can:

  • Browse channels
  • Read discussions
  • Post messages
  • Participate in community conversations

☎️ Emergency Contacts

Quick access to:

  • Police
  • Women's Helpline
  • Cyber Crime
  • Ambulance
  • Legal Aid Services

🎨 User Experience

  • Dark Mode
  • Modern UI
  • Responsive Layout
  • Expo Router Navigation
  • Mobile-first Design

🏗️ System Architecture

                 React Native (Expo)
                         │
                         │
               HTTP / JSON / FormData
                         │
                         ▼
                Express.js Backend
        ┌───────────┬────────────┬─────────────┐
        │           │            │             │
        ▼           ▼            ▼             ▼
 Authentication   AI Chat    SmartDoc      Incident API
        │           │            │             │
        │           ▼            ▼             ▼
        │       OpenAI API    Gemini API   JSON Storage
        │
        ▼
     MongoDB

🛠 Tech Stack

Frontend

  • React Native
  • Expo
  • Expo Router
  • React
  • Axios
  • AsyncStorage
  • Expo File System
  • Expo Print
  • Expo Sharing
  • Expo Document Picker
  • Expo Image Picker
  • Expo Location
  • Expo Linear Gradient
  • Expo Vector Icons

Backend

  • Node.js
  • Express.js
  • Mongoose
  • JWT
  • bcrypt
  • Multer
  • pdf-parse
  • dotenv
  • CORS

Database

  • MongoDB
  • JSON File Storage (Incident Diary)

AI Integration

  • OpenAI
  • Google Gemini

📂 Project Structure

Know-Your-Rights
│
├── app/
│   ├── onboarding/
│   ├── user/
│   ├── admin/
│   ├── login.js
│   ├── register.js
│   └── index.js
│
├── components/
│
├── context/
│
├── constants/
│
├── backend/
│   ├── config/
│   ├── controllers/
│   ├── middleware/
│   ├── models/
│   ├── routes/
│   ├── data/
│   └── server.js
│
├── package.json
└── README.md

🚀 Getting Started

1. Clone the repository

git clone https://github.com/yourusername/Know-Your-Rights.git

cd Know-Your-Rights

2. Install frontend dependencies

npm install

3. Install backend dependencies

cd backend

npm install

4. Configure Environment Variables

Create a .env file inside the backend directory.

PORT=5000

MONGO_URI=your_mongodb_connection

JWT_SECRET=your_secret

OPENAI_API_KEY=your_openai_key

GEMINI_API_KEY=your_gemini_key

5. Start Backend

cd backend

npm start

or

npm run dev

6. Start Frontend

npm start

or

npx expo start

🔌 API Overview

Authentication

Method Endpoint Description
POST /api/auth/register Register User
POST /api/auth/login Login
GET /api/auth/profile User Profile
POST /api/auth/change-password Update Password

AI Chat

Method Endpoint
POST /api/chat/ask

Smart Documents

Method Endpoint
POST /api/smartdoc/upload
POST /api/smartdoc/analyze
POST /api/smartdoc/insights

Documents

Method Endpoint
GET /api/documents/templates
POST /api/documents/generate
POST /api/documents/save
GET /api/documents/saved

Incident Diary

Method Endpoint
POST /api/incident-diary
GET /api/incident-diary
GET /api/incident-diary/:id
DELETE /api/incident-diary/:id

Community Forum

Method Endpoint
GET /api/forum/channels
GET /api/forum/messages/:channelId
POST /api/forum/messages/:channelId

🧠 AI Features

Legal Chatbot

  • Context-aware legal assistance
  • Prompt-driven responses
  • OpenAI Integration

SmartDoc

  • PDF Parsing
  • AI Summarization
  • Document Insights
  • Language Detection
  • Document Type Detection

🔒 Security

Current implementation includes:

  • JWT Authentication
  • Password Hashing
  • Protected Routes
  • Role-based User Support
  • Environment Variables

⚠️ Current Limitations

This project is currently an MVP (Minimum Viable Product).

Current limitations include:

  • Some features rely on mock data.
  • Incident diary uses JSON storage instead of full database persistence.
  • Help Near Me is a placeholder.
  • Admin functionality is minimal.
  • AI responses are prompt-based and not backed by a Retrieval-Augmented Generation (RAG) pipeline.
  • Security hardening (rate limiting, input sanitization, production CORS configuration, etc.) is not yet implemented.

🚀 Future Improvements

  • AI-powered Retrieval-Augmented Generation (RAG)
  • Curated Legal Knowledge Base
  • Persistent Cloud Storage
  • Real-time Community Moderation
  • Location-based Legal Services
  • End-to-End Testing
  • Advanced Search & Filtering
  • Push Notifications
  • Admin Management Portal
  • Production-grade Security Enhancements

📚 Learning Outcomes

This project demonstrates practical experience with:

  • Cross-platform Mobile Development
  • REST API Design
  • JWT Authentication
  • MongoDB Integration
  • AI API Integration
  • PDF Processing
  • File Upload Handling
  • State Management
  • Mobile UI/UX Design
  • LegalTech Application Development

🤝 Contributing

Contributions, suggestions, and feature requests are welcome.

If you find a bug or have an enhancement idea, feel free to open an issue or submit a pull request.


⭐ If you found this project useful, consider giving it a star!

🛠️ Project Status

🚧 This project is under active development.
We’re continuously adding smarter AI tools, regional law support, and accessibility features for all types of users — including specially abled individuals.


📄 License

This project is licensed — see the LICENSE file for details.


“Justice is not just for the few who can afford it — it's a right we all deserve to understand.”

About

AI-powered legal rights platform with smart tools, document automation, and community support.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages