No description
https://gitlab.com/logius/nldoc/web/nldoc_api
- Elixir 97.5%
- Shell 1.5%
- Go Template 0.8%
- Dockerfile 0.2%
## [6.3.2](https://gitlab.com/logius/nldoc/web/nldoc_api/compare/6.3.1...6.3.2) (2025-12-26) ### Bug Fixes * **deps:** update dependency nldoc_s3 to v1.0.9 ([ |
||
|---|---|---|
| .ci/semantic-release | ||
| config | ||
| helm | ||
| lib/nldoc | ||
| test | ||
| .credo.exs | ||
| .dialyzer_ignore.exs | ||
| .dockerignore | ||
| .editorconfig | ||
| .formatter.exs | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| CHANGELOG.md | ||
| CODEOWNERS | ||
| coveralls.json | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| mix.exs | ||
| mix.lock | ||
| publiccode.yml | ||
| README.md | ||
| renovate.json | ||
NLdoc.API
NLdoc.API is an Elixir-based HTTP API that orchestrates document conversion and validation in the NLdoc ecosystem developed by Logius. It provides REST endpoints for submitting documents for conversion, streaming conversion events, downloading results, and performing direct validation.
API Endpoints
| Endpoint | Method | Description | Content Type |
|---|---|---|---|
/conversion |
POST | Submit document(s) for conversion | Multipart or binary upload |
/conversion/:id |
GET | Stream conversion events (SSE) | text/event-stream |
/file/:key |
GET | Download converted file | Original file content type |
/validation |
POST | Validate document directly | application/vnd.nldoc.spec+json or .tiptap+json |
/health |
GET | Health check endpoint | application/json |
Conversion Workflow
- Upload:
POST /conversionwith file(s), optionally specifyx-target-content-type - Response: Receive job UUID(s) and conversion details
- Monitor:
GET /conversion/:idto stream events (started, progress, completed, failed) - Download:
GET /file/:keyto retrieve converted document
Requirements
- Elixir 1.19+ / OTP 28+
- RabbitMQ (AMQP)
- S3-compatible storage (AWS S3 or MinIO)
- NLdoc Worker instances for processing conversions
Installation
Docker
$ docker build -t nldoc-api .
$ docker run -e AMQP_HOST=rabbitmq -e S3_HOST=minio nldoc-api
Helm
$ helm install nldoc-api nldoc/nldoc-api -f values.yaml
Configuration
Environment variables
# URL to the JSON Web Key Set (JWKS) for JWT token validation. If not set, authentication is disabled.
AUTH_JWKS_URL=""
# Port number for the HTTP server to listen on.
PORT="4000"
# Path to CA certificates file for SSL/TLS verification when connecting to S3. If set, enables peer verification for S3 connections.
CA_CERTIFICATES_PATH=""
# Protocol scheme for S3 connections (http or https).
S3_SCHEME="http"
# Hostname of the S3-compatible storage service.
S3_HOST="localhost"
# Port number of the S3-compatible storage service.
S3_PORT="9000"
# Access key ID for S3 authentication.
S3_ACCESS_KEY="minio"
# Secret access key for S3 authentication.
S3_SECRET_KEY="1234567890"
# AWS region for S3 service.
S3_REGION="eu-west-1"
# S3 bucket name for file uploads. Falls back to `S3_BUCKET_NAME_FILES` if not set.
S3_BUCKET_UPLOADS="files"
# Alternative environment variable for S3 uploads bucket name (fallback for `S3_BUCKET_UPLOADS`).
S3_BUCKET_NAME_FILES="files"
# S3 bucket name for file downloads/output. Falls back to `S3_BUCKET_NAME_OUTPUT` if not set.
S3_BUCKET_DOWNLOADS="output"
# Alternative environment variable for S3 downloads bucket name (fallback for `S3_BUCKET_DOWNLOADS`).
S3_BUCKET_NAME_OUTPUT="output"
# Hostname of the AMQP/RabbitMQ message broker.
AMQP_HOST="localhost"
# Port number of the AMQP/RabbitMQ message broker.
AMQP_PORT="5672"
# Username for AMQP authentication.
AMQP_USERNAME="amqp"
# Password for AMQP authentication.
AMQP_PASSWORD="amqp"
# AMQP queue name for event messages.
AMQP_QUEUE_EVENT="events"
Usage
Development
$ mix deps.get
$ mix compile
$ mix run --no-halt
Production
$ MIX_ENV=prod mix release
$ _build/prod/rel/nldoc_api/bin/nldoc_api start
Development
Testing
# Run all tests
$ mix test
# Test coverage
$ MIX_ENV=test mix coveralls.json
$ MIX_ENV=test mix coveralls.html
# Coverage reports
$ mix coveralls.cobertura
Code Quality
# Format code
$ mix format
# Static analysis
$ mix credo
# Type checking
$ mix dialyzer
# Dependency audit
$ mix deps.audit
Logging
Structured JSON logging with ECS-compliant format:
- Application version and environment
- Service metadata (name, version, environment)
- Correlation and trace IDs (
trace.id,http.request.id) - Request/response logging via
LoggerJSON.Plug
Example:
{
"message": "Starting NLdoc API server v6.1.1 (env: prod, port: 4000)",
"service.name": "nldoc_api",
"service.version": "6.1.1",
"service.environment": "prod",
"@timestamp": "2025-12-22T13:36:19.998Z",
"log.level": "info",
"ecs.version": "8.11.0"
}
License
EUPL-1.2 (European Union Public License 1.2)
Links
- Source: https://gitlab.com/logius/nldoc/web/nldoc_api
- Documentation: https://hex.docs.pm/nldoc_api
- Changelog: https://hex.docs.pm/nldoc_api/changelog.html