legalis-api
REST API server for Legalis-RS.
Overview
legalis-api provides a production-ready REST API server built with Axum for managing and evaluating legal statutes programmatically.
Features
- REST API: Full CRUD operations for statutes
- Verification Endpoints: Validate statute consistency
- Evaluation Endpoints: Check eligibility for entities
- Health Checks: Kubernetes-ready health endpoints
- OpenAPI Compatible: Standard REST conventions
Endpoints
Statutes
| Method | Path | Description |
|---|---|---|
GET |
/api/v1/statutes |
List all statutes |
GET |
/api/v1/statutes/:id |
Get statute by ID |
POST |
/api/v1/statutes |
Create new statute |
PUT |
/api/v1/statutes/:id |
Update statute |
DELETE |
/api/v1/statutes/:id |
Delete statute |
Verification
| Method | Path | Description |
|---|---|---|
POST |
/api/v1/verify |
Verify statute(s) |
POST |
/api/v1/verify/:id |
Verify specific statute |
Evaluation
| Method | Path | Description |
|---|---|---|
POST |
/api/v1/evaluate |
Evaluate entity against statutes |
POST |
/api/v1/evaluate/:id |
Evaluate against specific statute |
Health
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/ready |
Readiness check |
Usage
As Library
use ;
use Arc;
async
Via CLI
# Start API server
API Examples
# Create a statute
# Verify all statutes
# Evaluate an entity
Configuration
| Environment Variable | Default | Description |
|---|---|---|
HOST |
127.0.0.1 |
Server bind address |
PORT |
3000 |
Server port |
LOG_LEVEL |
info |
Logging level |
Cargo Features
The following features are available:
- grpc (enabled by default): gRPC API server with reflection and health checking
- redis-cache: Redis-based caching support for improved performance
- oauth2-auth: OAuth2 authentication and authorization
- otel-tracing: OpenTelemetry tracing integration for observability
Default Build (Includes gRPC)
Minimal Build (No gRPC)
If you don't need the gRPC API and want to reduce dependencies:
[]
= { = "0.1", = false }
Or build with:
Custom Feature Combination
[]
= { = "0.1", = false, = ["redis-cache", "oauth2-auth"] }
License
MIT OR Apache-2.0