# opiagile/direito-lux-mvp architecture

> Architecture diagram of the GitHub repository opiagile/direito-lux-mvp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opiagile/direito-lux-mvp
- Repository: https://github.com/opiagile/direito-lux-mvp

## Overview

Direito Lux is a SaaS legal-practice platform. Its main user workflow is to access the web application, manage and search legal cases, monitor case updates, and receive reports or notifications; AI-assisted legal analysis and conversational bots are additional capabilities. The repository is organized as a Next.js frontend and Go/Python service subsystems. The README documents the product capabilities and broad service architecture, but most inter-service wiring is not evidenced in the excerpts, so those connections are not inferred.

Main entry points: [`frontend/src/app/(dashboard)/dashboard/page.tsx`](https://github.com/opiagile/direito-lux-mvp/blob/main/frontend/src/app/(dashboard)/dashboard/page.tsx) (Web interface), [`services/ai-service/app/services/jurisprudence_service.py`](https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/services/jurisprudence_service.py) (AI analysis), [`services/notification-service/internal/application/services/notification_service.go`](https://github.com/opiagile/direito-lux-mvp/blob/main/services/notification-service/internal/application/services/notification_service.go) (Notifications), [`services/process-service/internal/application/service.go`](https://github.com/opiagile/direito-lux-mvp/blob/main/services/process-service/internal/application/service.go) (Case monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_frontend["Web interface<br/>[page.tsx]"]
  node_auth["Authentication<br/>[auth_handler.go]"]
end

subgraph group_legal["Legal case services"]
  node_process["Case monitoring<br/>[service.go]"]
  node_datajud["DataJud integration<br/>[datajud_service.go]"]
  node_search["Case search<br/>[search_handlers.go]"]
end

subgraph group_intelligence["AI and conversational tools"]
  node_ai["AI analysis"]
  node_ai_local["Local AI API<br/>[main_local.py]"]
  node_ai_db["AI data access<br/>[database.py]"]
  node_ai_models["Legal AI models<br/>[jurisprudence.py]"]
  node_mcp["Conversational bot<br/>[tool_service.go]"]
end

subgraph group_operations["Tenant and billing"]
  node_tenant["Tenant management<br/>[tenant_service.go]"]
  node_billing["Subscriptions and payments<br/>[payment_service.go]"]
end

subgraph group_communications["Reports and notifications"]
  node_notifications["Notifications"]
  node_notification_channels["Delivery channels<br/>[factory.go]"]
  node_reports["Reports and dashboards<br/>[report_service.go]"]
  node_templates["Document templates<br/>[handlers.go]"]
end

node_user(("Legal staff"))
node_datajud_external{{"CNJ DataJud API"}}
node_ai_external{{"Remote AI service"}}

node_user -->|"uses"| node_frontend
node_frontend -.->|"authenticates with"| node_auth
node_frontend -.->|"manages cases"| node_process
node_frontend -.->|"searches cases"| node_search
node_frontend -.->|"requests analysis"| node_ai
node_frontend -.->|"views analytics"| node_reports
node_frontend -.->|"views notifications"| node_notifications
node_frontend -.->|"manages workspace"| node_tenant
node_frontend -.->|"manages plan"| node_billing
node_process -.->|"monitors via"| node_datajud
node_datajud -.->|"queries"| node_datajud_external
node_ai_local -->|"delegates AI requests"| node_ai_external
node_ai -->|"uses models"| node_ai_models
node_ai -.->|"reads decisions"| node_ai_db
node_mcp -.->|"offers case tools"| node_process
node_mcp -.->|"offers search tools"| node_search
node_notifications -.->|"dispatches through"| node_notification_channels
node_notifications -.->|"delivers updates"| node_user
node_reports -.->|"presents analytics"| node_user
node_templates -.->|"provides templates"| node_user

click node_frontend "https://github.com/opiagile/direito-lux-mvp/blob/main/frontend/src/app/(dashboard)/dashboard/page.tsx"
click node_auth "https://github.com/opiagile/direito-lux-mvp/blob/main/services/auth-service/internal/infrastructure/http/auth_handler.go"
click node_process "https://github.com/opiagile/direito-lux-mvp/blob/main/services/process-service/internal/application/service.go"
click node_datajud "https://github.com/opiagile/direito-lux-mvp/blob/main/services/datajud-service/internal/application/datajud_service.go"
click node_search "https://github.com/opiagile/direito-lux-mvp/blob/main/services/search-service/internal/infrastructure/http/handlers/search_handlers.go"
click node_ai "https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/services/jurisprudence_service.py"
click node_ai_local "https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/main_local.py"
click node_ai_db "https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/db/database.py"
click node_ai_models "https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/models/jurisprudence.py"
click node_mcp "https://github.com/opiagile/direito-lux-mvp/blob/main/services/mcp-service/internal/application/services/tool_service.go"
click node_tenant "https://github.com/opiagile/direito-lux-mvp/blob/main/services/tenant-service/internal/application/tenant_service.go"
click node_billing "https://github.com/opiagile/direito-lux-mvp/blob/main/services/billing-service/internal/application/payment_service.go"
click node_notifications "https://github.com/opiagile/direito-lux-mvp/blob/main/services/notification-service/internal/application/services/notification_service.go"
click node_notification_channels "https://github.com/opiagile/direito-lux-mvp/blob/main/services/notification-service/internal/infrastructure/providers/factory.go"
click node_reports "https://github.com/opiagile/direito-lux-mvp/blob/main/services/report-service/internal/application/services/report_service.go"
click node_templates "https://github.com/opiagile/direito-lux-mvp/blob/main/template-service/internal/infrastructure/http/handlers/handlers.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_auth toneBlue
class node_process,node_datajud,node_search toneAmber
class node_ai,node_ai_local,node_ai_db,node_ai_models,node_mcp,node_datajud_external toneMint
class node_tenant,node_billing toneRose
class node_notifications,node_notification_channels,node_reports,node_templates,node_user,node_ai_external toneIndigo
```

## Components

### Web application

- [Web interface](https://github.com/opiagile/direito-lux-mvp/blob/main/frontend/src/app/(dashboard)/dashboard/page.tsx): `frontend/src/app/(dashboard)/dashboard/page.tsx`
- [Authentication](https://github.com/opiagile/direito-lux-mvp/blob/main/services/auth-service/internal/infrastructure/http/auth_handler.go): `services/auth-service/internal/infrastructure/http/auth_handler.go`

### Legal case services

- [Case monitoring](https://github.com/opiagile/direito-lux-mvp/blob/main/services/process-service/internal/application/service.go): `services/process-service/internal/application/service.go`
- [DataJud integration](https://github.com/opiagile/direito-lux-mvp/blob/main/services/datajud-service/internal/application/datajud_service.go): `services/datajud-service/internal/application/datajud_service.go`
- [Case search](https://github.com/opiagile/direito-lux-mvp/blob/main/services/search-service/internal/infrastructure/http/handlers/search_handlers.go): `services/search-service/internal/infrastructure/http/handlers/search_handlers.go`

### AI and conversational tools

- [AI analysis](https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/services/jurisprudence_service.py): `services/ai-service/app/services/jurisprudence_service.py`
- [Local AI API](https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/main_local.py): `services/ai-service/app/main_local.py`
- [AI data access](https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/db/database.py): `services/ai-service/app/db/database.py`
- [Legal AI models](https://github.com/opiagile/direito-lux-mvp/blob/main/services/ai-service/app/models/jurisprudence.py): `services/ai-service/app/models/jurisprudence.py`
- [Conversational bot](https://github.com/opiagile/direito-lux-mvp/blob/main/services/mcp-service/internal/application/services/tool_service.go): `services/mcp-service/internal/application/services/tool_service.go`

### Tenant and billing

- [Tenant management](https://github.com/opiagile/direito-lux-mvp/blob/main/services/tenant-service/internal/application/tenant_service.go): `services/tenant-service/internal/application/tenant_service.go`
- [Subscriptions and payments](https://github.com/opiagile/direito-lux-mvp/blob/main/services/billing-service/internal/application/payment_service.go): `services/billing-service/internal/application/payment_service.go`

### Reports and notifications

- [Notifications](https://github.com/opiagile/direito-lux-mvp/blob/main/services/notification-service/internal/application/services/notification_service.go): `services/notification-service/internal/application/services/notification_service.go`
- [Delivery channels](https://github.com/opiagile/direito-lux-mvp/blob/main/services/notification-service/internal/infrastructure/providers/factory.go): `services/notification-service/internal/infrastructure/providers/factory.go`
- [Reports and dashboards](https://github.com/opiagile/direito-lux-mvp/blob/main/services/report-service/internal/application/services/report_service.go): `services/report-service/internal/application/services/report_service.go`
- [Document templates](https://github.com/opiagile/direito-lux-mvp/blob/main/template-service/internal/infrastructure/http/handlers/handlers.go): `template-service/internal/infrastructure/http/handlers/handlers.go`

### Other components

- **Legal staff**
- **CNJ DataJud API**
- **Remote AI service**

## Connections

- Legal staff → Web interface: uses (evidence: `README.md`)
- Web interface → Authentication: authenticates with
- Web interface → Case monitoring: manages cases
- Web interface → Case search: searches cases
- Web interface → AI analysis: requests analysis
- Web interface → Reports and dashboards: views analytics
- Web interface → Notifications: views notifications
- Web interface → Tenant management: manages workspace
- Web interface → Subscriptions and payments: manages plan
- Case monitoring → DataJud integration: monitors via (evidence: `README.md`)
- DataJud integration → CNJ DataJud API: queries (evidence: `README.md`)
- Local AI API → Remote AI service: delegates AI requests (evidence: `services/ai-service/app/main_local.py`)
- AI analysis → Legal AI models: uses models (evidence: `services/ai-service/app/services/jurisprudence_service.py`)
- AI analysis → AI data access: reads decisions
- Conversational bot → Case monitoring: offers case tools (evidence: `README.md`)
- Conversational bot → Case search: offers search tools (evidence: `README.md`)
- Notifications → Delivery channels: dispatches through
- Notifications → Legal staff: delivers updates (evidence: `README.md`)
- Reports and dashboards → Legal staff: presents analytics (evidence: `README.md`)
- Document templates → Legal staff: provides templates (evidence: `README.md`)
