This project is now OFFICIALLY accepted for:
📊 Project Insights
🌟 Stars | 🍴 Forks | 🐛 Issues | 🔔 Open PRs | 🔕 Closed PRs | 🛠️ Languages | 👥 Contributors |
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/
├── .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
- 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.
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! 🚀
See full list of contribution from contributor Contributor Graph
For support, collaboration, or legal partnerships, please contact:
📧 legalhub.help@gmail.com
LegalHuB – Empowering users with accessible legal information.