DocSpec Import API
This repository contains an Elixir application that exposes a small HTTP API for converting DOCX documents into BlockNote JSON. It also provides a companion Node based service that converts BlockNote blocks into Y.js updates.
Project layout
- Elixir application – defined in
mix.exsand built with Plug and Bandit. The main router lives inlib/docspec/api.exand exposes a/conversionendpoint implemented inlib/docspec/api/controller/conversion.ex. - Node service – located in
blocknote-apiand implemented insrc/main.ts. This service listens for JSON blocks on port9871(configurable with thePORTenvironment variable) and returns a base64 encoded Y.js update. - Docker setup –
Dockerfilebuilds the Elixir release anddocker-compose.ymlwires the services behind Traefik.
Usage
The easiest way to run everything locally is with Docker:
docker-compose up --build
Alternatively you can build the Elixir release yourself:
mix deps.get mix release _build/prod/rel/docspec/bin/docspec start
Once running you can POST a DOCX file to convert:
curl -X POST http://localhost:4000/conversion -F "file=@path/to/document.docx"The response body is the converted BlockNote JSON.
Testing
Elixir tests can be run with:
License
See LICENSE for license information (MIT).