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.
- β 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.
- Backend: Node.js, Express.js
- Database: MongoDB (Free Tier or Atlas)
- AI Integration: Chatbase (for AI chatbot responses)
- Templating Engine: EJS
- Authentication: Passport.js
- Node.js
- MongoDB (local or MongoDB Atlas)
.env
file with necessary API keys
git clone https://github.com/yourusername/LegalHuB
cd LegalHuB
npm install
- Create a .env file in the root directory and add the following:
- Copy the example environment file:
cp .env.sample .env
- 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
To enable Mistral AI-powered features in LegalHuB, follow the steps below:
-
Go to the Mistral AI Platform and create an account (if you haven't already).
-
Navigate to API Keys and generate a new key.
-
Add the following entry to your
.env
file:MISTRAL_API_KEY=your_mistral_api_key_here
- Start the server
npm start or npm run dev
The server will run on http://localhost:8000
We welcome contributions to help improve LegalHuB! π Whether you're fixing bugs, improving documentation, or building new features β your support makes a difference.
- Navigate to the LegalHuB GitHub repository.
- Click the Fork button in the top-right corner to create a personal copy of the repository.
- Clone the repository to your local machine:
git clone https://github.com/your-username/LegalHuB.git
- Navigate to the project directory:
cd LegalHuB
- πΏ Create a New Branch
- Create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Make Your ChangesβοΈ
- Add your desired features, fix bugs, or improve documentation. π οΈ
-
π¦ Stage the Changes
- Add modified files to the staging area:
git add .
- π Commit Your Changes
- Commit your changes with a clear, descriptive message:
git commit -m "Add [feature/fix]: short description of what you changed"
- β¬οΈ Push to Your Fork
- Push the changes to your forked GitHub repository:
git push origin feature/your-feature-name
- π¬ 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.
-
-
Follow consistent code style.
-
Write descriptive commit messages.
-
Make sure the project builds without errors.
-
Reference any related issue numbers (e.g., Fixes #123).
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
- GET
/api/dictionary/:term
Returns an AI-generated explanation for a legal term.
-
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.
-
GET
/api/rights
Fetch all legal rights from the database. -
GET
/api/rights/:id
Retrieve a specific legal right by ID.
- GET
/api/search?q=your_query
Searches across legal dictionary, rights, and forms.
{
"dictionary_results": ["Tenant Rights - Explanation"],
"rights_results": ["Right to Safe Housing"],
"form_results": ["Rental Agreement Form"]
}
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.
- 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
This project is licensed under the MIT License.
Pull requests are welcome! For significant changes, please open an issue first to discuss your proposed modifications.
For support, collaboration, or legal partnerships, please contact:
π§ [email protected]
LegalHuB β Empowering users with accessible legal information.