Skip to content

Core API service for the platform, exposing REST and WebSocket interfaces for document processing, redaction, and data management. Requires PostgreSQL and NATS.

License

Notifications You must be signed in to change notification settings

nvisycom/server

Repository files navigation

Nvisy.com API Server

rust build axum

High-performance backend API server for the Nvisy document redaction platform, built with Rust and modern async technologies.

Features

  • 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
  • OCR Processing - PaddleX HTTP API integration for high-accuracy document understanding
  • LLM Chat Assistant - OpenRouter integration for intelligent document analysis and AI-powered features
  • 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

Architecture

server/
├── crates/
│   ├── nvisy-cli/          # HTTP server CLI
│   ├── nvisy-nats/         # NATS client (streams, KV, queues)
│   ├── nvisy-openrouter/   # OpenRouter AI HTTP API client (assistant chatbot)
│   ├── nvisy-paddle/       # PaddleX HTTP API client (OCR, image recognition)
│   ├── nvisy-postgres/     # PostgreSQL database layer
│   └── nvisy-server/       # Core HTTP API server
├── migrations/             # PostgreSQL database migrations
└── Cargo.toml              # Workspace configuration

Quick Start

Prerequisites

  • Rust 1.89 or higher
  • PostgreSQL 17 or higher
  • NATS server with JetStream enabled
  • PaddleX server with OCR pipeline enabled
  • OpenRouter/OpenAI-compatible API key

Installation

# Clone the repository
git clone https://github.com/nvisycom/server.git
cd server

# Install required tools
make install-all
# Generate auth keys and migrations
make generate-keys
make generate-migrations

# Build the workspace and start the server
cargo build --release
cargo run --bin nvisy-cli

Docker

# Build and run with Docker
docker build -t nvisy-server .
docker run -p 3000:3000 nvisy-server

# Or use docker-compose
docker-compose up -d

Configuration

Environment Variables

Configure 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
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/
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

TLS Configuration (Optional)

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

API Documentation

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

Changelog

See CHANGELOG.md for release notes and version history.

Contributing

See CONTRIBUTING.md for development guidelines and contribution process.

License

MIT License - see LICENSE.txt for details.

Support

About

Core API service for the platform, exposing REST and WebSocket interfaces for document processing, redaction, and data management. Requires PostgreSQL and NATS.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages