Skip to content

LegalHub 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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š 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


πŸ“˜ Legal Dictionary

Legal Dictionary


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:
πŸ“§ [email protected]


LegalHuB – Empowering users with accessible legal information.

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published