Skip to main content

Getting Started

Welcome to the getting started for Law Knowledge project!

If you are new to the project, this is the place to start. Here you will find the information you need to get up and running with the project quickly. You will also find information about the project's architecture, the technologies used, and the tools that are available to help you develop your application.

If you have any questions, please feel free to ask in the Telegram. Our Telegram channel is a place where you can ask questions, share ideas, and collaborate on the project. Connect with users from the community and get help from the project maintainers. Get your questions answered and learn cool new tips and tricks! Watch for notifications of the latest content from Redis and the community. And share your own content with the community.

💻 Hardware Requirements

  • Memory (RAM): 16GB of RAM is recommended. This amount of RAM is advised to ensure smooth operation when running multiple Docker containers. Running the application with 8GB of RAM may lead to performance issues and resource constraints.

  • Processor (CPU): A multi-core processor with good performance is recommended, as it will help with running containerized services efficiently.

  • Storage: Sufficient storage space is required to store code repositories, container images, and application data. It's recommended to have at least 100GB of free disk space.

  • Network: A stable and high-speed internet connection is beneficial, especially when pulling and pushing container images and collaborating on projects hosted on GitHub.

Having a computer that meets or exceeds these recommended hardware requirements will enhance your development experience and ensure that your Law Knowledge development environment can handle the demands of running containerized services and managing code effectively.

🛠️ Prerequisites

  • Nx: A set of extensible dev tools for monorepos.
  • Docker: A set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
  • Helm: A tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources.
  • Kubernetes: An open-source system for automating deployment, scaling, and management of containerized applications.
  • Python: An interpreted, high-level, general-purpose programming language.
  • Poetry: A tool for dependency management and packaging in Python.
  • Node.js: An open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
  • pnpm: A fast, disk space efficient package manager that helps to minimize duplication while installing dependencies.
  • Pulumi: Acloud development platform that makes creating cloud programs easy and productive.

📦 Dataset

You can download the dataset from the following link:

  • Phap Dien: A website that provides legal documents of Vietnam.
  • QPPL: Database of Vietnam's legal documents.

🧑‍💻 Setup

First, clone the repository to your local machine:

git clone https://github.com/foxminchan/LawKnowledge

Next, navigate to the root directory of the project and install the dependencies:

pnpm install --force

🚀 Running

For the website, you can run the following command:

npx nx serve website --prod

For the API, you can run the following command:

# For the API Gateway
npx nx serve api-gateway --prod

# For the Auth Service
npx nx serve auth-svc --prod

# For the Law Service
npx nx serve law-svc --prod

# For the Chat Service
npx nx serve chat-svc --prod

# For the Search Service
npx nx serve search-svc --prod

To traning the model, you can run the following command:

npx nx build model

To set up the infrastructure, you can run the following command:

npx nx up pulumi
tip

If you want to run with Nx, make sure you have installed poetry globally. Python version must be >=3.9.1 <=3.12.

🧪 Testing

For the website, you can run the following command:

npx nx test website-e2e

For the API, you can run the following command:

# For the API Gateway
npx nx test api-gateway-e2e

# For the Auth Service
npx nx test auth-svc-e2e

# For the Law Service
npx nx test law-svc-e2e

# For the Search Service
npx nx test search-svc-e2e

# For the Chat Service
npx nx test chat-svc

To test the model, you can run the following command:

npx nx test model

🧩 Other

To run the tooling for processing the dataset, you can run the following command:

npx nx serve proc

For running documentation, you can run the following command:

npx nx serve docs

Some useful scripts:

# Navigate to the scripts directory
cd tools/scripts && ls

# + scripts
# +-- build.sh --> Build the project
# +-- clean.sh --> Clean the docker image
# +-- init.sh --> Initialize the project
# +-- prepare.sh --> Prepare the project
# +-- start.sh --> Start the project
# +-- start-o11y.sh --> Start the observability stack
# +-- stop-o11y.sh --> Stop the observability stack

# Run the script
./<script-name>

🛜 Port Binding

ServicePortProtocolEndpoint
Website4200HTTPhttp://localhost:4200
API Gateway8080HTTP/Sockethttp://localhost:8080
Auth Service8081gRPC0.0.0.0:8081
Law Service8082gRPC0.0.0.0:8082
Search Service8083gRPC0.0.0.0:8083
Chat Service8084gRPC0.0.0.0:8084