Marai is a cloud-based architecture designed to streamline legal consultations and case file management for clients and law firms. It enables seamless communication between clients and legal consultants, allowing clients to request legal guidance, submit case files for review, and receive AI-powered insights. The system ensures secure storage, efficient case file compression, and retrieval through a distributed and scalable infrastructure leveraging AWS and Azure services.
Caution
We are currently developing the Marai platform.
- Workflow Management for law firms.
- Contract Lifecycle Management for law firms.
- Integrates AI-driven analysis for legal case management.
- Marketplace for legal services and resources.
The system consists of multiple AWS and Azure services interacting to form a robust and efficient workflow:
Tip
We are using a multi-cloud based architecture, with AWS Services on the API server side, and Azure for the agents server.
-
Client (EC2, React) 🖥️
- A front-end application running on AWS EC2, built with React.
- Handles user interactions and sends requests to the backend.
-
AWS WAF (Web Application Firewall) 🔒
- Provides security against common web threats.
- Protects the system from malicious attacks before traffic reaches the load balancer.
-
AWS ALB (Application Load Balancer) ⚖️
- Distributes incoming traffic among multiple backend instances.
- Ensures high availability and fault tolerance.
-
Server (EC2, Echo) 💻
- The main backend application running on AWS EC2, built with Echo (a Golang framework).
- Handles requests from the front-end and interacts with various AWS services.
-
AWS SQS (Simple Queue Service) 📩
- Asynchronous message queuing service.
- Ensures smooth processing of tasks by the Swarm Server.
-
Swarm Server (EC2, FastAPI) ⚡
- A microservice-based backend using FastAPI, running on EC2.
- Processes queued tasks and interacts with AI and search services.
-
AWS S3 (Simple Storage Service) 📂
- Stores files and documents for the system.
- Ensures secure and scalable storage of workflow-related data.
-
AWS ElastiCache ⚡
- Provides caching for improved application performance.
- Works alongside AWS RDS for efficient data retrieval.
-
AWS RDS (PostgreSQL) 🗄️
- Relational database for structured data storage.
- Used for managing workflow-related metadata and case information.
-
AWS CloudWatch 📊
- Monitors application and infrastructure performance.
- Provides logging, metrics, and alerting functionalities.
-
Azure OpenAI 🤖
- Provides AI-powered capabilities for legal case analysis and automation.
- Supports intelligent document processing and legal insights.
-
AWS OpenSearch (RAG - Retrieval-Augmented Generation) 🔍
- Enables efficient searching and indexing of legal documents.
- Supports AI-powered retrieval and case reference management.
- The Client (React on EC2) sends requests via AWS ALB.
- Requests pass through AWS WAF for security checks.
- The Server (Echo on EC2) processes the request and interacts with:
- AWS S3 for document storage.
- AWS RDS for database queries.
- AWS ElastiCache for fast data retrieval.
- AWS CloudWatch for monitoring and logging.
- If necessary, tasks are sent to AWS SQS, which triggers the Swarm Server (FastAPI on EC2) for processing.
- The Swarm Server interacts with AI models on Azure OpenAI and performs document retrieval using AWS OpenSearch (RAG).
- The system responds to the client with processed data or insights.
- Provision AWS EC2 instances for the client, backend servers, and swarm server.
- Set up AWS ALB and WAF for secure traffic management.
- Deploy PostgreSQL on AWS RDS and configure connections.
- Enable AWS S3 and OpenSearch for storage and document retrieval.
- Configure Azure OpenAI API for AI-driven processing.
- Monitor performance using AWS CloudWatch.
Marai ensures secure and efficient contract management through the following measures:
-
Role-Based Access Control (RBAC):
- Permissions are enforced based on user roles (e.g., owner, admin, member).
- Only authorized users can create, update, delete, or view contracts.
-
Data Encryption:
- Contract files are encrypted using server-side encryption before being stored in the MinIO object storage.
- SHA-256 hashing is used to ensure file integrity.
-
Audit Trails:
- All actions on contracts (e.g., signing, viewing) are logged as signature events.
- These logs include metadata such as IP address, user agent, and timestamps.
-
Soft Deletion:
- Contracts are soft-deleted to prevent accidental data loss.
- Deleted contracts are marked with a
is_deleted
flag and retain their metadata for auditing purposes.
-
Status Transitions:
- Contracts follow a strict lifecycle (e.g., draft → pending_signature → signed → void).
- Invalid status transitions are rejected to maintain data integrity.
-
File Uploads:
- Users can upload files to draft contracts.
- Uploaded files are securely stored and accessible only to authorized users.
-
Party Management:
- Parties can be added or removed from draft contracts.
- Each party has attributes like name, email, mobile, and role.
-
Digital Signatures:
- Parties can digitally sign contracts.
- Once all parties have signed, the contract status is updated to
signed
.
-
Pagination and Filtering:
- Contracts can be listed with filters (e.g., status, isTemplate) and pagination for efficient retrieval.
- Implement serverless functions (AWS Lambda) for improved scalability.
- Enhance AI models for better legal text processing.
- Expand OpenSearch capabilities for advanced legal search queries.
marai
is available under the MPL 2.0 license. See the LICENSE file for more info.