iexec-arweave-api is an HTTP API that allows file uploads and pushes them to the Arweave decentralized storage network.
It enforces a file size limit (100KB), provides structured logging, clean error handling, and a service-oriented architecture ready for containerized deployment.
This API is used via the dataprotector-sdk to upload datasets directly to Arweave if desired (IPFS otherwise).
- Node.js 22 + Express
- TypeScript
- Multer for file parsing
- Pino for logging
- Vitest for testing
src/
├── index.ts # App entrypoint
├── types.ts # FileUploadError interface
├── middleware/ # Custom Express middleware
│ ├── error.ts # Global error handler
│ ├── logger.ts # Request logging
│ └── not-found.ts # 404 handler
├── upload/ # Upload feature
│ ├── upload.controller.ts # HTTP request handling
│ ├── upload.routes.ts # Express router
│ └── upload.service.ts # Arweave integration logic
└── utils/
└── logger.ts # Pino logger setup
npm install
npm run dev
#Or with pretty logging:
npm run dev:pretty
Unit tests are written using Vitest.
npm run test
Check types, format code, and lint:
npm run check-types
npm run format
npm run lint
Start API
npm run dev
In other terminal
echo "Try to add a file to arweave" > demo.txt
curl -X POST http://localhost:3000/upload -F "[email protected]" | jq
{
"arweaveId": "n-JSY0BRWyVWIKsav8JuPUZymwFZArRhBlqHKlcfmqs",
"url": "https://arweave.net/n-JSY0BRWyVWIKsav8JuPUZymwFZArRhBlqHKlcfmqs"
}
A health endpoint (/health
) is enabled by default
This endpoint allows to define health checks in an orchestrator or a compose file.
Files exceeding the 100KB limit are rejected with HTTP 413 Payload Too Large. All unhandled errors return HTTP 500 with a structured error response. Requests to unknown endpoints return HTTP 404.
This repository code is released under the Apache License 2.0.