+
Skip to content

LegalHub( GSSoC25) is a comprehensive platform designed to simplify legal concepts, provide essential legal documents, and educate users about their rights.

License

Notifications You must be signed in to change notification settings

dipexplorer/LegalHuB

LegalHuB Logo
LegalHuB

This project is now OFFICIALLY accepted for:

GSSOC

📊 Project Insights

🌟 Stars 🍴 Forks 🐛 Issues 🔔 Open PRs 🔕 Closed PRs 🛠️ Languages 👥 Contributors
Stars Forks Issues Open PRs Closed PRs Languages Count Contributors Count

📚 LegalHuB

LegalHuB is a web-based platform designed to simplify access to legal resources. Users can explore legal terms, download state-specific legal documents, understand their rights, read comprehensive legal guides, and apply for legal services through official links — all in one place.


🚀 Features

  • Legal Dictionary – AI-powered explanations of complex legal terms.
  • Download Legal Forms – Access and download state-specific legal documents.
  • Apply for Legal Services – Redirects to official legal application portals.
  • Legal Rights Database – Browse essential civil, fundamental, and employment rights.
  • Legal Articles & Guides – Learn from structured and easy-to-read legal content.
  • Smart Search – Search across legal terms, rights, and documents efficiently.

📸 Screenshots

🏠 Homepage

Homepage


Link

Link


Link


Link


Link


Link


Link


Link


Link


Link


🛠️ Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB (Free Tier or Atlas)
  • AI Integration: Chatbase (for AI chatbot responses)
  • Templating Engine: EJS
  • Authentication: Passport.js

⚙️ Installation

📌 Prerequisites

📥 Setup Instructions

1. Clone the repository

   git clone https://github.com/yourusername/LegalHuB

   cd LegalHuB

2. Install dependencies

   npm install

3. Set up environment variables

  • Create a .env file in the root directory and add the following:

🧑‍💻 Environment Setup

  1. Copy the example environment file:

   cp .env.sample .env

  1. Update the .env file with your configuration:

   # Server Configuration
   PORT=8000
   SESSION_SECRET=mysecrectkey

   # CORS Configuration
   CORS_ORIGIN=*
   # CORS_ORIGIN=http://localhost:4000

   #DB_URL=
   DB_URL=mongodb+srv://<username>:<password>@cluster0.weuhr.mongodb.net
   # Uncomment if needed for frontend security

   DB_URL=

   NODE_ENV=development

   MISTRAL_API_KEY=

   ADMIN_SECRECT_KEY=mysupersecretkey

🔐 Mistral AI API Integration

⚙️ Setting Up Mistral API Key

