High-performance backend API server for the Nvisy document redaction platform, built with Rust and modern async technologies.
- High-Performance Architecture - Built with Axum and Tokio for exceptional async performance
- Type-Safe Database Layer - PostgreSQL integration with Diesel ORM and strict typing
- Comprehensive Security - JWT authentication, session management, and input validation
- MinIO Storage Integration - S3-compatible object storage for document management
- Dual OCR Processing - Mistral AI OCR and PaddleX HTTP API integration for flexible, high-accuracy document understanding
- LLM Chat Assistant - OpenRouter integration for intelligent document analysis and AI-powered features (optional)
- NATS Messaging - Real-time updates, job queues, sessions, and caching via NATS with JetStream and KV
- Production Ready - Health checks, graceful shutdown, connection pooling, and observability
- Auto-Generated Documentation - OpenAPI/Swagger specs with interactive UI
- Workspace Architecture - Modular crate design for optimal code organization
api/
├── crates/
│ ├── nvisy-cli/ # HTTP server CLI
│ ├── nvisy-minio/ # MinIO/S3-compatible storage client
│ ├── nvisy-mistral/ # Mistral AI OCR HTTP API client (external, or cloud OCR)
│ ├── nvisy-nats/ # NATS client (messaging, KV, streams, queues)
│ ├── nvisy-openrouter/ # OpenRouter AI client (assistant chatbot)
│ ├── nvisy-paddlex/ # PaddleX HTTP API client (internal, or local OCR)
│ ├── nvisy-postgres/ # PostgreSQL database layer
│ └── nvisy-server/ # Core HTTP API server
├── migrations/ # Database migrations
└── Cargo.toml # Workspace configuration
- Rust 1.89 or higher
- PostgreSQL 17 or higher
- NATS server with JetStream enabled
- MinIO instance or S3-compatible storage
- Mistral AI API key (for cloud OCR processing)
- AND/OR PaddleX server (for local OCR processing)
- OpenRouter API key (for LLM chat assistant - optional)
# Clone the repository
git clone https://github.com/nvisycom/api.git
cd api
# Install required tools
make install-all
# Generate auth keys
make generate-keys
# Build the workspace
cargo build --release
# Run database migrations
make generate-migrations
# Start the server
cargo run --bin nvisy-cli# Build and run with Docker
docker build -t nvisy-api .
docker run -p 3000:3000 nvisy-api
# Or use docker-compose
docker-compose up -dConfigure the API server using these environment variables:
| Variable | Description | Required | Default |
|---|---|---|---|
HOST |
Server host address | No | 127.0.0.1 |
PORT |
Server port number | No | 3000 |
REQUEST_TIMEOUT |
Request timeout in seconds | No | 30 |
SHUTDOWN_TIMEOUT |
Graceful shutdown timeout | No | 30 |
POSTGRES_URL |
PostgreSQL connection string | Yes | - |
AUTH_PUBLIC_PEM_FILEPATH |
JWT public key file path | No | ./public.pem |
AUTH_PRIVATE_PEM_FILEPATH |
JWT private key file path | No | ./private.pem |
MISTRAL_API_KEY |
Mistral AI API key | Yes | - |
MISTRAL_BASE_URL |
Mistral API base URL | No | https://api.mistral.ai/v1/ |
PADDLEX_API_KEY |
PaddleX service API key | No | - |
PADDLEX_BASE_URL |
PaddleX service base URL | No | http://localhost:8080/api/v1/ |
OPENROUTER_API_KEY |
OpenRouter API key for LLM | No | - |
OPENROUTER_BASE_URL |
OpenRouter API base URL | No | https://openrouter.ai/api/v1/ |
MINIO_ENDPOINT |
MinIO server endpoint | No | localhost:9000 |
MINIO_ACCESS_KEY |
MinIO access key | No | minioadmin |
MINIO_SECRET_KEY |
MinIO secret key | No | minioadmin |
NATS_URL |
NATS server URL | No | nats://127.0.0.1:4222 |
NATS_CLIENT_NAME |
NATS client name | No | nvisy-api |
CORS_ALLOWED_ORIGINS |
Comma-separated CORS origins | No | Empty (allows localhost) |
CORS_MAX_AGE |
CORS preflight cache duration | No | 3600 |
CORS_ALLOW_CREDENTIALS |
Allow credentials in CORS | No | true |
When built with the tls feature:
| Variable | Description | Required |
|---|---|---|
TLS_CERT_PATH |
Path to TLS certificate (PEM) | No |
TLS_KEY_PATH |
Path to TLS private key (PEM) | No |
When the server is running, access the interactive API documentation:
- Swagger UI:
http://localhost:3000/api/swagger - Scalar UI:
http://localhost:3000/api/scalar - OpenAPI JSON:
http://localhost:3000/api/openapi.json - Health Check:
http://localhost:3000/health
# Run all tests
cargo test --workspace
# Run tests with coverage
cargo tarpaulin --workspace --out Html
# Run specific crate tests
cargo test --package nvisy-server# Format code
cargo fmt --all
# Run linter
cargo clippy --all-targets --all-features -- -D warnings
# Security audit
cargo audit
# Check dependencies
cargo deny check# Generate auth keys
make generate-keys
# Run migrations and update schema
make generate-migrations
# Revert all migrations
make clear-migrations
# Create new migration
diesel migration generate migration_nameSee CHANGELOG.md for release notes and version history.
See CONTRIBUTING.md for development guidelines and contribution process.
MIT License - see LICENSE.txt for details.
- Documentation: docs.nvisy.com
- Issues: GitHub Issues
- Email: support@nvisy.com
- API Status: status.nvisy.com