Skip to content

blkhkr2003-png/LegalHuB

 
 

Repository files navigation

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/
├── init/                   # Seed scripts for rights & documents
│   ├── documents.data.js
│   ├── index.documents.js
│   ├── index.rights.js
│   └── rights.data.js
│
├── src/                    # Main application source
│   ├── controllers/        # Business logic for each route
│   ├── db/                 # MongoDB database connection
│   ├── middlewares/        # Auth, error, upload middleware
│   ├── models/             # Mongoose schemas
│   ├── public/             # Static files (CSS, JS, images)
│   ├── routes/             # Express.js route definitions
│   ├── uploads/            # Uploaded files (PDFs etc.)
│   ├── utils/              # Helpers: error handling, responses, Cloudinary
│   ├── views/              # EJS templates (includes, layouts, pages)
│   ├── app.js              # Express app config
│   ├── constants.js        # Global constants
│   ├── index.js            # Server entry point
│   └── readme.md           # Dev-specific readme
│
├── .env.sample             # Example environment config
├── .gitignore              # Git ignored files
├── .prettierrc             # Prettier config
├── .prettierignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── package.json
├── package-lock.json
└── README.md               # Project overview and setup

🌐 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.


📬 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.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • EJS 56.4%
  • JavaScript 38.4%
  • CSS 5.2%