To enable Mistral AI-powered features in LegalHuB, follow the steps below:

  1. Go to the Mistral AI Platform and create an account (if you haven't already).

  2. Navigate to API Keys and generate a new key.

  3. Add the following entry to your .env file:

    MISTRAL_API_KEY=your_mistral_api_key_here

  1. Start the server
   npm start or npm run dev

The server will run on http://localhost:8000


🤝 How to Contribute

We welcome contributions to help improve LegalHuB! 🚀 Whether you're fixing bugs, improving documentation, or building new features — your support makes a difference.


🍴 Fork the Repository

  1. Navigate to the LegalHuB GitHub repository.
  2. Click the Fork button in the top-right corner to create a personal copy of the repository.

🔄 Clone Your Forked Repository

  1. Clone the repository to your local machine:
   git clone https://github.com/your-username/LegalHuB.git
  1. Navigate to the project directory:
   cd LegalHuB
  1. 🌿 Create a New Branch
    • Create a new branch for your changes:
   git checkout -b feature/your-feature-name
  1. Make Your Changes✏️

    • Add your desired features, fix bugs, or improve documentation. 🛠️
  2. 📦 Stage the Changes

    • Add modified files to the staging area:
   git add .
  1. 📝 Commit Your Changes
    • Commit your changes with a clear, descriptive message:
   git commit -m "Add [feature/fix]: short description of what you changed"
  1. ⬆️ Push to Your Fork
    • Push the changes to your forked GitHub repository:
   git push origin feature/your-feature-name
  1. 📬 Create a Pull Request
    • Visit your forked repository on GitHub.

    • Click on "Compare & pull request".

    • Add a title and description of your changes.

    • Submit the pull request for review.


💡 Tips for a Great Contribution

  • Follow consistent code style.

  • Write descriptive commit messages.

  • Make sure the project builds without errors.

  • Reference any related issue numbers (e.g., Fixes #123).


📂 Project Structure

LegalHuB/
├── .github/                             # GitHub configuration files and workflows
│   ├── ISSUE_TEMPLATE/                  # Templates for issue creation
│   ├── workflows/                       # GitHub Actions workflows (CI/CD automation)
│   ├── labeler.yml                      # Automatically assign labels to PRs/issues
│   └── PULL_REQUEST_TEMPLATE.md         # Standard pull request template
│
├── __tests__/                           # Automated test files for all major modules
│   ├── appointment.test.js              # Unit tests for appointment module
│   ├── article.test.js                  # Tests for article-related APIs
│   ├── chat.test.js                     # Tests for chat functionality
│   ├── dictionary.test.js               # Tests for dictionary search endpoints
│   ├── document.test.js                 # Tests for document handling
│   ├── healthCheck.test.js              # Tests for server health check route
│   ├── lawyer.test.js                   # Tests for lawyer routes and models
│   ├── review.test.js                   # Tests for review system
│   ├── rights.test.js                   # Tests for legal rights endpoints
│   ├── search.test.js                   # Tests for search module
│   └── user.test.js                     # Tests for user authentication and profiles
│
├── init/                                # Initialization scripts
│   ├── documents.data.js                # Seed data for legal documents
│   ├── index.documents.js               # Document initialization logic
│   ├── index.rights.js                  # Rights initialization logic
│   └── rights.data.js                   # Seed data for legal rights
│
├── src/                                 # Main source code directory
│   ├── config/                          # Environment and configuration files
│   ├── controllers/                     # Business logic and route handlers
│   ├── db/                              # Database connection and setup
│   ├── middlewares/                     # Express middlewares (auth, validation, logging)
│   ├── models/                          # Mongoose / Sequelize models for data structure
│   ├── public/                          # Public assets (images, static files)
│   ├── routes/                          # API routes definitions
│   ├── services/                        # Service layer for business logic and API calls
│   ├── utils/                           # Utility/helper functions
│   ├── validators/                      # Request validation schemas
│   └── views/                           # View templates (if using server-side rendering)
│
├── test/                                # Global test setup and utility functions
│   ├── globalSetup.js                   # Jest global setup
│   ├── globalTeardown.js                # Jest global teardown
│   ├── jest.setup.js                    # Jest environment configuration
│   └── testHelpers.js                   # Common helper functions for tests
│
├── app.js                               # Express app configuration and middleware setup
├── constants.js                         # Global constants used throughout the project
├── index.js                             # Main entry point — starts the server
├── setUpAdmin.js                        # Script to initialize admin users
├── socket.js                            # Socket.io configuration for real-time communication
│
├── .env.sample                          # Example environment variable configuration
├── .eslintignore                        # Files and folders ignored by ESLint
├── .eslintrc.js                         # ESLint configuration for code linting
├── .gitignore                           # Files ignored by Git
├── .prettierignore                      # Files ignored by Prettier
├── .prettierrc                          # Prettier configuration for code formatting
│
├── CODE_OF_CONDUCT.md                   # Contributor behavior guidelines
├── CONTRIBUTING.md                      # Instructions for contributing to the project
├── LEARN.md                             # Learning resources or setup guide for contributors
├── LICENSE                              # Open-source license for the project
└── readme.md                            # Main project documentation

🌐 API Endpoints

📘 Legal Dictionary

  • GET /api/dictionary/:term
    Returns an AI-generated explanation for a legal term.

📄 Legal Forms & Documents

  • GET /api/forms
    Retrieve all available legal forms.

  • GET /api/forms/:id
    Get a specific form by its ID.

  • GET /api/forms/download/:id
    Download a specific legal form.


🧾 Legal Rights

  • GET /api/rights
    Fetch all legal rights from the database.

  • GET /api/rights/:id
    Retrieve a specific legal right by ID.


🔍 Smart Search

  • GET /api/search?q=your_query
    Searches across legal dictionary, rights, and forms.

🔁 Example Response

{
    "dictionary_results": ["Tenant Rights - Explanation"],
    "rights_results": ["Right to Safe Housing"],
    "form_results": ["Rental Agreement Form"]
}

🔍 Smart Search Logic

The Smart Search feature performs a unified query across:

  • Legal terms in the dictionary database
  • User rights stored in MongoDB
  • Legal forms and their descriptions

The results are ranked and returned in a categorized format to ensure relevance and clarity.


🎨 UI Pages

  • Home (/) – Introductory landing page with navigation
  • Legal Dictionary (/dictionary) – Look up legal terms
  • Legal Forms (/forms) – Download or view forms by category
  • Legal Rights (/rights) – Explore civil and employment rights

📄 License

This project is licensed under the MIT License.


🤝 Contributing

Pull requests are welcome! For significant changes, please open an issue first to discuss your proposed modifications.


Contributor

A heartfelt thank you to all the contributors who have dedicated their time and effort to make this project a success.
Your contributions—whether it’s code, design, testing, or documentation—are truly appreciated! 🚀

Thanks to all the wonderful contributors 💖

See full list of contribution from contributor Contributor Graph


📬 Contact

For support, collaboration, or legal partnerships, please contact:
📧 legalhub.help@gmail.com


LegalHuB – Empowering users with accessible legal information.

About

LegalHub( GSSoC25) is a comprehensive platform designed to simplify legal concepts, provide essential legal documents, and educate users about their rights.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 29

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载